From: Steve Sakoman Date: Thu, 8 May 2008 16:48:51 +0000 (-0700) Subject: OMAP3 EVM: enable ethernet support X-Git-Tag: v2.6.26-omap1~123^2~119 X-Git-Url: http://www.pilppa.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=1444c6f39a98e8bcdb4a7434e1a32a19f68952a6;p=linux-2.6-omap-h63xx.git OMAP3 EVM: enable ethernet support OMAP3 EVM: add ethernet support (smc911x) Signed-off-by: Steve Sakoman Signed-off-by: Tony Lindgren --- diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c index 825da19165a..d8109ae087d 100644 --- a/arch/arm/mach-omap2/board-omap3evm.c +++ b/arch/arm/mach-omap2/board-omap3evm.c @@ -35,6 +35,49 @@ #include #include +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) diff --git a/include/asm-arm/arch-omap/board-omap3evm.h b/include/asm-arm/arch-omap/board-omap3evm.h index 67188c3efd3..784d7f2f830 100644 --- a/include/asm-arm/arch-omap/board-omap3evm.h +++ b/include/asm-arm/arch-omap/board-omap3evm.h @@ -32,7 +32,13 @@ 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 */