devices.c 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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/gpio.h>
  22. #include <linux/platform_device.h>
  23. #include <mach/irqs.h>
  24. #include "regs-wan.h"
  25. #include "regs-lan.h"
  26. #include "regs-hpna.h"
  27. #include <mach/regs-switch.h>
  28. #include <mach/regs-misc.h>
  29. /* --------------------------------------------------------------------
  30. * Ethernet
  31. * -------------------------------------------------------------------- */
  32. static u64 eth_dmamask = 0xffffffffUL;
  33. static struct resource ks8695_wan_resources[] = {
  34. [0] = {
  35. .start = KS8695_WAN_PA,
  36. .end = KS8695_WAN_PA + 0x00ff,
  37. .flags = IORESOURCE_MEM,
  38. },
  39. [1] = {
  40. .name = "WAN RX",
  41. .start = KS8695_IRQ_WAN_RX_STATUS,
  42. .end = KS8695_IRQ_WAN_RX_STATUS,
  43. .flags = IORESOURCE_IRQ,
  44. },
  45. [2] = {
  46. .name = "WAN TX",
  47. .start = KS8695_IRQ_WAN_TX_STATUS,
  48. .end = KS8695_IRQ_WAN_TX_STATUS,
  49. .flags = IORESOURCE_IRQ,
  50. },
  51. [3] = {
  52. .name = "WAN Link",
  53. .start = KS8695_IRQ_WAN_LINK,
  54. .end = KS8695_IRQ_WAN_LINK,
  55. .flags = IORESOURCE_IRQ,
  56. },
  57. [4] = {
  58. .name = "WAN PHY",
  59. .start = KS8695_MISC_PA,
  60. .end = KS8695_MISC_PA + 0x1f,
  61. .flags = IORESOURCE_MEM,
  62. },
  63. };
  64. static struct platform_device ks8695_wan_device = {
  65. .name = "ks8695_ether",
  66. .id = 0,
  67. .dev = {
  68. .dma_mask = &eth_dmamask,
  69. .coherent_dma_mask = 0xffffffff,
  70. },
  71. .resource = ks8695_wan_resources,
  72. .num_resources = ARRAY_SIZE(ks8695_wan_resources),
  73. };
  74. static struct resource ks8695_lan_resources[] = {
  75. [0] = {
  76. .start = KS8695_LAN_PA,
  77. .end = KS8695_LAN_PA + 0x00ff,
  78. .flags = IORESOURCE_MEM,
  79. },
  80. [1] = {
  81. .name = "LAN RX",
  82. .start = KS8695_IRQ_LAN_RX_STATUS,
  83. .end = KS8695_IRQ_LAN_RX_STATUS,
  84. .flags = IORESOURCE_IRQ,
  85. },
  86. [2] = {
  87. .name = "LAN TX",
  88. .start = KS8695_IRQ_LAN_TX_STATUS,
  89. .end = KS8695_IRQ_LAN_TX_STATUS,
  90. .flags = IORESOURCE_IRQ,
  91. },
  92. [3] = {
  93. .name = "LAN SWITCH",
  94. .start = KS8695_SWITCH_PA,
  95. .end = KS8695_SWITCH_PA + 0x4f,
  96. .flags = IORESOURCE_MEM,
  97. },
  98. };
  99. static struct platform_device ks8695_lan_device = {
  100. .name = "ks8695_ether",
  101. .id = 1,
  102. .dev = {
  103. .dma_mask = &eth_dmamask,
  104. .coherent_dma_mask = 0xffffffff,
  105. },
  106. .resource = ks8695_lan_resources,
  107. .num_resources = ARRAY_SIZE(ks8695_lan_resources),
  108. };
  109. static struct resource ks8695_hpna_resources[] = {
  110. [0] = {
  111. .start = KS8695_HPNA_PA,
  112. .end = KS8695_HPNA_PA + 0x00ff,
  113. .flags = IORESOURCE_MEM,
  114. },
  115. [1] = {
  116. .name = "HPNA RX",
  117. .start = KS8695_IRQ_HPNA_RX_STATUS,
  118. .end = KS8695_IRQ_HPNA_RX_STATUS,
  119. .flags = IORESOURCE_IRQ,
  120. },
  121. [2] = {
  122. .name = "HPNA TX",
  123. .start = KS8695_IRQ_HPNA_TX_STATUS,
  124. .end = KS8695_IRQ_HPNA_TX_STATUS,
  125. .flags = IORESOURCE_IRQ,
  126. },
  127. };
  128. static struct platform_device ks8695_hpna_device = {
  129. .name = "ks8695_ether",
  130. .id = 2,
  131. .dev = {
  132. .dma_mask = &eth_dmamask,
  133. .coherent_dma_mask = 0xffffffff,
  134. },
  135. .resource = ks8695_hpna_resources,
  136. .num_resources = ARRAY_SIZE(ks8695_hpna_resources),
  137. };
  138. void __init ks8695_add_device_wan(void)
  139. {
  140. platform_device_register(&ks8695_wan_device);
  141. }
  142. void __init ks8695_add_device_lan(void)
  143. {
  144. platform_device_register(&ks8695_lan_device);
  145. }
  146. void __init ks8696_add_device_hpna(void)
  147. {
  148. platform_device_register(&ks8695_hpna_device);
  149. }
  150. /* --------------------------------------------------------------------
  151. * Watchdog
  152. * -------------------------------------------------------------------- */
  153. static struct platform_device ks8695_wdt_device = {
  154. .name = "ks8695_wdt",
  155. .id = -1,
  156. .num_resources = 0,
  157. };
  158. static void __init ks8695_add_device_watchdog(void)
  159. {
  160. platform_device_register(&ks8695_wdt_device);
  161. }
  162. /* -------------------------------------------------------------------- */
  163. /*
  164. * These devices are always present and don't need any board-specific
  165. * setup.
  166. */
  167. static int __init ks8695_add_standard_devices(void)
  168. {
  169. ks8695_add_device_watchdog();
  170. return 0;
  171. }
  172. arch_initcall(ks8695_add_standard_devices);