aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCatalin Marinas <catalin.marinas@arm.com>2008-04-18 17:43:09 -0400
committerCatalin Marinas <catalin.marinas@arm.com>2008-04-18 17:43:09 -0400
commitbe4f3c8691492934c8ee03dbecb3a3a865ac6cd6 (patch)
treefcc2c0270a43dbf9b054546f1b361d6acffb130a
parentb7b0ba942f7b18de678cd081902aad8a0b6581c6 (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>
-rw-r--r--arch/arm/mach-realview/realview_eb.c39
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 = {
224 * RealView EB platform devices 224 * RealView EB platform devices
225 */ 225 */
226 226
227static struct resource realview_eb_smc91x_resources[] = { 227static struct resource realview_eb_eth_resources[] = {
228 [0] = { 228 [0] = {
229 .start = REALVIEW_ETH_BASE, 229 .start = REALVIEW_ETH_BASE,
230 .end = REALVIEW_ETH_BASE + SZ_64K - 1, 230 .end = REALVIEW_ETH_BASE + SZ_64K - 1,
@@ -237,13 +237,36 @@ static struct resource realview_eb_smc91x_resources[] = {
237 }, 237 },
238}; 238};
239 239
240static struct platform_device realview_eb_smc91x_device = { 240static struct platform_device realview_eb_eth_device = {
241 .name = "smc91x",
242 .id = 0, 241 .id = 0,
243 .num_resources = ARRAY_SIZE(realview_eb_smc91x_resources), 242 .num_resources = ARRAY_SIZE(realview_eb_eth_resources),
244 .resource = realview_eb_smc91x_resources, 243 .resource = realview_eb_eth_resources,
245}; 244};
246 245
246/*
247 * Detect and register the correct Ethernet device. RealView/EB rev D
248 * platforms use the newer SMSC LAN9118 Ethernet chip
249 */
250static int eth_device_register(void)
251{
252 void __iomem *eth_addr = ioremap(REALVIEW_ETH_BASE, SZ_4K);
253 u32 idrev;
254
255 if (!eth_addr)
256 return -ENOMEM;
257
258 idrev = readl(eth_addr + 0x50);
259 if ((idrev & 0xFFFF0000) == 0x01180000)
260 /* SMSC LAN9118 chip present */
261 realview_eb_eth_device.name = "smc911x";
262 else
263 /* SMSC 91C111 chip present */
264 realview_eb_eth_device.name = "smc91x";
265
266 iounmap(eth_addr);
267 return platform_device_register(&realview_eb_eth_device);
268}
269
247static void __init gic_init_irq(void) 270static void __init gic_init_irq(void)
248{ 271{
249 if (core_tile_eb11mp()) { 272 if (core_tile_eb11mp()) {
@@ -301,8 +324,8 @@ static void realview_eb11mp_fixup(void)
301 kmi1_device.irq[0] = IRQ_EB11MP_KMI1; 324 kmi1_device.irq[0] = IRQ_EB11MP_KMI1;
302 325
303 /* platform devices */ 326 /* platform devices */
304 realview_eb_smc91x_resources[1].start = IRQ_EB11MP_ETH; 327 realview_eb_eth_resources[1].start = IRQ_EB11MP_ETH;
305 realview_eb_smc91x_resources[1].end = IRQ_EB11MP_ETH; 328 realview_eb_eth_resources[1].end = IRQ_EB11MP_ETH;
306} 329}
307 330
308static void __init realview_eb_timer_init(void) 331static void __init realview_eb_timer_init(void)
@@ -340,8 +363,8 @@ static void __init realview_eb_init(void)
340 clk_register(&realview_clcd_clk); 363 clk_register(&realview_clcd_clk);
341 364
342 platform_device_register(&realview_flash_device); 365 platform_device_register(&realview_flash_device);
343 platform_device_register(&realview_eb_smc91x_device);
344 platform_device_register(&realview_i2c_device); 366 platform_device_register(&realview_i2c_device);
367 eth_device_register();
345 368
346 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { 369 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
347 struct amba_device *d = amba_devs[i]; 370 struct amba_device *d = amba_devs[i];