platform.c 6.8 KB

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