]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
OMAP3 EVM: enable ethernet support
authorSteve Sakoman <steve@sakoman.com>
Thu, 8 May 2008 16:48:51 +0000 (09:48 -0700)
committerTony Lindgren <tony@atomide.com>
Fri, 9 May 2008 21:59:13 +0000 (14:59 -0700)
OMAP3 EVM: add ethernet support (smc911x)

Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/mach-omap2/board-omap3evm.c
include/asm-arm/arch-omap/board-omap3evm.h

index 825da19165a6f1e2f66abc209656ac79d0ca19c4..d8109ae087d2a1e2d99a0a8a3be550b415e5d2bd 100644 (file)
 #include <asm/arch/common.h>
 #include <asm/arch/mcspi.h>
 
+static struct resource omap3evm_smc911x_resources[] = {
+       [0] =   {
+               .start  = OMAP3EVM_ETHR_START,
+               .end    = (OMAP3EVM_ETHR_START + OMAP3EVM_ETHR_SIZE - 1),
+               .flags  = IORESOURCE_MEM,
+       },
+       [1] =   {
+               .start  = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ),
+               .end    = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ),
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device omap3evm_smc911x_device = {
+       .name           = "smc911x",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(omap3evm_smc911x_resources),
+       .resource       = &omap3evm_smc911x_resources [0],
+};
+
+static inline void __init omap3evm_init_smc911x(void)
+{
+       int eth_cs;
+       struct clk *l3ck;
+       unsigned int rate;
+
+       eth_cs = OMAP3EVM_SMC911X_CS;
+
+       l3ck = clk_get(NULL, "l3_ck");
+       if (IS_ERR(l3ck))
+               rate = 100000000;
+       else
+               rate = clk_get_rate(l3ck);
+
+       if (omap_request_gpio(OMAP3EVM_ETHR_GPIO_IRQ) < 0) {
+               printk(KERN_ERR "Failed to request GPIO%d for smc911x IRQ\n",
+                       OMAP3EVM_ETHR_GPIO_IRQ);
+               return;
+       }
+
+       omap_set_gpio_direction(OMAP3EVM_ETHR_GPIO_IRQ, 1);
+}
+
 static struct omap_uart_config omap3_evm_uart_config __initdata = {
        .enabled_uarts  = ((1 << 0) | (1 << 1) | (1 << 2)),
 };
@@ -111,6 +154,7 @@ static void __init omap3_evm_init_irq(void)
        omap2_init_common_hw();
        omap_init_irq();
        omap_gpio_init();
+       omap3evm_init_smc911x();
 }
 
 static struct omap_board_config_kernel omap3_evm_config[] __initdata = {
@@ -124,6 +168,7 @@ static struct platform_device *omap3_evm_devices[] __initdata = {
 #ifdef CONFIG_RTC_DRV_TWL4030
        &omap3_evm_twl4030rtc_device,
 #endif
+       &omap3evm_smc911x_device,
 };
 
 static void __init omap3_evm_init(void)
index 67188c3efd380e86045b843f560233d7768244d0..784d7f2f830652c735cd8f1331a278018ee7e498 100644 (file)
 extern void omap3evm_flash_init(void);
 
 #define OMAP3_EVM_TS_GPIO      175
+
 #define ONENAND_MAP            0x20000000
 
+#define OMAP3EVM_ETHR_START    0x2c000000
+#define OMAP3EVM_ETHR_SIZE     1024
+#define OMAP3EVM_ETHR_GPIO_IRQ 176
+#define OMAP3EVM_SMC911X_CS    5
+
 #endif /* __ASM_ARCH_OMAP3_EVM_H */