aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mv78xx0
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2011-05-15 07:32:44 -0400
committerNicolas Pitre <nico@fluxnic.net>2011-05-16 15:06:01 -0400
commit7e3819d820c9aa3536d15fe7310c054bef1f5f04 (patch)
treea65cf874aceae43813e5c03f587e8f5bfaaf32ad /arch/arm/mach-mv78xx0
parent4748058c5cbf70b3adfa37204c047fcb29f335c0 (diff)
ARM: orion: Consolidate ethernet platform data
Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
Diffstat (limited to 'arch/arm/mach-mv78xx0')
-rw-r--r--arch/arm/mach-mv78xx0/common.c218
1 files changed, 12 insertions, 206 deletions
diff --git a/arch/arm/mach-mv78xx0/common.c b/arch/arm/mach-mv78xx0/common.c
index 5b474e4574de..0fd9a8329910 100644
--- a/arch/arm/mach-mv78xx0/common.c
+++ b/arch/arm/mach-mv78xx0/common.c
@@ -13,7 +13,6 @@
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/serial_8250.h> 14#include <linux/serial_8250.h>
15#include <linux/mbus.h> 15#include <linux/mbus.h>
16#include <linux/mv643xx_eth.h>
17#include <linux/mv643xx_i2c.h> 16#include <linux/mv643xx_i2c.h>
18#include <linux/ata_platform.h> 17#include <linux/ata_platform.h>
19#include <linux/ethtool.h> 18#include <linux/ethtool.h>
@@ -280,175 +279,32 @@ void __init mv78xx0_ehci2_init(void)
280/***************************************************************************** 279/*****************************************************************************
281 * GE00 280 * GE00
282 ****************************************************************************/ 281 ****************************************************************************/
283struct mv643xx_eth_shared_platform_data mv78xx0_ge00_shared_data = {
284 .t_clk = 0,
285 .dram = &mv78xx0_mbus_dram_info,
286};
287
288static struct resource mv78xx0_ge00_shared_resources[] = {
289 {
290 .name = "ge00 base",
291 .start = GE00_PHYS_BASE + 0x2000,
292 .end = GE00_PHYS_BASE + SZ_16K - 1,
293 .flags = IORESOURCE_MEM,
294 }, {
295 .name = "ge err irq",
296 .start = IRQ_MV78XX0_GE_ERR,
297 .end = IRQ_MV78XX0_GE_ERR,
298 .flags = IORESOURCE_IRQ,
299 },
300};
301
302static struct platform_device mv78xx0_ge00_shared = {
303 .name = MV643XX_ETH_SHARED_NAME,
304 .id = 0,
305 .dev = {
306 .platform_data = &mv78xx0_ge00_shared_data,
307 },
308 .num_resources = ARRAY_SIZE(mv78xx0_ge00_shared_resources),
309 .resource = mv78xx0_ge00_shared_resources,
310};
311
312static struct resource mv78xx0_ge00_resources[] = {
313 {
314 .name = "ge00 irq",
315 .start = IRQ_MV78XX0_GE00_SUM,
316 .end = IRQ_MV78XX0_GE00_SUM,
317 .flags = IORESOURCE_IRQ,
318 },
319};
320
321static struct platform_device mv78xx0_ge00 = {
322 .name = MV643XX_ETH_NAME,
323 .id = 0,
324 .num_resources = 1,
325 .resource = mv78xx0_ge00_resources,
326 .dev = {
327 .coherent_dma_mask = DMA_BIT_MASK(32),
328 },
329};
330
331void __init mv78xx0_ge00_init(struct mv643xx_eth_platform_data *eth_data) 282void __init mv78xx0_ge00_init(struct mv643xx_eth_platform_data *eth_data)
332{ 283{
333 eth_data->shared = &mv78xx0_ge00_shared; 284 orion_ge00_init(eth_data, &mv78xx0_mbus_dram_info,
334 mv78xx0_ge00.dev.platform_data = eth_data; 285 GE00_PHYS_BASE, IRQ_MV78XX0_GE00_SUM,
335 286 IRQ_MV78XX0_GE_ERR, get_tclk());
336 platform_device_register(&mv78xx0_ge00_shared);
337 platform_device_register(&mv78xx0_ge00);
338} 287}
339 288
340 289
341/***************************************************************************** 290/*****************************************************************************
342 * GE01 291 * GE01
343 ****************************************************************************/ 292 ****************************************************************************/
344struct mv643xx_eth_shared_platform_data mv78xx0_ge01_shared_data = {
345 .t_clk = 0,
346 .dram = &mv78xx0_mbus_dram_info,
347 .shared_smi = &mv78xx0_ge00_shared,
348};
349
350static struct resource mv78xx0_ge01_shared_resources[] = {
351 {
352 .name = "ge01 base",
353 .start = GE01_PHYS_BASE + 0x2000,
354 .end = GE01_PHYS_BASE + SZ_16K - 1,
355 .flags = IORESOURCE_MEM,
356 },
357};
358
359static struct platform_device mv78xx0_ge01_shared = {
360 .name = MV643XX_ETH_SHARED_NAME,
361 .id = 1,
362 .dev = {
363 .platform_data = &mv78xx0_ge01_shared_data,
364 },
365 .num_resources = 1,
366 .resource = mv78xx0_ge01_shared_resources,
367};
368
369static struct resource mv78xx0_ge01_resources[] = {
370 {
371 .name = "ge01 irq",
372 .start = IRQ_MV78XX0_GE01_SUM,
373 .end = IRQ_MV78XX0_GE01_SUM,
374 .flags = IORESOURCE_IRQ,
375 },
376};
377
378static struct platform_device mv78xx0_ge01 = {
379 .name = MV643XX_ETH_NAME,
380 .id = 1,
381 .num_resources = 1,
382 .resource = mv78xx0_ge01_resources,
383 .dev = {
384 .coherent_dma_mask = DMA_BIT_MASK(32),
385 },
386};
387
388void __init mv78xx0_ge01_init(struct mv643xx_eth_platform_data *eth_data) 293void __init mv78xx0_ge01_init(struct mv643xx_eth_platform_data *eth_data)
389{ 294{
390 eth_data->shared = &mv78xx0_ge01_shared; 295 orion_ge01_init(eth_data, &mv78xx0_mbus_dram_info,
391 mv78xx0_ge01.dev.platform_data = eth_data; 296 GE01_PHYS_BASE, IRQ_MV78XX0_GE01_SUM,
392 297 NO_IRQ, get_tclk());
393 platform_device_register(&mv78xx0_ge01_shared);
394 platform_device_register(&mv78xx0_ge01);
395} 298}
396 299
397 300
398/***************************************************************************** 301/*****************************************************************************
399 * GE10 302 * GE10
400 ****************************************************************************/ 303 ****************************************************************************/
401struct mv643xx_eth_shared_platform_data mv78xx0_ge10_shared_data = {
402 .t_clk = 0,
403 .dram = &mv78xx0_mbus_dram_info,
404 .shared_smi = &mv78xx0_ge00_shared,
405};
406
407static struct resource mv78xx0_ge10_shared_resources[] = {
408 {
409 .name = "ge10 base",
410 .start = GE10_PHYS_BASE + 0x2000,
411 .end = GE10_PHYS_BASE + SZ_16K - 1,
412 .flags = IORESOURCE_MEM,
413 },
414};
415
416static struct platform_device mv78xx0_ge10_shared = {
417 .name = MV643XX_ETH_SHARED_NAME,
418 .id = 2,
419 .dev = {
420 .platform_data = &mv78xx0_ge10_shared_data,
421 },
422 .num_resources = 1,
423 .resource = mv78xx0_ge10_shared_resources,
424};
425
426static struct resource mv78xx0_ge10_resources[] = {
427 {
428 .name = "ge10 irq",
429 .start = IRQ_MV78XX0_GE10_SUM,
430 .end = IRQ_MV78XX0_GE10_SUM,
431 .flags = IORESOURCE_IRQ,
432 },
433};
434
435static struct platform_device mv78xx0_ge10 = {
436 .name = MV643XX_ETH_NAME,
437 .id = 2,
438 .num_resources = 1,
439 .resource = mv78xx0_ge10_resources,
440 .dev = {
441 .coherent_dma_mask = DMA_BIT_MASK(32),
442 },
443};
444
445void __init mv78xx0_ge10_init(struct mv643xx_eth_platform_data *eth_data) 304void __init mv78xx0_ge10_init(struct mv643xx_eth_platform_data *eth_data)
446{ 305{
447 u32 dev, rev; 306 u32 dev, rev;
448 307
449 eth_data->shared = &mv78xx0_ge10_shared;
450 mv78xx0_ge10.dev.platform_data = eth_data;
451
452 /* 308 /*
453 * On the Z0, ge10 and ge11 are internally connected back 309 * On the Z0, ge10 and ge11 are internally connected back
454 * to back, and not brought out. 310 * to back, and not brought out.
@@ -460,65 +316,19 @@ void __init mv78xx0_ge10_init(struct mv643xx_eth_platform_data *eth_data)
460 eth_data->duplex = DUPLEX_FULL; 316 eth_data->duplex = DUPLEX_FULL;
461 } 317 }
462 318
463 platform_device_register(&mv78xx0_ge10_shared); 319 orion_ge10_init(eth_data, &mv78xx0_mbus_dram_info,
464 platform_device_register(&mv78xx0_ge10); 320 GE10_PHYS_BASE, IRQ_MV78XX0_GE10_SUM,
321 NO_IRQ, get_tclk());
465} 322}
466 323
467 324
468/***************************************************************************** 325/*****************************************************************************
469 * GE11 326 * GE11
470 ****************************************************************************/ 327 ****************************************************************************/
471struct mv643xx_eth_shared_platform_data mv78xx0_ge11_shared_data = {
472 .t_clk = 0,
473 .dram = &mv78xx0_mbus_dram_info,
474 .shared_smi = &mv78xx0_ge00_shared,
475};
476
477static struct resource mv78xx0_ge11_shared_resources[] = {
478 {
479 .name = "ge11 base",
480 .start = GE11_PHYS_BASE + 0x2000,
481 .end = GE11_PHYS_BASE + SZ_16K - 1,
482 .flags = IORESOURCE_MEM,
483 },
484};
485
486static struct platform_device mv78xx0_ge11_shared = {
487 .name = MV643XX_ETH_SHARED_NAME,
488 .id = 3,
489 .dev = {
490 .platform_data = &mv78xx0_ge11_shared_data,
491 },
492 .num_resources = 1,
493 .resource = mv78xx0_ge11_shared_resources,
494};
495
496static struct resource mv78xx0_ge11_resources[] = {
497 {
498 .name = "ge11 irq",
499 .start = IRQ_MV78XX0_GE11_SUM,
500 .end = IRQ_MV78XX0_GE11_SUM,
501 .flags = IORESOURCE_IRQ,
502 },
503};
504
505static struct platform_device mv78xx0_ge11 = {
506 .name = MV643XX_ETH_NAME,
507 .id = 3,
508 .num_resources = 1,
509 .resource = mv78xx0_ge11_resources,
510 .dev = {
511 .coherent_dma_mask = DMA_BIT_MASK(32),
512 },
513};
514
515void __init mv78xx0_ge11_init(struct mv643xx_eth_platform_data *eth_data) 328void __init mv78xx0_ge11_init(struct mv643xx_eth_platform_data *eth_data)
516{ 329{
517 u32 dev, rev; 330 u32 dev, rev;
518 331
519 eth_data->shared = &mv78xx0_ge11_shared;
520 mv78xx0_ge11.dev.platform_data = eth_data;
521
522 /* 332 /*
523 * On the Z0, ge10 and ge11 are internally connected back 333 * On the Z0, ge10 and ge11 are internally connected back
524 * to back, and not brought out. 334 * to back, and not brought out.
@@ -530,8 +340,9 @@ void __init mv78xx0_ge11_init(struct mv643xx_eth_platform_data *eth_data)
530 eth_data->duplex = DUPLEX_FULL; 340 eth_data->duplex = DUPLEX_FULL;
531 } 341 }
532 342
533 platform_device_register(&mv78xx0_ge11_shared); 343 orion_ge11_init(eth_data, &mv78xx0_mbus_dram_info,
534 platform_device_register(&mv78xx0_ge11); 344 GE11_PHYS_BASE, IRQ_MV78XX0_GE11_SUM,
345 NO_IRQ, get_tclk());
535} 346}
536 347
537/***************************************************************************** 348/*****************************************************************************
@@ -759,9 +570,4 @@ void __init mv78xx0_init(void)
759#ifdef CONFIG_CACHE_FEROCEON_L2 570#ifdef CONFIG_CACHE_FEROCEON_L2
760 feroceon_l2_init(is_l2_writethrough()); 571 feroceon_l2_init(is_l2_writethrough());
761#endif 572#endif
762
763 mv78xx0_ge00_shared_data.t_clk = tclk;
764 mv78xx0_ge01_shared_data.t_clk = tclk;
765 mv78xx0_ge10_shared_data.t_clk = tclk;
766 mv78xx0_ge11_shared_data.t_clk = tclk;
767} 573}