chrp_pegasos_eth.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * arch/ppc/platforms/chrp_pegasos_eth.c
  3. *
  4. * Copyright (C) 2005 Sven Luther <sl@bplan-gmbh.de>
  5. * Thanks to :
  6. * Dale Farnsworth <dale@farnsworth.org>
  7. * Mark A. Greer <mgreer@mvista.com>
  8. * Nicolas DET <nd@bplan-gmbh.de>
  9. * Benjamin Herrenschmidt <benh@kernel.crashing.org>
  10. * And anyone else who helped me on this.
  11. */
  12. #include <linux/types.h>
  13. #include <linux/init.h>
  14. #include <linux/ioport.h>
  15. #include <linux/device.h>
  16. #include <linux/mv643xx.h>
  17. #include <linux/pci.h>
  18. /* Pegasos 2 specific Marvell MV 64361 gigabit ethernet port setup */
  19. static struct resource mv643xx_eth_shared_resources[] = {
  20. [0] = {
  21. .name = "ethernet shared base",
  22. .start = 0xf1000000 + MV643XX_ETH_SHARED_REGS,
  23. .end = 0xf1000000 + MV643XX_ETH_SHARED_REGS +
  24. MV643XX_ETH_SHARED_REGS_SIZE - 1,
  25. .flags = IORESOURCE_MEM,
  26. },
  27. };
  28. static struct platform_device mv643xx_eth_shared_device = {
  29. .name = MV643XX_ETH_SHARED_NAME,
  30. .id = 0,
  31. .num_resources = ARRAY_SIZE(mv643xx_eth_shared_resources),
  32. .resource = mv643xx_eth_shared_resources,
  33. };
  34. static struct resource mv643xx_eth0_resources[] = {
  35. [0] = {
  36. .name = "eth0 irq",
  37. .start = 9,
  38. .end = 9,
  39. .flags = IORESOURCE_IRQ,
  40. },
  41. };
  42. static struct mv643xx_eth_platform_data eth0_pd;
  43. static struct platform_device eth0_device = {
  44. .name = MV643XX_ETH_NAME,
  45. .id = 0,
  46. .num_resources = ARRAY_SIZE(mv643xx_eth0_resources),
  47. .resource = mv643xx_eth0_resources,
  48. .dev = {
  49. .platform_data = &eth0_pd,
  50. },
  51. };
  52. static struct resource mv643xx_eth1_resources[] = {
  53. [0] = {
  54. .name = "eth1 irq",
  55. .start = 9,
  56. .end = 9,
  57. .flags = IORESOURCE_IRQ,
  58. },
  59. };
  60. static struct mv643xx_eth_platform_data eth1_pd;
  61. static struct platform_device eth1_device = {
  62. .name = MV643XX_ETH_NAME,
  63. .id = 1,
  64. .num_resources = ARRAY_SIZE(mv643xx_eth1_resources),
  65. .resource = mv643xx_eth1_resources,
  66. .dev = {
  67. .platform_data = &eth1_pd,
  68. },
  69. };
  70. static struct platform_device *mv643xx_eth_pd_devs[] __initdata = {
  71. &mv643xx_eth_shared_device,
  72. &eth0_device,
  73. &eth1_device,
  74. };
  75. int
  76. mv643xx_eth_add_pds(void)
  77. {
  78. int ret = 0;
  79. static struct pci_device_id pci_marvell_mv64360[] = {
  80. { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, PCI_DEVICE_ID_MARVELL_MV64360) },
  81. { }
  82. };
  83. if (pci_dev_present(pci_marvell_mv64360)) {
  84. ret = platform_add_devices(mv643xx_eth_pd_devs, ARRAY_SIZE(mv643xx_eth_pd_devs));
  85. }
  86. return ret;
  87. }
  88. device_initcall(mv643xx_eth_add_pds);