platform.c 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. /*
  2. * Platform device support for Au1x00 SoCs.
  3. *
  4. * Copyright 2004, Matt Porter <mporter@kernel.crashing.org>
  5. *
  6. * This file is licensed under the terms of the GNU General Public
  7. * License version 2. This program is licensed "as is" without any
  8. * warranty of any kind, whether express or implied.
  9. */
  10. #include <linux/device.h>
  11. #include <linux/platform_device.h>
  12. #include <linux/kernel.h>
  13. #include <linux/init.h>
  14. #include <linux/resource.h>
  15. #include <asm/mach-au1x00/au1xxx.h>
  16. /* OHCI (USB full speed host controller) */
  17. static struct resource au1xxx_usb_ohci_resources[] = {
  18. [0] = {
  19. .start = USB_OHCI_BASE,
  20. .end = USB_OHCI_BASE + USB_OHCI_LEN - 1,
  21. .flags = IORESOURCE_MEM,
  22. },
  23. [1] = {
  24. .start = AU1000_USB_HOST_INT,
  25. .end = AU1000_USB_HOST_INT,
  26. .flags = IORESOURCE_IRQ,
  27. },
  28. };
  29. /* The dmamask must be set for OHCI to work */
  30. static u64 ohci_dmamask = ~(u32)0;
  31. static struct platform_device au1xxx_usb_ohci_device = {
  32. .name = "au1xxx-ohci",
  33. .id = 0,
  34. .dev = {
  35. .dma_mask = &ohci_dmamask,
  36. .coherent_dma_mask = 0xffffffff,
  37. },
  38. .num_resources = ARRAY_SIZE(au1xxx_usb_ohci_resources),
  39. .resource = au1xxx_usb_ohci_resources,
  40. };
  41. /*** AU1100 LCD controller ***/
  42. #ifdef CONFIG_FB_AU1100
  43. static struct resource au1100_lcd_resources[] = {
  44. [0] = {
  45. .start = LCD_PHYS_ADDR,
  46. .end = LCD_PHYS_ADDR + 0x800 - 1,
  47. .flags = IORESOURCE_MEM,
  48. },
  49. [1] = {
  50. .start = AU1100_LCD_INT,
  51. .end = AU1100_LCD_INT,
  52. .flags = IORESOURCE_IRQ,
  53. }
  54. };
  55. static u64 au1100_lcd_dmamask = ~(u32)0;
  56. static struct platform_device au1100_lcd_device = {
  57. .name = "au1100-lcd",
  58. .id = 0,
  59. .dev = {
  60. .dma_mask = &au1100_lcd_dmamask,
  61. .coherent_dma_mask = 0xffffffff,
  62. },
  63. .num_resources = ARRAY_SIZE(au1100_lcd_resources),
  64. .resource = au1100_lcd_resources,
  65. };
  66. #endif
  67. #ifdef CONFIG_SOC_AU1200
  68. /* EHCI (USB high speed host controller) */
  69. static struct resource au1xxx_usb_ehci_resources[] = {
  70. [0] = {
  71. .start = USB_EHCI_BASE,
  72. .end = USB_EHCI_BASE + USB_EHCI_LEN - 1,
  73. .flags = IORESOURCE_MEM,
  74. },
  75. [1] = {
  76. .start = AU1000_USB_HOST_INT,
  77. .end = AU1000_USB_HOST_INT,
  78. .flags = IORESOURCE_IRQ,
  79. },
  80. };
  81. static u64 ehci_dmamask = ~(u32)0;
  82. static struct platform_device au1xxx_usb_ehci_device = {
  83. .name = "au1xxx-ehci",
  84. .id = 0,
  85. .dev = {
  86. .dma_mask = &ehci_dmamask,
  87. .coherent_dma_mask = 0xffffffff,
  88. },
  89. .num_resources = ARRAY_SIZE(au1xxx_usb_ehci_resources),
  90. .resource = au1xxx_usb_ehci_resources,
  91. };
  92. /* Au1200 UDC (USB gadget controller) */
  93. static struct resource au1xxx_usb_gdt_resources[] = {
  94. [0] = {
  95. .start = USB_UDC_BASE,
  96. .end = USB_UDC_BASE + USB_UDC_LEN - 1,
  97. .flags = IORESOURCE_MEM,
  98. },
  99. [1] = {
  100. .start = AU1200_USB_INT,
  101. .end = AU1200_USB_INT,
  102. .flags = IORESOURCE_IRQ,
  103. },
  104. };
  105. static struct resource au1xxx_mmc_resources[] = {
  106. [0] = {
  107. .start = SD0_PHYS_ADDR,
  108. .end = SD0_PHYS_ADDR + 0x40,
  109. .flags = IORESOURCE_MEM,
  110. },
  111. [1] = {
  112. .start = SD1_PHYS_ADDR,
  113. .end = SD1_PHYS_ADDR + 0x40,
  114. .flags = IORESOURCE_MEM,
  115. },
  116. [2] = {
  117. .start = AU1200_SD_INT,
  118. .end = AU1200_SD_INT,
  119. .flags = IORESOURCE_IRQ,
  120. }
  121. };
  122. static u64 udc_dmamask = ~(u32)0;
  123. static struct platform_device au1xxx_usb_gdt_device = {
  124. .name = "au1xxx-udc",
  125. .id = 0,
  126. .dev = {
  127. .dma_mask = &udc_dmamask,
  128. .coherent_dma_mask = 0xffffffff,
  129. },
  130. .num_resources = ARRAY_SIZE(au1xxx_usb_gdt_resources),
  131. .resource = au1xxx_usb_gdt_resources,
  132. };
  133. /* Au1200 UOC (USB OTG controller) */
  134. static struct resource au1xxx_usb_otg_resources[] = {
  135. [0] = {
  136. .start = USB_UOC_BASE,
  137. .end = USB_UOC_BASE + USB_UOC_LEN - 1,
  138. .flags = IORESOURCE_MEM,
  139. },
  140. [1] = {
  141. .start = AU1200_USB_INT,
  142. .end = AU1200_USB_INT,
  143. .flags = IORESOURCE_IRQ,
  144. },
  145. };
  146. static u64 uoc_dmamask = ~(u32)0;
  147. static struct platform_device au1xxx_usb_otg_device = {
  148. .name = "au1xxx-uoc",
  149. .id = 0,
  150. .dev = {
  151. .dma_mask = &uoc_dmamask,
  152. .coherent_dma_mask = 0xffffffff,
  153. },
  154. .num_resources = ARRAY_SIZE(au1xxx_usb_otg_resources),
  155. .resource = au1xxx_usb_otg_resources,
  156. };
  157. static struct resource au1200_lcd_resources[] = {
  158. [0] = {
  159. .start = LCD_PHYS_ADDR,
  160. .end = LCD_PHYS_ADDR + 0x800 - 1,
  161. .flags = IORESOURCE_MEM,
  162. },
  163. [1] = {
  164. .start = AU1200_LCD_INT,
  165. .end = AU1200_LCD_INT,
  166. .flags = IORESOURCE_IRQ,
  167. }
  168. };
  169. static struct resource au1200_ide0_resources[] = {
  170. [0] = {
  171. .start = AU1XXX_ATA_PHYS_ADDR,
  172. .end = AU1XXX_ATA_PHYS_ADDR + AU1XXX_ATA_PHYS_LEN,
  173. .flags = IORESOURCE_MEM,
  174. },
  175. [1] = {
  176. .start = AU1XXX_ATA_INT,
  177. .end = AU1XXX_ATA_INT,
  178. .flags = IORESOURCE_IRQ,
  179. }
  180. };
  181. static u64 au1200_lcd_dmamask = ~(u32)0;
  182. static struct platform_device au1200_lcd_device = {
  183. .name = "au1200-lcd",
  184. .id = 0,
  185. .dev = {
  186. .dma_mask = &au1200_lcd_dmamask,
  187. .coherent_dma_mask = 0xffffffff,
  188. },
  189. .num_resources = ARRAY_SIZE(au1200_lcd_resources),
  190. .resource = au1200_lcd_resources,
  191. };
  192. static u64 ide0_dmamask = ~(u32)0;
  193. static struct platform_device au1200_ide0_device = {
  194. .name = "au1200-ide",
  195. .id = 0,
  196. .dev = {
  197. .dma_mask = &ide0_dmamask,
  198. .coherent_dma_mask = 0xffffffff,
  199. },
  200. .num_resources = ARRAY_SIZE(au1200_ide0_resources),
  201. .resource = au1200_ide0_resources,
  202. };
  203. static u64 au1xxx_mmc_dmamask = ~(u32)0;
  204. static struct platform_device au1xxx_mmc_device = {
  205. .name = "au1xxx-mmc",
  206. .id = 0,
  207. .dev = {
  208. .dma_mask = &au1xxx_mmc_dmamask,
  209. .coherent_dma_mask = 0xffffffff,
  210. },
  211. .num_resources = ARRAY_SIZE(au1xxx_mmc_resources),
  212. .resource = au1xxx_mmc_resources,
  213. };
  214. #endif /* #ifdef CONFIG_SOC_AU1200 */
  215. static struct platform_device au1x00_pcmcia_device = {
  216. .name = "au1x00-pcmcia",
  217. .id = 0,
  218. };
  219. #ifdef CONFIG_MIPS_DB1200
  220. static struct resource smc91x_resources[] = {
  221. [0] = {
  222. .name = "smc91x-regs",
  223. .start = AU1XXX_SMC91111_PHYS_ADDR,
  224. .end = AU1XXX_SMC91111_PHYS_ADDR + 0xfffff,
  225. .flags = IORESOURCE_MEM,
  226. },
  227. [1] = {
  228. .start = AU1XXX_SMC91111_IRQ,
  229. .end = AU1XXX_SMC91111_IRQ,
  230. .flags = IORESOURCE_IRQ,
  231. },
  232. };
  233. static struct platform_device smc91x_device = {
  234. .name = "smc91x",
  235. .id = -1,
  236. .num_resources = ARRAY_SIZE(smc91x_resources),
  237. .resource = smc91x_resources,
  238. };
  239. #endif
  240. static struct platform_device *au1xxx_platform_devices[] __initdata = {
  241. &au1xxx_usb_ohci_device,
  242. &au1x00_pcmcia_device,
  243. #ifdef CONFIG_FB_AU1100
  244. &au1100_lcd_device,
  245. #endif
  246. #ifdef CONFIG_SOC_AU1200
  247. &au1xxx_usb_ehci_device,
  248. &au1xxx_usb_gdt_device,
  249. &au1xxx_usb_otg_device,
  250. &au1200_lcd_device,
  251. &au1200_ide0_device,
  252. &au1xxx_mmc_device,
  253. #endif
  254. #ifdef CONFIG_MIPS_DB1200
  255. &smc91x_device,
  256. #endif
  257. };
  258. int au1xxx_platform_init(void)
  259. {
  260. return platform_add_devices(au1xxx_platform_devices, ARRAY_SIZE(au1xxx_platform_devices));
  261. }
  262. arch_initcall(au1xxx_platform_init);