diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2008-04-18 22:43:09 +0100 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2008-04-18 22:43:09 +0100 |
commit | be4f3c8691492934c8ee03dbecb3a3a865ac6cd6 (patch) | |
tree | fcc2c0270a43dbf9b054546f1b361d6acffb130a /arch/arm/mach-realview/realview_eb.c | |
parent | b7b0ba942f7b18de678cd081902aad8a0b6581c6 (diff) |
Add RealView/EB support for the LAN9118 Ethernet chip
RealView/EB revD platform comes with the SMSC LAN9118 Ethernet
chip. This patch allows either the smc91x or the smc911x drivers to be
used with the RealView/EB platform.
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm/mach-realview/realview_eb.c')
-rw-r--r-- | arch/arm/mach-realview/realview_eb.c | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c index 60d9eb810246..6d150809e277 100644 --- a/arch/arm/mach-realview/realview_eb.c +++ b/arch/arm/mach-realview/realview_eb.c @@ -224,7 +224,7 @@ static struct amba_device *amba_devs[] __initdata = { * RealView EB platform devices */ -static struct resource realview_eb_smc91x_resources[] = { +static struct resource realview_eb_eth_resources[] = { [0] = { .start = REALVIEW_ETH_BASE, .end = REALVIEW_ETH_BASE + SZ_64K - 1, @@ -237,13 +237,36 @@ static struct resource realview_eb_smc91x_resources[] = { }, }; -static struct platform_device realview_eb_smc91x_device = { - .name = "smc91x", +static struct platform_device realview_eb_eth_device = { .id = 0, - .num_resources = ARRAY_SIZE(realview_eb_smc91x_resources), - .resource = realview_eb_smc91x_resources, + .num_resources = ARRAY_SIZE(realview_eb_eth_resources), + .resource = realview_eb_eth_resources, }; +/* + * Detect and register the correct Ethernet device. RealView/EB rev D + * platforms use the newer SMSC LAN9118 Ethernet chip + */ +static int eth_device_register(void) +{ + void __iomem *eth_addr = ioremap(REALVIEW_ETH_BASE, SZ_4K); + u32 idrev; + + if (!eth_addr) + return -ENOMEM; + + idrev = readl(eth_addr + 0x50); + if ((idrev & 0xFFFF0000) == 0x01180000) + /* SMSC LAN9118 chip present */ + realview_eb_eth_device.name = "smc911x"; + else + /* SMSC 91C111 chip present */ + realview_eb_eth_device.name = "smc91x"; + + iounmap(eth_addr); + return platform_device_register(&realview_eb_eth_device); +} + static void __init gic_init_irq(void) { if (core_tile_eb11mp()) { @@ -301,8 +324,8 @@ static void realview_eb11mp_fixup(void) kmi1_device.irq[0] = IRQ_EB11MP_KMI1; /* platform devices */ - realview_eb_smc91x_resources[1].start = IRQ_EB11MP_ETH; - realview_eb_smc91x_resources[1].end = IRQ_EB11MP_ETH; + realview_eb_eth_resources[1].start = IRQ_EB11MP_ETH; + realview_eb_eth_resources[1].end = IRQ_EB11MP_ETH; } static void __init realview_eb_timer_init(void) @@ -340,8 +363,8 @@ static void __init realview_eb_init(void) clk_register(&realview_clcd_clk); platform_device_register(&realview_flash_device); - platform_device_register(&realview_eb_smc91x_device); platform_device_register(&realview_i2c_device); + eth_device_register(); for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { struct amba_device *d = amba_devs[i]; |