platform.c 5.4 KB

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