ibm440ep.c 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. /*
  2. * arch/ppc/platforms/4xx/ibm440ep.c
  3. *
  4. * PPC440EP I/O descriptions
  5. *
  6. * Wade Farnsworth <wfarnsworth@mvista.com>
  7. * Copyright 2004 MontaVista Software Inc.
  8. *
  9. * This program is free software; you can redistribute it and/or modify it
  10. * under the terms of the GNU General Public License as published by the
  11. * Free Software Foundation; either version 2 of the License, or (at your
  12. * option) any later version.
  13. *
  14. */
  15. #include <linux/init.h>
  16. #include <linux/module.h>
  17. #include <linux/platform_device.h>
  18. #include <platforms/4xx/ibm440ep.h>
  19. #include <asm/ocp.h>
  20. #include <asm/ppc4xx_pic.h>
  21. static struct ocp_func_emac_data ibm440ep_emac0_def = {
  22. .rgmii_idx = -1, /* No RGMII */
  23. .rgmii_mux = -1, /* No RGMII */
  24. .zmii_idx = 0, /* ZMII device index */
  25. .zmii_mux = 0, /* ZMII input of this EMAC */
  26. .mal_idx = 0, /* MAL device index */
  27. .mal_rx_chan = 0, /* MAL rx channel number */
  28. .mal_tx_chan = 0, /* MAL tx channel number */
  29. .wol_irq = 61, /* WOL interrupt number */
  30. .mdio_idx = -1, /* No shared MDIO */
  31. .tah_idx = -1, /* No TAH */
  32. };
  33. static struct ocp_func_emac_data ibm440ep_emac1_def = {
  34. .rgmii_idx = -1, /* No RGMII */
  35. .rgmii_mux = -1, /* No RGMII */
  36. .zmii_idx = 0, /* ZMII device index */
  37. .zmii_mux = 1, /* ZMII input of this EMAC */
  38. .mal_idx = 0, /* MAL device index */
  39. .mal_rx_chan = 1, /* MAL rx channel number */
  40. .mal_tx_chan = 2, /* MAL tx channel number */
  41. .wol_irq = 63, /* WOL interrupt number */
  42. .mdio_idx = -1, /* No shared MDIO */
  43. .tah_idx = -1, /* No TAH */
  44. };
  45. OCP_SYSFS_EMAC_DATA()
  46. static struct ocp_func_mal_data ibm440ep_mal0_def = {
  47. .num_tx_chans = 4, /* Number of TX channels */
  48. .num_rx_chans = 2, /* Number of RX channels */
  49. .txeob_irq = 10, /* TX End Of Buffer IRQ */
  50. .rxeob_irq = 11, /* RX End Of Buffer IRQ */
  51. .txde_irq = 33, /* TX Descriptor Error IRQ */
  52. .rxde_irq = 34, /* RX Descriptor Error IRQ */
  53. .serr_irq = 32, /* MAL System Error IRQ */
  54. .dcr_base = DCRN_MAL_BASE /* MAL0_CFG DCR number */
  55. };
  56. OCP_SYSFS_MAL_DATA()
  57. static struct ocp_func_iic_data ibm440ep_iic0_def = {
  58. .fast_mode = 0, /* Use standad mode (100Khz) */
  59. };
  60. static struct ocp_func_iic_data ibm440ep_iic1_def = {
  61. .fast_mode = 0, /* Use standad mode (100Khz) */
  62. };
  63. OCP_SYSFS_IIC_DATA()
  64. struct ocp_def core_ocp[] = {
  65. { .vendor = OCP_VENDOR_IBM,
  66. .function = OCP_FUNC_OPB,
  67. .index = 0,
  68. .paddr = 0x0EF600000ULL,
  69. .irq = OCP_IRQ_NA,
  70. .pm = OCP_CPM_NA,
  71. },
  72. { .vendor = OCP_VENDOR_IBM,
  73. .function = OCP_FUNC_16550,
  74. .index = 0,
  75. .paddr = PPC440EP_UART0_ADDR,
  76. .irq = UART0_INT,
  77. .pm = IBM_CPM_UART0,
  78. },
  79. { .vendor = OCP_VENDOR_IBM,
  80. .function = OCP_FUNC_16550,
  81. .index = 1,
  82. .paddr = PPC440EP_UART1_ADDR,
  83. .irq = UART1_INT,
  84. .pm = IBM_CPM_UART1,
  85. },
  86. { .vendor = OCP_VENDOR_IBM,
  87. .function = OCP_FUNC_16550,
  88. .index = 2,
  89. .paddr = PPC440EP_UART2_ADDR,
  90. .irq = UART2_INT,
  91. .pm = IBM_CPM_UART2,
  92. },
  93. { .vendor = OCP_VENDOR_IBM,
  94. .function = OCP_FUNC_16550,
  95. .index = 3,
  96. .paddr = PPC440EP_UART3_ADDR,
  97. .irq = UART3_INT,
  98. .pm = IBM_CPM_UART3,
  99. },
  100. { .vendor = OCP_VENDOR_IBM,
  101. .function = OCP_FUNC_IIC,
  102. .index = 0,
  103. .paddr = 0x0EF600700ULL,
  104. .irq = 2,
  105. .pm = IBM_CPM_IIC0,
  106. .additions = &ibm440ep_iic0_def,
  107. .show = &ocp_show_iic_data
  108. },
  109. { .vendor = OCP_VENDOR_IBM,
  110. .function = OCP_FUNC_IIC,
  111. .index = 1,
  112. .paddr = 0x0EF600800ULL,
  113. .irq = 7,
  114. .pm = IBM_CPM_IIC1,
  115. .additions = &ibm440ep_iic1_def,
  116. .show = &ocp_show_iic_data
  117. },
  118. { .vendor = OCP_VENDOR_IBM,
  119. .function = OCP_FUNC_GPIO,
  120. .index = 0,
  121. .paddr = 0x0EF600B00ULL,
  122. .irq = OCP_IRQ_NA,
  123. .pm = IBM_CPM_GPIO0,
  124. },
  125. { .vendor = OCP_VENDOR_IBM,
  126. .function = OCP_FUNC_GPIO,
  127. .index = 1,
  128. .paddr = 0x0EF600C00ULL,
  129. .irq = OCP_IRQ_NA,
  130. .pm = OCP_CPM_NA,
  131. },
  132. { .vendor = OCP_VENDOR_IBM,
  133. .function = OCP_FUNC_MAL,
  134. .paddr = OCP_PADDR_NA,
  135. .irq = OCP_IRQ_NA,
  136. .pm = OCP_CPM_NA,
  137. .additions = &ibm440ep_mal0_def,
  138. .show = &ocp_show_mal_data,
  139. },
  140. { .vendor = OCP_VENDOR_IBM,
  141. .function = OCP_FUNC_EMAC,
  142. .index = 0,
  143. .paddr = 0x0EF600E00ULL,
  144. .irq = 60,
  145. .pm = OCP_CPM_NA,
  146. .additions = &ibm440ep_emac0_def,
  147. .show = &ocp_show_emac_data,
  148. },
  149. { .vendor = OCP_VENDOR_IBM,
  150. .function = OCP_FUNC_EMAC,
  151. .index = 1,
  152. .paddr = 0x0EF600F00ULL,
  153. .irq = 62,
  154. .pm = OCP_CPM_NA,
  155. .additions = &ibm440ep_emac1_def,
  156. .show = &ocp_show_emac_data,
  157. },
  158. { .vendor = OCP_VENDOR_IBM,
  159. .function = OCP_FUNC_ZMII,
  160. .paddr = 0x0EF600D00ULL,
  161. .irq = OCP_IRQ_NA,
  162. .pm = OCP_CPM_NA,
  163. },
  164. { .vendor = OCP_VENDOR_INVALID
  165. }
  166. };
  167. /* Polarity and triggering settings for internal interrupt sources */
  168. struct ppc4xx_uic_settings ppc4xx_core_uic_cfg[] __initdata = {
  169. { .polarity = 0xffbffe03,
  170. .triggering = 0xfffffe00,
  171. .ext_irq_mask = 0x000001fc, /* IRQ0 - IRQ6 */
  172. },
  173. { .polarity = 0xffffc6ef,
  174. .triggering = 0xffffc7ff,
  175. .ext_irq_mask = 0x00003800, /* IRQ7 - IRQ9 */
  176. },
  177. };
  178. static struct resource usb_gadget_resources[] = {
  179. [0] = {
  180. .start = 0x050000100ULL,
  181. .end = 0x05000017FULL,
  182. .flags = IORESOURCE_MEM,
  183. },
  184. [1] = {
  185. .start = 55,
  186. .end = 55,
  187. .flags = IORESOURCE_IRQ,
  188. },
  189. };
  190. static u64 dma_mask = 0xffffffffULL;
  191. static struct platform_device usb_gadget_device = {
  192. .name = "musbhsfc",
  193. .id = 0,
  194. .num_resources = ARRAY_SIZE(usb_gadget_resources),
  195. .resource = usb_gadget_resources,
  196. .dev = {
  197. .dma_mask = &dma_mask,
  198. .coherent_dma_mask = 0xffffffffULL,
  199. }
  200. };
  201. static struct platform_device *ibm440ep_devs[] __initdata = {
  202. &usb_gadget_device,
  203. };
  204. static int __init
  205. ibm440ep_platform_add_devices(void)
  206. {
  207. return platform_add_devices(ibm440ep_devs, ARRAY_SIZE(ibm440ep_devs));
  208. }
  209. arch_initcall(ibm440ep_platform_add_devices);