ibm440ep.c 5.8 KB

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