device.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690
  1. /*
  2. * device.c -- common ColdFire SoC device support
  3. *
  4. * (C) Copyright 2011, Greg Ungerer <[email protected]>
  5. *
  6. * This file is subject to the terms and conditions of the GNU General Public
  7. * License. See the file COPYING in the main directory of this archive
  8. * for more details.
  9. */
  10. #include <linux/kernel.h>
  11. #include <linux/init.h>
  12. #include <linux/io.h>
  13. #include <linux/spi/spi.h>
  14. #include <linux/gpio.h>
  15. #include <linux/fec.h>
  16. #include <linux/dmaengine.h>
  17. #include <asm/traps.h>
  18. #include <asm/coldfire.h>
  19. #include <asm/mcfsim.h>
  20. #include <asm/mcfuart.h>
  21. #include <asm/mcfqspi.h>
  22. #include <linux/platform_data/edma.h>
  23. #include <linux/platform_data/dma-mcf-edma.h>
  24. #include <linux/platform_data/mmc-esdhc-mcf.h>
  25. /*
  26. * All current ColdFire parts contain from 2, 3, 4 or 10 UARTS.
  27. */
  28. static struct mcf_platform_uart mcf_uart_platform_data[] = {
  29. {
  30. .mapbase = MCFUART_BASE0,
  31. .irq = MCF_IRQ_UART0,
  32. },
  33. {
  34. .mapbase = MCFUART_BASE1,
  35. .irq = MCF_IRQ_UART1,
  36. },
  37. #ifdef MCFUART_BASE2
  38. {
  39. .mapbase = MCFUART_BASE2,
  40. .irq = MCF_IRQ_UART2,
  41. },
  42. #endif
  43. #ifdef MCFUART_BASE3
  44. {
  45. .mapbase = MCFUART_BASE3,
  46. .irq = MCF_IRQ_UART3,
  47. },
  48. #endif
  49. #ifdef MCFUART_BASE4
  50. {
  51. .mapbase = MCFUART_BASE4,
  52. .irq = MCF_IRQ_UART4,
  53. },
  54. #endif
  55. #ifdef MCFUART_BASE5
  56. {
  57. .mapbase = MCFUART_BASE5,
  58. .irq = MCF_IRQ_UART5,
  59. },
  60. #endif
  61. #ifdef MCFUART_BASE6
  62. {
  63. .mapbase = MCFUART_BASE6,
  64. .irq = MCF_IRQ_UART6,
  65. },
  66. #endif
  67. #ifdef MCFUART_BASE7
  68. {
  69. .mapbase = MCFUART_BASE7,
  70. .irq = MCF_IRQ_UART7,
  71. },
  72. #endif
  73. #ifdef MCFUART_BASE8
  74. {
  75. .mapbase = MCFUART_BASE8,
  76. .irq = MCF_IRQ_UART8,
  77. },
  78. #endif
  79. #ifdef MCFUART_BASE9
  80. {
  81. .mapbase = MCFUART_BASE9,
  82. .irq = MCF_IRQ_UART9,
  83. },
  84. #endif
  85. { },
  86. };
  87. static struct platform_device mcf_uart = {
  88. .name = "mcfuart",
  89. .id = 0,
  90. .dev.platform_data = mcf_uart_platform_data,
  91. };
  92. #if IS_ENABLED(CONFIG_FEC)
  93. #ifdef CONFIG_M5441x
  94. #define FEC_NAME "enet-fec"
  95. static struct fec_platform_data fec_pdata = {
  96. .phy = PHY_INTERFACE_MODE_RMII,
  97. };
  98. #define FEC_PDATA (&fec_pdata)
  99. #else
  100. #define FEC_NAME "fec"
  101. #define FEC_PDATA NULL
  102. #endif
  103. /*
  104. * Some ColdFire cores contain the Fast Ethernet Controller (FEC)
  105. * block. It is Freescale's own hardware block. Some ColdFires
  106. * have 2 of these.
  107. */
  108. static struct resource mcf_fec0_resources[] = {
  109. {
  110. .start = MCFFEC_BASE0,
  111. .end = MCFFEC_BASE0 + MCFFEC_SIZE0 - 1,
  112. .flags = IORESOURCE_MEM,
  113. },
  114. {
  115. .start = MCF_IRQ_FECRX0,
  116. .end = MCF_IRQ_FECRX0,
  117. .flags = IORESOURCE_IRQ,
  118. },
  119. {
  120. .start = MCF_IRQ_FECTX0,
  121. .end = MCF_IRQ_FECTX0,
  122. .flags = IORESOURCE_IRQ,
  123. },
  124. {
  125. .start = MCF_IRQ_FECENTC0,
  126. .end = MCF_IRQ_FECENTC0,
  127. .flags = IORESOURCE_IRQ,
  128. },
  129. };
  130. static struct platform_device mcf_fec0 = {
  131. .name = FEC_NAME,
  132. .id = 0,
  133. .num_resources = ARRAY_SIZE(mcf_fec0_resources),
  134. .resource = mcf_fec0_resources,
  135. .dev = {
  136. .dma_mask = &mcf_fec0.dev.coherent_dma_mask,
  137. .coherent_dma_mask = DMA_BIT_MASK(32),
  138. .platform_data = FEC_PDATA,
  139. }
  140. };
  141. #ifdef MCFFEC_BASE1
  142. static struct resource mcf_fec1_resources[] = {
  143. {
  144. .start = MCFFEC_BASE1,
  145. .end = MCFFEC_BASE1 + MCFFEC_SIZE1 - 1,
  146. .flags = IORESOURCE_MEM,
  147. },
  148. {
  149. .start = MCF_IRQ_FECRX1,
  150. .end = MCF_IRQ_FECRX1,
  151. .flags = IORESOURCE_IRQ,
  152. },
  153. {
  154. .start = MCF_IRQ_FECTX1,
  155. .end = MCF_IRQ_FECTX1,
  156. .flags = IORESOURCE_IRQ,
  157. },
  158. {
  159. .start = MCF_IRQ_FECENTC1,
  160. .end = MCF_IRQ_FECENTC1,
  161. .flags = IORESOURCE_IRQ,
  162. },
  163. };
  164. static struct platform_device mcf_fec1 = {
  165. .name = FEC_NAME,
  166. .id = 1,
  167. .num_resources = ARRAY_SIZE(mcf_fec1_resources),
  168. .resource = mcf_fec1_resources,
  169. .dev = {
  170. .dma_mask = &mcf_fec1.dev.coherent_dma_mask,
  171. .coherent_dma_mask = DMA_BIT_MASK(32),
  172. .platform_data = FEC_PDATA,
  173. }
  174. };
  175. #endif /* MCFFEC_BASE1 */
  176. #endif /* CONFIG_FEC */
  177. #if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
  178. /*
  179. * The ColdFire QSPI module is an SPI protocol hardware block used
  180. * on a number of different ColdFire CPUs.
  181. */
  182. static struct resource mcf_qspi_resources[] = {
  183. {
  184. .start = MCFQSPI_BASE,
  185. .end = MCFQSPI_BASE + MCFQSPI_SIZE - 1,
  186. .flags = IORESOURCE_MEM,
  187. },
  188. {
  189. .start = MCF_IRQ_QSPI,
  190. .end = MCF_IRQ_QSPI,
  191. .flags = IORESOURCE_IRQ,
  192. },
  193. };
  194. static int mcf_cs_setup(struct mcfqspi_cs_control *cs_control)
  195. {
  196. int status;
  197. status = gpio_request(MCFQSPI_CS0, "MCFQSPI_CS0");
  198. if (status) {
  199. pr_debug("gpio_request for MCFQSPI_CS0 failed\n");
  200. goto fail0;
  201. }
  202. status = gpio_direction_output(MCFQSPI_CS0, 1);
  203. if (status) {
  204. pr_debug("gpio_direction_output for MCFQSPI_CS0 failed\n");
  205. goto fail1;
  206. }
  207. status = gpio_request(MCFQSPI_CS1, "MCFQSPI_CS1");
  208. if (status) {
  209. pr_debug("gpio_request for MCFQSPI_CS1 failed\n");
  210. goto fail1;
  211. }
  212. status = gpio_direction_output(MCFQSPI_CS1, 1);
  213. if (status) {
  214. pr_debug("gpio_direction_output for MCFQSPI_CS1 failed\n");
  215. goto fail2;
  216. }
  217. status = gpio_request(MCFQSPI_CS2, "MCFQSPI_CS2");
  218. if (status) {
  219. pr_debug("gpio_request for MCFQSPI_CS2 failed\n");
  220. goto fail2;
  221. }
  222. status = gpio_direction_output(MCFQSPI_CS2, 1);
  223. if (status) {
  224. pr_debug("gpio_direction_output for MCFQSPI_CS2 failed\n");
  225. goto fail3;
  226. }
  227. #ifdef MCFQSPI_CS3
  228. status = gpio_request(MCFQSPI_CS3, "MCFQSPI_CS3");
  229. if (status) {
  230. pr_debug("gpio_request for MCFQSPI_CS3 failed\n");
  231. goto fail3;
  232. }
  233. status = gpio_direction_output(MCFQSPI_CS3, 1);
  234. if (status) {
  235. pr_debug("gpio_direction_output for MCFQSPI_CS3 failed\n");
  236. gpio_free(MCFQSPI_CS3);
  237. goto fail3;
  238. }
  239. #endif
  240. return 0;
  241. fail3:
  242. gpio_free(MCFQSPI_CS2);
  243. fail2:
  244. gpio_free(MCFQSPI_CS1);
  245. fail1:
  246. gpio_free(MCFQSPI_CS0);
  247. fail0:
  248. return status;
  249. }
  250. static void mcf_cs_teardown(struct mcfqspi_cs_control *cs_control)
  251. {
  252. #ifdef MCFQSPI_CS3
  253. gpio_free(MCFQSPI_CS3);
  254. #endif
  255. gpio_free(MCFQSPI_CS2);
  256. gpio_free(MCFQSPI_CS1);
  257. gpio_free(MCFQSPI_CS0);
  258. }
  259. static void mcf_cs_select(struct mcfqspi_cs_control *cs_control,
  260. u8 chip_select, bool cs_high)
  261. {
  262. switch (chip_select) {
  263. case 0:
  264. gpio_set_value(MCFQSPI_CS0, cs_high);
  265. break;
  266. case 1:
  267. gpio_set_value(MCFQSPI_CS1, cs_high);
  268. break;
  269. case 2:
  270. gpio_set_value(MCFQSPI_CS2, cs_high);
  271. break;
  272. #ifdef MCFQSPI_CS3
  273. case 3:
  274. gpio_set_value(MCFQSPI_CS3, cs_high);
  275. break;
  276. #endif
  277. }
  278. }
  279. static void mcf_cs_deselect(struct mcfqspi_cs_control *cs_control,
  280. u8 chip_select, bool cs_high)
  281. {
  282. switch (chip_select) {
  283. case 0:
  284. gpio_set_value(MCFQSPI_CS0, !cs_high);
  285. break;
  286. case 1:
  287. gpio_set_value(MCFQSPI_CS1, !cs_high);
  288. break;
  289. case 2:
  290. gpio_set_value(MCFQSPI_CS2, !cs_high);
  291. break;
  292. #ifdef MCFQSPI_CS3
  293. case 3:
  294. gpio_set_value(MCFQSPI_CS3, !cs_high);
  295. break;
  296. #endif
  297. }
  298. }
  299. static struct mcfqspi_cs_control mcf_cs_control = {
  300. .setup = mcf_cs_setup,
  301. .teardown = mcf_cs_teardown,
  302. .select = mcf_cs_select,
  303. .deselect = mcf_cs_deselect,
  304. };
  305. static struct mcfqspi_platform_data mcf_qspi_data = {
  306. .bus_num = 0,
  307. .num_chipselect = 4,
  308. .cs_control = &mcf_cs_control,
  309. };
  310. static struct platform_device mcf_qspi = {
  311. .name = "mcfqspi",
  312. .id = 0,
  313. .num_resources = ARRAY_SIZE(mcf_qspi_resources),
  314. .resource = mcf_qspi_resources,
  315. .dev.platform_data = &mcf_qspi_data,
  316. };
  317. #endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */
  318. #if IS_ENABLED(CONFIG_I2C_IMX)
  319. static struct resource mcf_i2c0_resources[] = {
  320. {
  321. .start = MCFI2C_BASE0,
  322. .end = MCFI2C_BASE0 + MCFI2C_SIZE0 - 1,
  323. .flags = IORESOURCE_MEM,
  324. },
  325. {
  326. .start = MCF_IRQ_I2C0,
  327. .end = MCF_IRQ_I2C0,
  328. .flags = IORESOURCE_IRQ,
  329. },
  330. };
  331. static struct platform_device mcf_i2c0 = {
  332. .name = "imx1-i2c",
  333. .id = 0,
  334. .num_resources = ARRAY_SIZE(mcf_i2c0_resources),
  335. .resource = mcf_i2c0_resources,
  336. };
  337. #ifdef MCFI2C_BASE1
  338. static struct resource mcf_i2c1_resources[] = {
  339. {
  340. .start = MCFI2C_BASE1,
  341. .end = MCFI2C_BASE1 + MCFI2C_SIZE1 - 1,
  342. .flags = IORESOURCE_MEM,
  343. },
  344. {
  345. .start = MCF_IRQ_I2C1,
  346. .end = MCF_IRQ_I2C1,
  347. .flags = IORESOURCE_IRQ,
  348. },
  349. };
  350. static struct platform_device mcf_i2c1 = {
  351. .name = "imx1-i2c",
  352. .id = 1,
  353. .num_resources = ARRAY_SIZE(mcf_i2c1_resources),
  354. .resource = mcf_i2c1_resources,
  355. };
  356. #endif /* MCFI2C_BASE1 */
  357. #ifdef MCFI2C_BASE2
  358. static struct resource mcf_i2c2_resources[] = {
  359. {
  360. .start = MCFI2C_BASE2,
  361. .end = MCFI2C_BASE2 + MCFI2C_SIZE2 - 1,
  362. .flags = IORESOURCE_MEM,
  363. },
  364. {
  365. .start = MCF_IRQ_I2C2,
  366. .end = MCF_IRQ_I2C2,
  367. .flags = IORESOURCE_IRQ,
  368. },
  369. };
  370. static struct platform_device mcf_i2c2 = {
  371. .name = "imx1-i2c",
  372. .id = 2,
  373. .num_resources = ARRAY_SIZE(mcf_i2c2_resources),
  374. .resource = mcf_i2c2_resources,
  375. };
  376. #endif /* MCFI2C_BASE2 */
  377. #ifdef MCFI2C_BASE3
  378. static struct resource mcf_i2c3_resources[] = {
  379. {
  380. .start = MCFI2C_BASE3,
  381. .end = MCFI2C_BASE3 + MCFI2C_SIZE3 - 1,
  382. .flags = IORESOURCE_MEM,
  383. },
  384. {
  385. .start = MCF_IRQ_I2C3,
  386. .end = MCF_IRQ_I2C3,
  387. .flags = IORESOURCE_IRQ,
  388. },
  389. };
  390. static struct platform_device mcf_i2c3 = {
  391. .name = "imx1-i2c",
  392. .id = 3,
  393. .num_resources = ARRAY_SIZE(mcf_i2c3_resources),
  394. .resource = mcf_i2c3_resources,
  395. };
  396. #endif /* MCFI2C_BASE3 */
  397. #ifdef MCFI2C_BASE4
  398. static struct resource mcf_i2c4_resources[] = {
  399. {
  400. .start = MCFI2C_BASE4,
  401. .end = MCFI2C_BASE4 + MCFI2C_SIZE4 - 1,
  402. .flags = IORESOURCE_MEM,
  403. },
  404. {
  405. .start = MCF_IRQ_I2C4,
  406. .end = MCF_IRQ_I2C4,
  407. .flags = IORESOURCE_IRQ,
  408. },
  409. };
  410. static struct platform_device mcf_i2c4 = {
  411. .name = "imx1-i2c",
  412. .id = 4,
  413. .num_resources = ARRAY_SIZE(mcf_i2c4_resources),
  414. .resource = mcf_i2c4_resources,
  415. };
  416. #endif /* MCFI2C_BASE4 */
  417. #ifdef MCFI2C_BASE5
  418. static struct resource mcf_i2c5_resources[] = {
  419. {
  420. .start = MCFI2C_BASE5,
  421. .end = MCFI2C_BASE5 + MCFI2C_SIZE5 - 1,
  422. .flags = IORESOURCE_MEM,
  423. },
  424. {
  425. .start = MCF_IRQ_I2C5,
  426. .end = MCF_IRQ_I2C5,
  427. .flags = IORESOURCE_IRQ,
  428. },
  429. };
  430. static struct platform_device mcf_i2c5 = {
  431. .name = "imx1-i2c",
  432. .id = 5,
  433. .num_resources = ARRAY_SIZE(mcf_i2c5_resources),
  434. .resource = mcf_i2c5_resources,
  435. };
  436. #endif /* MCFI2C_BASE5 */
  437. #endif /* IS_ENABLED(CONFIG_I2C_IMX) */
  438. #ifdef MCFEDMA_BASE
  439. static const struct dma_slave_map mcf_edma_map[] = {
  440. { "dreq0", "rx-tx", MCF_EDMA_FILTER_PARAM(0) },
  441. { "dreq1", "rx-tx", MCF_EDMA_FILTER_PARAM(1) },
  442. { "uart.0", "rx", MCF_EDMA_FILTER_PARAM(2) },
  443. { "uart.0", "tx", MCF_EDMA_FILTER_PARAM(3) },
  444. { "uart.1", "rx", MCF_EDMA_FILTER_PARAM(4) },
  445. { "uart.1", "tx", MCF_EDMA_FILTER_PARAM(5) },
  446. { "uart.2", "rx", MCF_EDMA_FILTER_PARAM(6) },
  447. { "uart.2", "tx", MCF_EDMA_FILTER_PARAM(7) },
  448. { "timer0", "rx-tx", MCF_EDMA_FILTER_PARAM(8) },
  449. { "timer1", "rx-tx", MCF_EDMA_FILTER_PARAM(9) },
  450. { "timer2", "rx-tx", MCF_EDMA_FILTER_PARAM(10) },
  451. { "timer3", "rx-tx", MCF_EDMA_FILTER_PARAM(11) },
  452. { "fsl-dspi.0", "rx", MCF_EDMA_FILTER_PARAM(12) },
  453. { "fsl-dspi.0", "tx", MCF_EDMA_FILTER_PARAM(13) },
  454. { "fsl-dspi.1", "rx", MCF_EDMA_FILTER_PARAM(14) },
  455. { "fsl-dspi.1", "tx", MCF_EDMA_FILTER_PARAM(15) },
  456. };
  457. static struct mcf_edma_platform_data mcf_edma_data = {
  458. .dma_channels = 64,
  459. .slave_map = mcf_edma_map,
  460. .slavecnt = ARRAY_SIZE(mcf_edma_map),
  461. };
  462. static struct resource mcf_edma_resources[] = {
  463. {
  464. .start = MCFEDMA_BASE,
  465. .end = MCFEDMA_BASE + MCFEDMA_SIZE - 1,
  466. .flags = IORESOURCE_MEM,
  467. },
  468. {
  469. .start = MCFEDMA_IRQ_INTR0,
  470. .end = MCFEDMA_IRQ_INTR0 + 15,
  471. .flags = IORESOURCE_IRQ,
  472. .name = "edma-tx-00-15",
  473. },
  474. {
  475. .start = MCFEDMA_IRQ_INTR16,
  476. .end = MCFEDMA_IRQ_INTR16 + 39,
  477. .flags = IORESOURCE_IRQ,
  478. .name = "edma-tx-16-55",
  479. },
  480. {
  481. .start = MCFEDMA_IRQ_INTR56,
  482. .end = MCFEDMA_IRQ_INTR56,
  483. .flags = IORESOURCE_IRQ,
  484. .name = "edma-tx-56-63",
  485. },
  486. {
  487. .start = MCFEDMA_IRQ_ERR,
  488. .end = MCFEDMA_IRQ_ERR,
  489. .flags = IORESOURCE_IRQ,
  490. .name = "edma-err",
  491. },
  492. };
  493. static u64 mcf_edma_dmamask = DMA_BIT_MASK(32);
  494. static struct platform_device mcf_edma = {
  495. .name = "mcf-edma",
  496. .id = 0,
  497. .num_resources = ARRAY_SIZE(mcf_edma_resources),
  498. .resource = mcf_edma_resources,
  499. .dev = {
  500. .dma_mask = &mcf_edma_dmamask,
  501. .coherent_dma_mask = DMA_BIT_MASK(32),
  502. .platform_data = &mcf_edma_data,
  503. }
  504. };
  505. #endif /* MCFEDMA_BASE */
  506. #ifdef MCFSDHC_BASE
  507. static struct mcf_esdhc_platform_data mcf_esdhc_data = {
  508. .max_bus_width = 4,
  509. .cd_type = ESDHC_CD_NONE,
  510. };
  511. static struct resource mcf_esdhc_resources[] = {
  512. {
  513. .start = MCFSDHC_BASE,
  514. .end = MCFSDHC_BASE + MCFSDHC_SIZE - 1,
  515. .flags = IORESOURCE_MEM,
  516. }, {
  517. .start = MCF_IRQ_SDHC,
  518. .end = MCF_IRQ_SDHC,
  519. .flags = IORESOURCE_IRQ,
  520. },
  521. };
  522. static struct platform_device mcf_esdhc = {
  523. .name = "sdhci-esdhc-mcf",
  524. .id = 0,
  525. .num_resources = ARRAY_SIZE(mcf_esdhc_resources),
  526. .resource = mcf_esdhc_resources,
  527. .dev.platform_data = &mcf_esdhc_data,
  528. };
  529. #endif /* MCFSDHC_BASE */
  530. #ifdef MCFFLEXCAN_SIZE
  531. #include <linux/can/platform/flexcan.h>
  532. static struct flexcan_platform_data mcf5441x_flexcan_info = {
  533. .clk_src = 1,
  534. .clock_frequency = 120000000,
  535. };
  536. static struct resource mcf5441x_flexcan0_resource[] = {
  537. {
  538. .start = MCFFLEXCAN_BASE0,
  539. .end = MCFFLEXCAN_BASE0 + MCFFLEXCAN_SIZE,
  540. .flags = IORESOURCE_MEM,
  541. },
  542. {
  543. .start = MCF_IRQ_IFL0,
  544. .end = MCF_IRQ_IFL0,
  545. .flags = IORESOURCE_IRQ,
  546. },
  547. {
  548. .start = MCF_IRQ_BOFF0,
  549. .end = MCF_IRQ_BOFF0,
  550. .flags = IORESOURCE_IRQ,
  551. },
  552. {
  553. .start = MCF_IRQ_ERR0,
  554. .end = MCF_IRQ_ERR0,
  555. .flags = IORESOURCE_IRQ,
  556. },
  557. };
  558. static struct platform_device mcf_flexcan0 = {
  559. .name = "flexcan-mcf5441x",
  560. .id = 0,
  561. .num_resources = ARRAY_SIZE(mcf5441x_flexcan0_resource),
  562. .resource = mcf5441x_flexcan0_resource,
  563. .dev.platform_data = &mcf5441x_flexcan_info,
  564. };
  565. #endif /* MCFFLEXCAN_SIZE */
  566. static struct platform_device *mcf_devices[] __initdata = {
  567. &mcf_uart,
  568. #if IS_ENABLED(CONFIG_FEC)
  569. &mcf_fec0,
  570. #ifdef MCFFEC_BASE1
  571. &mcf_fec1,
  572. #endif
  573. #endif
  574. #if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
  575. &mcf_qspi,
  576. #endif
  577. #if IS_ENABLED(CONFIG_I2C_IMX)
  578. &mcf_i2c0,
  579. #ifdef MCFI2C_BASE1
  580. &mcf_i2c1,
  581. #endif
  582. #ifdef MCFI2C_BASE2
  583. &mcf_i2c2,
  584. #endif
  585. #ifdef MCFI2C_BASE3
  586. &mcf_i2c3,
  587. #endif
  588. #ifdef MCFI2C_BASE4
  589. &mcf_i2c4,
  590. #endif
  591. #ifdef MCFI2C_BASE5
  592. &mcf_i2c5,
  593. #endif
  594. #endif
  595. #ifdef MCFEDMA_BASE
  596. &mcf_edma,
  597. #endif
  598. #ifdef MCFSDHC_BASE
  599. &mcf_esdhc,
  600. #endif
  601. #ifdef MCFFLEXCAN_SIZE
  602. &mcf_flexcan0,
  603. #endif
  604. };
  605. /*
  606. * Some ColdFire UARTs let you set the IRQ line to use.
  607. */
  608. static void __init mcf_uart_set_irq(void)
  609. {
  610. #ifdef MCFUART_UIVR
  611. /* UART0 interrupt setup */
  612. writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCFSIM_UART1ICR);
  613. writeb(MCF_IRQ_UART0, MCFUART_BASE0 + MCFUART_UIVR);
  614. mcf_mapirq2imr(MCF_IRQ_UART0, MCFINTC_UART0);
  615. /* UART1 interrupt setup */
  616. writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCFSIM_UART2ICR);
  617. writeb(MCF_IRQ_UART1, MCFUART_BASE1 + MCFUART_UIVR);
  618. mcf_mapirq2imr(MCF_IRQ_UART1, MCFINTC_UART1);
  619. #endif
  620. }
  621. static int __init mcf_init_devices(void)
  622. {
  623. mcf_uart_set_irq();
  624. platform_add_devices(mcf_devices, ARRAY_SIZE(mcf_devices));
  625. return 0;
  626. }
  627. arch_initcall(mcf_init_devices);