devices.c 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. /*
  2. * Copyright 2009 Sascha Hauer, <kernel@pengutronix.de>
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version 2
  7. * of the License, or (at your option) any later version.
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program; if not, write to the Free Software
  15. * Foundation, Inc., 51 Franklin Street, Fifth Floor,
  16. * Boston, MA 02110-1301, USA.
  17. */
  18. #include <linux/platform_device.h>
  19. #include <linux/dma-mapping.h>
  20. #include <linux/gpio.h>
  21. #include <mach/mx25.h>
  22. #include <mach/irqs.h>
  23. static u64 otg_dmamask = DMA_BIT_MASK(32);
  24. static struct resource mxc_otg_resources[] = {
  25. {
  26. .start = MX25_OTG_BASE_ADDR,
  27. .end = MX25_OTG_BASE_ADDR + 0x1ff,
  28. .flags = IORESOURCE_MEM,
  29. }, {
  30. .start = 37,
  31. .end = 37,
  32. .flags = IORESOURCE_IRQ,
  33. },
  34. };
  35. struct platform_device mxc_otg = {
  36. .name = "mxc-ehci",
  37. .id = 0,
  38. .dev = {
  39. .coherent_dma_mask = 0xffffffff,
  40. .dma_mask = &otg_dmamask,
  41. },
  42. .resource = mxc_otg_resources,
  43. .num_resources = ARRAY_SIZE(mxc_otg_resources),
  44. };
  45. /* OTG gadget device */
  46. struct platform_device otg_udc_device = {
  47. .name = "fsl-usb2-udc",
  48. .id = -1,
  49. .dev = {
  50. .dma_mask = &otg_dmamask,
  51. .coherent_dma_mask = 0xffffffff,
  52. },
  53. .resource = mxc_otg_resources,
  54. .num_resources = ARRAY_SIZE(mxc_otg_resources),
  55. };
  56. static u64 usbh2_dmamask = DMA_BIT_MASK(32);
  57. static struct resource mxc_usbh2_resources[] = {
  58. {
  59. .start = MX25_OTG_BASE_ADDR + 0x400,
  60. .end = MX25_OTG_BASE_ADDR + 0x5ff,
  61. .flags = IORESOURCE_MEM,
  62. }, {
  63. .start = 35,
  64. .end = 35,
  65. .flags = IORESOURCE_IRQ,
  66. },
  67. };
  68. struct platform_device mxc_usbh2 = {
  69. .name = "mxc-ehci",
  70. .id = 1,
  71. .dev = {
  72. .coherent_dma_mask = 0xffffffff,
  73. .dma_mask = &usbh2_dmamask,
  74. },
  75. .resource = mxc_usbh2_resources,
  76. .num_resources = ARRAY_SIZE(mxc_usbh2_resources),
  77. };
  78. static struct resource mxc_pwm_resources0[] = {
  79. {
  80. .start = 0x53fe0000,
  81. .end = 0x53fe3fff,
  82. .flags = IORESOURCE_MEM,
  83. }, {
  84. .start = 26,
  85. .end = 26,
  86. .flags = IORESOURCE_IRQ,
  87. }
  88. };
  89. struct platform_device mxc_pwm_device0 = {
  90. .name = "mxc_pwm",
  91. .id = 0,
  92. .num_resources = ARRAY_SIZE(mxc_pwm_resources0),
  93. .resource = mxc_pwm_resources0,
  94. };
  95. static struct resource mxc_pwm_resources1[] = {
  96. {
  97. .start = 0x53fa0000,
  98. .end = 0x53fa3fff,
  99. .flags = IORESOURCE_MEM,
  100. }, {
  101. .start = 36,
  102. .end = 36,
  103. .flags = IORESOURCE_IRQ,
  104. }
  105. };
  106. struct platform_device mxc_pwm_device1 = {
  107. .name = "mxc_pwm",
  108. .id = 1,
  109. .num_resources = ARRAY_SIZE(mxc_pwm_resources1),
  110. .resource = mxc_pwm_resources1,
  111. };
  112. static struct resource mxc_pwm_resources2[] = {
  113. {
  114. .start = 0x53fa8000,
  115. .end = 0x53fabfff,
  116. .flags = IORESOURCE_MEM,
  117. }, {
  118. .start = 41,
  119. .end = 41,
  120. .flags = IORESOURCE_IRQ,
  121. }
  122. };
  123. struct platform_device mxc_pwm_device2 = {
  124. .name = "mxc_pwm",
  125. .id = 2,
  126. .num_resources = ARRAY_SIZE(mxc_pwm_resources2),
  127. .resource = mxc_pwm_resources2,
  128. };
  129. static struct resource mxc_keypad_resources[] = {
  130. {
  131. .start = 0x43fa8000,
  132. .end = 0x43fabfff,
  133. .flags = IORESOURCE_MEM,
  134. }, {
  135. .start = 24,
  136. .end = 24,
  137. .flags = IORESOURCE_IRQ,
  138. }
  139. };
  140. struct platform_device mxc_keypad_device = {
  141. .name = "mxc-keypad",
  142. .id = -1,
  143. .num_resources = ARRAY_SIZE(mxc_keypad_resources),
  144. .resource = mxc_keypad_resources,
  145. };
  146. static struct resource mxc_pwm_resources3[] = {
  147. {
  148. .start = 0x53fc8000,
  149. .end = 0x53fcbfff,
  150. .flags = IORESOURCE_MEM,
  151. }, {
  152. .start = 42,
  153. .end = 42,
  154. .flags = IORESOURCE_IRQ,
  155. }
  156. };
  157. struct platform_device mxc_pwm_device3 = {
  158. .name = "mxc_pwm",
  159. .id = 3,
  160. .num_resources = ARRAY_SIZE(mxc_pwm_resources3),
  161. .resource = mxc_pwm_resources3,
  162. };
  163. static struct mxc_gpio_port imx_gpio_ports[] = {
  164. {
  165. .chip.label = "gpio-0",
  166. .base = (void __iomem *)MX25_GPIO1_BASE_ADDR_VIRT,
  167. .irq = 52,
  168. .virtual_irq_start = MXC_GPIO_IRQ_START,
  169. }, {
  170. .chip.label = "gpio-1",
  171. .base = (void __iomem *)MX25_GPIO2_BASE_ADDR_VIRT,
  172. .irq = 51,
  173. .virtual_irq_start = MXC_GPIO_IRQ_START + 32,
  174. }, {
  175. .chip.label = "gpio-2",
  176. .base = (void __iomem *)MX25_GPIO3_BASE_ADDR_VIRT,
  177. .irq = 16,
  178. .virtual_irq_start = MXC_GPIO_IRQ_START + 64,
  179. }, {
  180. .chip.label = "gpio-3",
  181. .base = (void __iomem *)MX25_GPIO4_BASE_ADDR_VIRT,
  182. .irq = 23,
  183. .virtual_irq_start = MXC_GPIO_IRQ_START + 96,
  184. }
  185. };
  186. int __init imx25_register_gpios(void)
  187. {
  188. return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));
  189. }
  190. static struct resource mx25_fec_resources[] = {
  191. {
  192. .start = MX25_FEC_BASE_ADDR,
  193. .end = MX25_FEC_BASE_ADDR + 0xfff,
  194. .flags = IORESOURCE_MEM,
  195. },
  196. {
  197. .start = MX25_INT_FEC,
  198. .end = MX25_INT_FEC,
  199. .flags = IORESOURCE_IRQ,
  200. },
  201. };
  202. struct platform_device mx25_fec_device = {
  203. .name = "fec",
  204. .id = 0,
  205. .num_resources = ARRAY_SIZE(mx25_fec_resources),
  206. .resource = mx25_fec_resources,
  207. };
  208. static struct resource mx25_rtc_resources[] = {
  209. {
  210. .start = MX25_DRYICE_BASE_ADDR,
  211. .end = MX25_DRYICE_BASE_ADDR + 0x40,
  212. .flags = IORESOURCE_MEM,
  213. },
  214. {
  215. .start = MX25_INT_DRYICE,
  216. .flags = IORESOURCE_IRQ
  217. },
  218. };
  219. struct platform_device mx25_rtc_device = {
  220. .name = "imxdi_rtc",
  221. .id = 0,
  222. .num_resources = ARRAY_SIZE(mx25_rtc_resources),
  223. .resource = mx25_rtc_resources,
  224. };
  225. static struct resource mx25_fb_resources[] = {
  226. {
  227. .start = MX25_LCDC_BASE_ADDR,
  228. .end = MX25_LCDC_BASE_ADDR + 0xfff,
  229. .flags = IORESOURCE_MEM,
  230. },
  231. {
  232. .start = MX25_INT_LCDC,
  233. .end = MX25_INT_LCDC,
  234. .flags = IORESOURCE_IRQ,
  235. },
  236. };
  237. struct platform_device mx25_fb_device = {
  238. .name = "imx-fb",
  239. .id = 0,
  240. .resource = mx25_fb_resources,
  241. .num_resources = ARRAY_SIZE(mx25_fb_resources),
  242. .dev = {
  243. .coherent_dma_mask = 0xFFFFFFFF,
  244. },
  245. };
  246. static struct resource mxc_wdt_resources[] = {
  247. {
  248. .start = MX25_WDOG_BASE_ADDR,
  249. .end = MX25_WDOG_BASE_ADDR + SZ_16K - 1,
  250. .flags = IORESOURCE_MEM,
  251. },
  252. };
  253. struct platform_device mxc_wdt = {
  254. .name = "imx2-wdt",
  255. .id = 0,
  256. .num_resources = ARRAY_SIZE(mxc_wdt_resources),
  257. .resource = mxc_wdt_resources,
  258. };
  259. static struct resource mx25_kpp_resources[] = {
  260. {
  261. .start = MX25_KPP_BASE_ADDR,
  262. .end = MX25_KPP_BASE_ADDR + 0xf,
  263. .flags = IORESOURCE_MEM,
  264. },
  265. {
  266. .start = MX25_INT_KPP,
  267. .end = MX25_INT_KPP,
  268. .flags = IORESOURCE_IRQ,
  269. },
  270. };
  271. struct platform_device mx25_kpp_device = {
  272. .name = "imx-keypad",
  273. .id = -1,
  274. .num_resources = ARRAY_SIZE(mx25_kpp_resources),
  275. .resource = mx25_kpp_resources,
  276. };
  277. static struct resource imx_ssi_resources0[] = {
  278. {
  279. .start = MX25_SSI1_BASE_ADDR,
  280. .end = MX25_SSI1_BASE_ADDR + 0x3fff,
  281. .flags = IORESOURCE_MEM,
  282. }, {
  283. .start = MX25_INT_SSI1,
  284. .end = MX25_INT_SSI1,
  285. .flags = IORESOURCE_IRQ,
  286. },
  287. };
  288. static struct resource imx_ssi_resources1[] = {
  289. {
  290. .start = MX25_SSI2_BASE_ADDR,
  291. .end = MX25_SSI2_BASE_ADDR + 0x3fff,
  292. .flags = IORESOURCE_MEM
  293. }, {
  294. .start = MX25_INT_SSI2,
  295. .end = MX25_INT_SSI2,
  296. .flags = IORESOURCE_IRQ,
  297. },
  298. };
  299. struct platform_device imx_ssi_device0 = {
  300. .name = "imx-ssi",
  301. .id = 0,
  302. .num_resources = ARRAY_SIZE(imx_ssi_resources0),
  303. .resource = imx_ssi_resources0,
  304. };
  305. struct platform_device imx_ssi_device1 = {
  306. .name = "imx-ssi",
  307. .id = 1,
  308. .num_resources = ARRAY_SIZE(imx_ssi_resources1),
  309. .resource = imx_ssi_resources1,
  310. };
  311. static struct resource mx25_csi_resources[] = {
  312. {
  313. .start = MX25_CSI_BASE_ADDR,
  314. .end = MX25_CSI_BASE_ADDR + 0xfff,
  315. .flags = IORESOURCE_MEM,
  316. },
  317. {
  318. .start = MX25_INT_CSI,
  319. .flags = IORESOURCE_IRQ
  320. },
  321. };
  322. struct platform_device mx25_csi_device = {
  323. .name = "mx2-camera",
  324. .id = 0,
  325. .num_resources = ARRAY_SIZE(mx25_csi_resources),
  326. .resource = mx25_csi_resources,
  327. .dev = {
  328. .coherent_dma_mask = 0xffffffff,
  329. },
  330. };