devices.c 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. /*
  2. * arch/arm/mach-ks8695/devices.c
  3. *
  4. * Copyright (C) 2006 Andrew Victor
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. */
  19. #include <asm/mach/arch.h>
  20. #include <asm/mach/map.h>
  21. #include <linux/platform_device.h>
  22. #include <asm/arch/regs-wan.h>
  23. #include <asm/arch/regs-lan.h>
  24. #include <asm/arch/regs-hpna.h>
  25. /* --------------------------------------------------------------------
  26. * Ethernet
  27. * -------------------------------------------------------------------- */
  28. #if defined(CONFIG_ARM_KS8695_ETHER) || defined(CONFIG_ARM_KS8695_ETHER_MODULE)
  29. static u64 eth_dmamask = 0xffffffffUL;
  30. static struct resource ks8695_wan_resources[] = {
  31. [0] = {
  32. .start = KS8695_WAN_VA,
  33. .end = KS8695_WAN_VA + 0x00ff,
  34. .flags = IORESOURCE_MEM,
  35. },
  36. [1] = {
  37. .name = "WAN RX",
  38. .start = KS8695_IRQ_WAN_RX_STATUS,
  39. .end = KS8695_IRQ_WAN_RX_STATUS,
  40. .flags = IORESOURCE_IRQ,
  41. },
  42. [2] = {
  43. .name = "WAN TX",
  44. .start = KS8695_IRQ_WAN_TX_STATUS,
  45. .end = KS8695_IRQ_WAN_TX_STATUS,
  46. .flags = IORESOURCE_IRQ,
  47. },
  48. [3] = {
  49. .name = "WAN Link",
  50. .start = KS8695_IRQ_WAN_LINK,
  51. .end = KS8695_IRQ_WAN_LINK,
  52. .flags = IORESOURCE_IRQ,
  53. },
  54. };
  55. static struct platform_device ks8695_wan_device = {
  56. .name = "ks8695_ether",
  57. .id = 0,
  58. .dev = {
  59. .dma_mask = &eth_dmamask,
  60. .coherent_dma_mask = 0xffffffff,
  61. },
  62. .resource = ks8695_wan_resources,
  63. .num_resources = ARRAY_SIZE(ks8695_wan_resources),
  64. };
  65. static struct resource ks8695_lan_resources[] = {
  66. [0] = {
  67. .start = KS8695_LAN_VA,
  68. .end = KS8695_LAN_VA + 0x00ff,
  69. .flags = IORESOURCE_MEM,
  70. },
  71. [1] = {
  72. .name = "LAN RX",
  73. .start = KS8695_IRQ_LAN_RX_STATUS,
  74. .end = KS8695_IRQ_LAN_RX_STATUS,
  75. .flags = IORESOURCE_IRQ,
  76. },
  77. [2] = {
  78. .name = "LAN TX",
  79. .start = KS8695_IRQ_LAN_TX_STATUS,
  80. .end = KS8695_IRQ_LAN_TX_STATUS,
  81. .flags = IORESOURCE_IRQ,
  82. },
  83. };
  84. static struct platform_device ks8695_lan_device = {
  85. .name = "ks8695_ether",
  86. .id = 1,
  87. .dev = {
  88. .dma_mask = &eth_dmamask,
  89. .coherent_dma_mask = 0xffffffff,
  90. },
  91. .resource = ks8695_lan_resources,
  92. .num_resources = ARRAY_SIZE(ks8695_lan_resources),
  93. };
  94. static struct resource ks8695_hpna_resources[] = {
  95. [0] = {
  96. .start = KS8695_HPNA_VA,
  97. .end = KS8695_HPNA_VA + 0x00ff,
  98. .flags = IORESOURCE_MEM,
  99. },
  100. [1] = {
  101. .name = "HPNA RX",
  102. .start = KS8695_IRQ_HPNA_RX_STATUS,
  103. .end = KS8695_IRQ_HPNA_RX_STATUS,
  104. .flags = IORESOURCE_IRQ,
  105. },
  106. [2] = {
  107. .name = "HPNA TX",
  108. .start = KS8695_IRQ_HPNA_TX_STATUS,
  109. .end = KS8695_IRQ_HPNA_TX_STATUS,
  110. .flags = IORESOURCE_IRQ,
  111. },
  112. };
  113. static struct platform_device ks8695_hpna_device = {
  114. .name = "ks8695_ether",
  115. .id = 2,
  116. .dev = {
  117. .dma_mask = &eth_dmamask,
  118. .coherent_dma_mask = 0xffffffff,
  119. },
  120. .resource = ks8695_hpna_resources,
  121. .num_resources = ARRAY_SIZE(ks8695_hpna_resources),
  122. };
  123. void __init ks8695_add_device_wan(void)
  124. {
  125. platform_device_register(&ks8695_wan_device);
  126. }
  127. void __init ks8695_add_device_lan(void)
  128. {
  129. platform_device_register(&ks8695_lan_device);
  130. }
  131. void __init ks8696_add_device_hpna(void)
  132. {
  133. platform_device_register(&ks8695_hpna_device);
  134. }
  135. #else
  136. void __init ks8695_add_device_wan(void) {}
  137. void __init ks8695_add_device_lan(void) {}
  138. void __init ks8696_add_device_hpna(void) {}
  139. #endif
  140. /* --------------------------------------------------------------------
  141. * Watchdog
  142. * -------------------------------------------------------------------- */
  143. #if defined(CONFIG_KS8695_WATCHDOG) || defined(CONFIG_KS8695_WATCHDOG_MODULE)
  144. static struct platform_device ks8695_wdt_device = {
  145. .name = "ks8695_wdt",
  146. .id = -1,
  147. .num_resources = 0,
  148. };
  149. static void __init ks8695_add_device_watchdog(void)
  150. {
  151. platform_device_register(&ks8695_wdt_device);
  152. }
  153. #else
  154. static void __init ks8695_add_device_watchdog(void) {}
  155. #endif
  156. /* -------------------------------------------------------------------- */
  157. /*
  158. * These devices are always present and don't need any board-specific
  159. * setup.
  160. */
  161. static int __init ks8695_add_standard_devices(void)
  162. {
  163. ks8695_add_device_watchdog();
  164. return 0;
  165. }
  166. arch_initcall(ks8695_add_standard_devices);