devices.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  1. /*
  2. * Author: MontaVista Software, Inc.
  3. * <source@mvista.com>
  4. *
  5. * Based on the OMAP devices.c
  6. *
  7. * 2005 (c) MontaVista Software, Inc. This file is licensed under the
  8. * terms of the GNU General Public License version 2. This program is
  9. * licensed "as is" without any warranty of any kind, whether express
  10. * or implied.
  11. *
  12. * Copyright 2006-2007 Freescale Semiconductor, Inc. All Rights Reserved.
  13. * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
  14. * Copyright 2008 Sascha Hauer, kernel@pengutronix.de
  15. * Copyright (c) 2008 Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
  16. * Copyright (c) 2008 Darius Augulis <darius.augulis@teltonika.lt>
  17. *
  18. * This program is free software; you can redistribute it and/or
  19. * modify it under the terms of the GNU General Public License
  20. * as published by the Free Software Foundation; either version 2
  21. * of the License, or (at your option) any later version.
  22. * This program is distributed in the hope that it will be useful,
  23. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  24. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  25. * GNU General Public License for more details.
  26. *
  27. * You should have received a copy of the GNU General Public License
  28. * along with this program; if not, write to the Free Software
  29. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  30. * MA 02110-1301, USA.
  31. */
  32. #include <linux/module.h>
  33. #include <linux/kernel.h>
  34. #include <linux/init.h>
  35. #include <linux/platform_device.h>
  36. #include <linux/gpio.h>
  37. #include <linux/dma-mapping.h>
  38. #include <linux/serial.h>
  39. #include <mach/irqs.h>
  40. #include <mach/hardware.h>
  41. #include <mach/common.h>
  42. #include <mach/mmc.h>
  43. #include "devices.h"
  44. #if defined(CONFIG_ARCH_MX1)
  45. static struct resource imx1_camera_resources[] = {
  46. {
  47. .start = 0x00224000,
  48. .end = 0x00224010,
  49. .flags = IORESOURCE_MEM,
  50. }, {
  51. .start = MX1_CSI_INT,
  52. .end = MX1_CSI_INT,
  53. .flags = IORESOURCE_IRQ,
  54. },
  55. };
  56. static u64 imx1_camera_dmamask = DMA_BIT_MASK(32);
  57. struct platform_device imx1_camera_device = {
  58. .name = "mx1-camera",
  59. .id = 0, /* This is used to put cameras on this interface */
  60. .dev = {
  61. .dma_mask = &imx1_camera_dmamask,
  62. .coherent_dma_mask = DMA_BIT_MASK(32),
  63. },
  64. .resource = imx1_camera_resources,
  65. .num_resources = ARRAY_SIZE(imx1_camera_resources),
  66. };
  67. #define DEFINE_IMX1_UART_DEVICE(n, baseaddr, irqrx, irqtx, irqrts) \
  68. static struct resource imx1_uart_resources ## n[] = { \
  69. { \
  70. .start = baseaddr, \
  71. .end = baseaddr + 0xd0, \
  72. .flags = IORESOURCE_MEM, \
  73. }, { \
  74. .start = irqrx, \
  75. .end = irqrx, \
  76. .flags = IORESOURCE_IRQ, \
  77. }, { \
  78. .start = irqtx, \
  79. .end = irqtx, \
  80. .flags = IORESOURCE_IRQ, \
  81. }, { \
  82. .start = irqrts, \
  83. .end = irqrts, \
  84. .flags = IORESOURCE_IRQ, \
  85. }, \
  86. }; \
  87. \
  88. struct platform_device imx1_uart_device ## n = { \
  89. .name = "imx-uart", \
  90. .id = n, \
  91. .num_resources = ARRAY_SIZE(imx1_uart_resources ## n), \
  92. .resource = imx1_uart_resources ## n, \
  93. }
  94. DEFINE_IMX1_UART_DEVICE(0, MX1_UART1_BASE_ADDR, MX1_UART1_MINT_RX, MX1_UART1_MINT_TX, MX1_UART1_MINT_RTS);
  95. DEFINE_IMX1_UART_DEVICE(1, MX1_UART2_BASE_ADDR, MX1_UART2_MINT_RX, MX1_UART2_MINT_TX, MX1_UART2_MINT_RTS);
  96. static struct resource imx_rtc_resources[] = {
  97. {
  98. .start = 0x00204000,
  99. .end = 0x00204024,
  100. .flags = IORESOURCE_MEM,
  101. }, {
  102. .start = MX1_RTC_INT,
  103. .end = MX1_RTC_INT,
  104. .flags = IORESOURCE_IRQ,
  105. }, {
  106. .start = MX1_RTC_SAMINT,
  107. .end = MX1_RTC_SAMINT,
  108. .flags = IORESOURCE_IRQ,
  109. },
  110. };
  111. struct platform_device imx_rtc_device = {
  112. .name = "rtc-imx",
  113. .id = 0,
  114. .resource = imx_rtc_resources,
  115. .num_resources = ARRAY_SIZE(imx_rtc_resources),
  116. };
  117. static struct resource imx_wdt_resources[] = {
  118. {
  119. .start = 0x00201000,
  120. .end = 0x00201008,
  121. .flags = IORESOURCE_MEM,
  122. }, {
  123. .start = MX1_WDT_INT,
  124. .end = MX1_WDT_INT,
  125. .flags = IORESOURCE_IRQ,
  126. },
  127. };
  128. struct platform_device imx_wdt_device = {
  129. .name = "imx-wdt",
  130. .id = 0,
  131. .resource = imx_wdt_resources,
  132. .num_resources = ARRAY_SIZE(imx_wdt_resources),
  133. };
  134. static struct resource imx_usb_resources[] = {
  135. {
  136. .start = 0x00212000,
  137. .end = 0x00212148,
  138. .flags = IORESOURCE_MEM,
  139. }, {
  140. .start = MX1_USBD_INT0,
  141. .end = MX1_USBD_INT0,
  142. .flags = IORESOURCE_IRQ,
  143. }, {
  144. .start = MX1_USBD_INT1,
  145. .end = MX1_USBD_INT1,
  146. .flags = IORESOURCE_IRQ,
  147. }, {
  148. .start = MX1_USBD_INT2,
  149. .end = MX1_USBD_INT2,
  150. .flags = IORESOURCE_IRQ,
  151. }, {
  152. .start = MX1_USBD_INT3,
  153. .end = MX1_USBD_INT3,
  154. .flags = IORESOURCE_IRQ,
  155. }, {
  156. .start = MX1_USBD_INT4,
  157. .end = MX1_USBD_INT4,
  158. .flags = IORESOURCE_IRQ,
  159. }, {
  160. .start = MX1_USBD_INT5,
  161. .end = MX1_USBD_INT5,
  162. .flags = IORESOURCE_IRQ,
  163. }, {
  164. .start = MX1_USBD_INT6,
  165. .end = MX1_USBD_INT6,
  166. .flags = IORESOURCE_IRQ,
  167. },
  168. };
  169. struct platform_device imx_usb_device = {
  170. .name = "imx_udc",
  171. .id = 0,
  172. .num_resources = ARRAY_SIZE(imx_usb_resources),
  173. .resource = imx_usb_resources,
  174. };
  175. /* GPIO port description */
  176. static struct mxc_gpio_port imx_gpio_ports[] = {
  177. {
  178. .chip.label = "gpio-0",
  179. .base = (void __iomem *)MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR),
  180. .irq = MX1_GPIO_INT_PORTA,
  181. .virtual_irq_start = MXC_GPIO_IRQ_START,
  182. }, {
  183. .chip.label = "gpio-1",
  184. .base = (void __iomem *)MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR + 0x100),
  185. .irq = MX1_GPIO_INT_PORTB,
  186. .virtual_irq_start = MXC_GPIO_IRQ_START + 32,
  187. }, {
  188. .chip.label = "gpio-2",
  189. .base = (void __iomem *)MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR + 0x200),
  190. .irq = MX1_GPIO_INT_PORTC,
  191. .virtual_irq_start = MXC_GPIO_IRQ_START + 64,
  192. }, {
  193. .chip.label = "gpio-3",
  194. .base = (void __iomem *)MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR + 0x300),
  195. .irq = MX1_GPIO_INT_PORTD,
  196. .virtual_irq_start = MXC_GPIO_IRQ_START + 96,
  197. }
  198. };
  199. int __init imx1_register_gpios(void)
  200. {
  201. return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));
  202. }
  203. #endif
  204. #if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27)
  205. /*
  206. * SPI master controller
  207. *
  208. * - i.MX1: 2 channel (slighly different register setting)
  209. * - i.MX21: 2 channel
  210. * - i.MX27: 3 channel
  211. */
  212. #define DEFINE_IMX_SPI_DEVICE(n, baseaddr, irq) \
  213. static struct resource mxc_spi_resources ## n[] = { \
  214. { \
  215. .start = baseaddr, \
  216. .end = baseaddr + SZ_4K - 1, \
  217. .flags = IORESOURCE_MEM, \
  218. }, { \
  219. .start = irq, \
  220. .end = irq, \
  221. .flags = IORESOURCE_IRQ, \
  222. }, \
  223. }; \
  224. \
  225. struct platform_device mxc_spi_device ## n = { \
  226. .name = "spi_imx", \
  227. .id = n, \
  228. .num_resources = ARRAY_SIZE(mxc_spi_resources ## n), \
  229. .resource = mxc_spi_resources ## n, \
  230. }
  231. DEFINE_IMX_SPI_DEVICE(0, MX2x_CSPI1_BASE_ADDR, MX2x_INT_CSPI1);
  232. DEFINE_IMX_SPI_DEVICE(1, MX2x_CSPI2_BASE_ADDR, MX2x_INT_CSPI2);
  233. #ifdef CONFIG_MACH_MX27
  234. DEFINE_IMX_SPI_DEVICE(2, MX27_CSPI3_BASE_ADDR, MX27_INT_CSPI3);
  235. #endif
  236. /*
  237. * General Purpose Timer
  238. * - i.MX21: 3 timers
  239. * - i.MX27: 6 timers
  240. */
  241. #define DEFINE_IMX_GPT_DEVICE(n, baseaddr, irq) \
  242. static struct resource timer ## n ##_resources[] = { \
  243. { \
  244. .start = baseaddr, \
  245. .end = baseaddr + SZ_4K - 1, \
  246. .flags = IORESOURCE_MEM, \
  247. }, { \
  248. .start = irq, \
  249. .end = irq, \
  250. .flags = IORESOURCE_IRQ, \
  251. } \
  252. }; \
  253. \
  254. struct platform_device mxc_gpt ## n = { \
  255. .name = "imx_gpt", \
  256. .id = n, \
  257. .num_resources = ARRAY_SIZE(timer ## n ## _resources), \
  258. .resource = timer ## n ## _resources, \
  259. }
  260. /* We use gpt1 as system timer, so do not add a device for this one */
  261. DEFINE_IMX_GPT_DEVICE(1, MX2x_GPT2_BASE_ADDR, MX2x_INT_GPT2);
  262. DEFINE_IMX_GPT_DEVICE(2, MX2x_GPT3_BASE_ADDR, MX2x_INT_GPT3);
  263. #ifdef CONFIG_MACH_MX27
  264. DEFINE_IMX_GPT_DEVICE(3, MX27_GPT4_BASE_ADDR, MX27_INT_GPT4);
  265. DEFINE_IMX_GPT_DEVICE(4, MX27_GPT5_BASE_ADDR, MX27_INT_GPT5);
  266. DEFINE_IMX_GPT_DEVICE(5, MX27_GPT6_BASE_ADDR, MX27_INT_GPT6);
  267. #endif
  268. /* Watchdog: i.MX1 has seperate driver, i.MX21 and i.MX27 are equal */
  269. static struct resource mxc_wdt_resources[] = {
  270. {
  271. .start = MX2x_WDOG_BASE_ADDR,
  272. .end = MX2x_WDOG_BASE_ADDR + SZ_4K - 1,
  273. .flags = IORESOURCE_MEM,
  274. },
  275. };
  276. struct platform_device mxc_wdt = {
  277. .name = "imx2-wdt",
  278. .id = 0,
  279. .num_resources = ARRAY_SIZE(mxc_wdt_resources),
  280. .resource = mxc_wdt_resources,
  281. };
  282. static struct resource mxc_w1_master_resources[] = {
  283. {
  284. .start = MX2x_OWIRE_BASE_ADDR,
  285. .end = MX2x_OWIRE_BASE_ADDR + SZ_4K - 1,
  286. .flags = IORESOURCE_MEM,
  287. },
  288. };
  289. struct platform_device mxc_w1_master_device = {
  290. .name = "mxc_w1",
  291. .id = 0,
  292. .num_resources = ARRAY_SIZE(mxc_w1_master_resources),
  293. .resource = mxc_w1_master_resources,
  294. };
  295. /*
  296. * lcdc:
  297. * - i.MX1: the basic controller
  298. * - i.MX21: to be checked
  299. * - i.MX27: like i.MX1, with slightly variations
  300. */
  301. static struct resource mxc_fb[] = {
  302. {
  303. .start = MX2x_LCDC_BASE_ADDR,
  304. .end = MX2x_LCDC_BASE_ADDR + SZ_4K - 1,
  305. .flags = IORESOURCE_MEM,
  306. }, {
  307. .start = MX2x_INT_LCDC,
  308. .end = MX2x_INT_LCDC,
  309. .flags = IORESOURCE_IRQ,
  310. }
  311. };
  312. /* mxc lcd driver */
  313. struct platform_device mxc_fb_device = {
  314. .name = "imx-fb",
  315. .id = 0,
  316. .num_resources = ARRAY_SIZE(mxc_fb),
  317. .resource = mxc_fb,
  318. .dev = {
  319. .coherent_dma_mask = DMA_BIT_MASK(32),
  320. },
  321. };
  322. #ifdef CONFIG_MACH_MX27
  323. static struct resource mxc_fec_resources[] = {
  324. {
  325. .start = MX27_FEC_BASE_ADDR,
  326. .end = MX27_FEC_BASE_ADDR + SZ_4K - 1,
  327. .flags = IORESOURCE_MEM,
  328. }, {
  329. .start = MX27_INT_FEC,
  330. .end = MX27_INT_FEC,
  331. .flags = IORESOURCE_IRQ,
  332. },
  333. };
  334. struct platform_device mxc_fec_device = {
  335. .name = "fec",
  336. .id = 0,
  337. .num_resources = ARRAY_SIZE(mxc_fec_resources),
  338. .resource = mxc_fec_resources,
  339. };
  340. #endif
  341. static struct resource mxc_pwm_resources[] = {
  342. {
  343. .start = MX2x_PWM_BASE_ADDR,
  344. .end = MX2x_PWM_BASE_ADDR + SZ_4K - 1,
  345. .flags = IORESOURCE_MEM,
  346. }, {
  347. .start = MX2x_INT_PWM,
  348. .end = MX2x_INT_PWM,
  349. .flags = IORESOURCE_IRQ,
  350. }
  351. };
  352. struct platform_device mxc_pwm_device = {
  353. .name = "mxc_pwm",
  354. .id = 0,
  355. .num_resources = ARRAY_SIZE(mxc_pwm_resources),
  356. .resource = mxc_pwm_resources,
  357. };
  358. #define DEFINE_MXC_MMC_DEVICE(n, baseaddr, irq, dmareq) \
  359. static struct resource mxc_sdhc_resources ## n[] = { \
  360. { \
  361. .start = baseaddr, \
  362. .end = baseaddr + SZ_4K - 1, \
  363. .flags = IORESOURCE_MEM, \
  364. }, { \
  365. .start = irq, \
  366. .end = irq, \
  367. .flags = IORESOURCE_IRQ, \
  368. }, { \
  369. .start = dmareq, \
  370. .end = dmareq, \
  371. .flags = IORESOURCE_DMA, \
  372. }, \
  373. }; \
  374. \
  375. static u64 mxc_sdhc ## n ## _dmamask = DMA_BIT_MASK(32); \
  376. \
  377. struct platform_device mxc_sdhc_device ## n = { \
  378. .name = "mxc-mmc", \
  379. .id = n, \
  380. .dev = { \
  381. .dma_mask = &mxc_sdhc ## n ## _dmamask, \
  382. .coherent_dma_mask = DMA_BIT_MASK(32), \
  383. }, \
  384. .num_resources = ARRAY_SIZE(mxc_sdhc_resources ## n), \
  385. .resource = mxc_sdhc_resources ## n, \
  386. }
  387. DEFINE_MXC_MMC_DEVICE(0, MX2x_SDHC1_BASE_ADDR, MX2x_INT_SDHC1, MX2x_DMA_REQ_SDHC1);
  388. DEFINE_MXC_MMC_DEVICE(1, MX2x_SDHC2_BASE_ADDR, MX2x_INT_SDHC2, MX2x_DMA_REQ_SDHC2);
  389. #ifdef CONFIG_MACH_MX27
  390. static struct resource otg_resources[] = {
  391. {
  392. .start = MX27_USBOTG_BASE_ADDR,
  393. .end = MX27_USBOTG_BASE_ADDR + 0x1ff,
  394. .flags = IORESOURCE_MEM,
  395. }, {
  396. .start = MX27_INT_USB3,
  397. .end = MX27_INT_USB3,
  398. .flags = IORESOURCE_IRQ,
  399. },
  400. };
  401. static u64 otg_dmamask = DMA_BIT_MASK(32);
  402. /* OTG gadget device */
  403. struct platform_device mxc_otg_udc_device = {
  404. .name = "fsl-usb2-udc",
  405. .id = -1,
  406. .dev = {
  407. .dma_mask = &otg_dmamask,
  408. .coherent_dma_mask = DMA_BIT_MASK(32),
  409. },
  410. .resource = otg_resources,
  411. .num_resources = ARRAY_SIZE(otg_resources),
  412. };
  413. /* OTG host */
  414. struct platform_device mxc_otg_host = {
  415. .name = "mxc-ehci",
  416. .id = 0,
  417. .dev = {
  418. .coherent_dma_mask = DMA_BIT_MASK(32),
  419. .dma_mask = &otg_dmamask,
  420. },
  421. .resource = otg_resources,
  422. .num_resources = ARRAY_SIZE(otg_resources),
  423. };
  424. /* USB host 1 */
  425. static u64 usbh1_dmamask = DMA_BIT_MASK(32);
  426. static struct resource mxc_usbh1_resources[] = {
  427. {
  428. .start = MX27_USBOTG_BASE_ADDR + 0x200,
  429. .end = MX27_USBOTG_BASE_ADDR + 0x3ff,
  430. .flags = IORESOURCE_MEM,
  431. }, {
  432. .start = MX27_INT_USB1,
  433. .end = MX27_INT_USB1,
  434. .flags = IORESOURCE_IRQ,
  435. },
  436. };
  437. struct platform_device mxc_usbh1 = {
  438. .name = "mxc-ehci",
  439. .id = 1,
  440. .dev = {
  441. .coherent_dma_mask = DMA_BIT_MASK(32),
  442. .dma_mask = &usbh1_dmamask,
  443. },
  444. .resource = mxc_usbh1_resources,
  445. .num_resources = ARRAY_SIZE(mxc_usbh1_resources),
  446. };
  447. /* USB host 2 */
  448. static u64 usbh2_dmamask = DMA_BIT_MASK(32);
  449. static struct resource mxc_usbh2_resources[] = {
  450. {
  451. .start = MX27_USBOTG_BASE_ADDR + 0x400,
  452. .end = MX27_USBOTG_BASE_ADDR + 0x5ff,
  453. .flags = IORESOURCE_MEM,
  454. }, {
  455. .start = MX27_INT_USB2,
  456. .end = MX27_INT_USB2,
  457. .flags = IORESOURCE_IRQ,
  458. },
  459. };
  460. struct platform_device mxc_usbh2 = {
  461. .name = "mxc-ehci",
  462. .id = 2,
  463. .dev = {
  464. .coherent_dma_mask = DMA_BIT_MASK(32),
  465. .dma_mask = &usbh2_dmamask,
  466. },
  467. .resource = mxc_usbh2_resources,
  468. .num_resources = ARRAY_SIZE(mxc_usbh2_resources),
  469. };
  470. #endif
  471. #define DEFINE_IMX_SSI_DMARES(_name, ssin, suffix) \
  472. { \
  473. .name = _name, \
  474. .start = MX2x_DMA_REQ_SSI ## ssin ## _ ## suffix, \
  475. .end = MX2x_DMA_REQ_SSI ## ssin ## _ ## suffix, \
  476. .flags = IORESOURCE_DMA, \
  477. }
  478. #define DEFINE_IMX_SSI_DEVICE(n, ssin, baseaddr, irq) \
  479. static struct resource imx_ssi_resources ## n[] = { \
  480. { \
  481. .start = MX2x_SSI ## ssin ## _BASE_ADDR, \
  482. .end = MX2x_SSI ## ssin ## _BASE_ADDR + 0x6f, \
  483. .flags = IORESOURCE_MEM, \
  484. }, { \
  485. .start = MX2x_INT_SSI1, \
  486. .end = MX2x_INT_SSI1, \
  487. .flags = IORESOURCE_IRQ, \
  488. }, \
  489. DEFINE_IMX_SSI_DMARES("tx0", ssin, TX0), \
  490. DEFINE_IMX_SSI_DMARES("rx0", ssin, RX0), \
  491. DEFINE_IMX_SSI_DMARES("tx1", ssin, TX1), \
  492. DEFINE_IMX_SSI_DMARES("rx1", ssin, RX1), \
  493. }; \
  494. \
  495. struct platform_device imx_ssi_device ## n = { \
  496. .name = "imx-ssi", \
  497. .id = n, \
  498. .num_resources = ARRAY_SIZE(imx_ssi_resources ## n), \
  499. .resource = imx_ssi_resources ## n, \
  500. }
  501. DEFINE_IMX_SSI_DEVICE(0, 1, MX2x_SSI1_BASE_ADDR, MX2x_INT_SSI1);
  502. DEFINE_IMX_SSI_DEVICE(1, 2, MX2x_SSI1_BASE_ADDR, MX2x_INT_SSI1);
  503. #define DEFINE_IMX2x_UART_DEVICE(n, baseaddr, irq) \
  504. static struct resource imx2x_uart_resources ## n[] = { \
  505. { \
  506. .start = baseaddr, \
  507. .end = baseaddr + 0xb5, \
  508. .flags = IORESOURCE_MEM, \
  509. }, { \
  510. .start = irq, \
  511. .end = irq, \
  512. .flags = IORESOURCE_IRQ, \
  513. }, \
  514. }; \
  515. \
  516. struct platform_device imx2x_uart_device ## n = { \
  517. .name = "imx-uart", \
  518. .id = n, \
  519. .num_resources = ARRAY_SIZE(imx2x_uart_resources ## n), \
  520. .resource = imx2x_uart_resources ## n, \
  521. }
  522. DEFINE_IMX2x_UART_DEVICE(0, MX2x_UART1_BASE_ADDR, MX2x_INT_UART1);
  523. DEFINE_IMX2x_UART_DEVICE(1, MX2x_UART2_BASE_ADDR, MX2x_INT_UART2);
  524. DEFINE_IMX2x_UART_DEVICE(2, MX2x_UART3_BASE_ADDR, MX2x_INT_UART3);
  525. DEFINE_IMX2x_UART_DEVICE(3, MX2x_UART4_BASE_ADDR, MX2x_INT_UART4);
  526. #ifdef CONFIG_MACH_MX27
  527. DEFINE_IMX2x_UART_DEVICE(4, MX27_UART5_BASE_ADDR, MX27_INT_UART5);
  528. DEFINE_IMX2x_UART_DEVICE(5, MX27_UART6_BASE_ADDR, MX27_INT_UART6);
  529. #endif
  530. /* GPIO port description */
  531. #define DEFINE_MXC_GPIO_PORT_IRQ(SOC, n, _irq) \
  532. { \
  533. .chip.label = "gpio-" #n, \
  534. .irq = _irq, \
  535. .base = SOC ## _IO_ADDRESS(MX2x_GPIO_BASE_ADDR + \
  536. n * 0x100), \
  537. .virtual_irq_start = MXC_GPIO_IRQ_START + n * 32, \
  538. }
  539. #define DEFINE_MXC_GPIO_PORT(SOC, n) \
  540. { \
  541. .chip.label = "gpio-" #n, \
  542. .base = SOC ## _IO_ADDRESS(MX2x_GPIO_BASE_ADDR + \
  543. n * 0x100), \
  544. .virtual_irq_start = MXC_GPIO_IRQ_START + n * 32, \
  545. }
  546. #define DEFINE_MXC_GPIO_PORTS(SOC, pfx) \
  547. static struct mxc_gpio_port pfx ## _gpio_ports[] = { \
  548. DEFINE_MXC_GPIO_PORT_IRQ(SOC, 0, SOC ## _INT_GPIO), \
  549. DEFINE_MXC_GPIO_PORT(SOC, 1), \
  550. DEFINE_MXC_GPIO_PORT(SOC, 2), \
  551. DEFINE_MXC_GPIO_PORT(SOC, 3), \
  552. DEFINE_MXC_GPIO_PORT(SOC, 4), \
  553. DEFINE_MXC_GPIO_PORT(SOC, 5), \
  554. }
  555. #ifdef CONFIG_MACH_MX21
  556. DEFINE_MXC_GPIO_PORTS(MX21, imx21);
  557. int __init imx21_register_gpios(void)
  558. {
  559. return mxc_gpio_init(imx21_gpio_ports, ARRAY_SIZE(imx21_gpio_ports));
  560. }
  561. #endif
  562. #ifdef CONFIG_MACH_MX27
  563. DEFINE_MXC_GPIO_PORTS(MX27, imx27);
  564. int __init imx27_register_gpios(void)
  565. {
  566. return mxc_gpio_init(imx27_gpio_ports, ARRAY_SIZE(imx27_gpio_ports));
  567. }
  568. #endif
  569. #ifdef CONFIG_MACH_MX21
  570. static struct resource mx21_usbhc_resources[] = {
  571. {
  572. .start = MX21_USBOTG_BASE_ADDR,
  573. .end = MX21_USBOTG_BASE_ADDR + SZ_8K - 1,
  574. .flags = IORESOURCE_MEM,
  575. },
  576. {
  577. .start = MX21_INT_USBHOST,
  578. .end = MX21_INT_USBHOST,
  579. .flags = IORESOURCE_IRQ,
  580. },
  581. };
  582. struct platform_device mx21_usbhc_device = {
  583. .name = "imx21-hcd",
  584. .id = 0,
  585. .dev = {
  586. .dma_mask = &mx21_usbhc_device.dev.coherent_dma_mask,
  587. .coherent_dma_mask = DMA_BIT_MASK(32),
  588. },
  589. .num_resources = ARRAY_SIZE(mx21_usbhc_resources),
  590. .resource = mx21_usbhc_resources,
  591. };
  592. #endif
  593. #endif