dm646x.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708
  1. /*
  2. * TI DaVinci DM644x chip specific setup
  3. *
  4. * Author: Kevin Hilman, Deep Root Systems, LLC
  5. *
  6. * 2007 (c) Deep Root Systems, LLC. This file is licensed under
  7. * the terms of the GNU General Public License version 2. This program
  8. * is licensed "as is" without any warranty of any kind, whether express
  9. * or implied.
  10. */
  11. #include <linux/clk-provider.h>
  12. #include <linux/clk/davinci.h>
  13. #include <linux/clkdev.h>
  14. #include <linux/dma-mapping.h>
  15. #include <linux/dmaengine.h>
  16. #include <linux/init.h>
  17. #include <linux/platform_data/edma.h>
  18. #include <linux/platform_data/gpio-davinci.h>
  19. #include <linux/platform_device.h>
  20. #include <linux/serial_8250.h>
  21. #include <asm/mach/map.h>
  22. #include <mach/common.h>
  23. #include <mach/cputype.h>
  24. #include <mach/irqs.h>
  25. #include <mach/mux.h>
  26. #include <mach/serial.h>
  27. #include <mach/time.h>
  28. #include "asp.h"
  29. #include "davinci.h"
  30. #include "mux.h"
  31. #define DAVINCI_VPIF_BASE (0x01C12000)
  32. #define VDD3P3V_VID_MASK (BIT_MASK(3) | BIT_MASK(2) | BIT_MASK(1) |\
  33. BIT_MASK(0))
  34. #define VSCLKDIS_MASK (BIT_MASK(11) | BIT_MASK(10) | BIT_MASK(9) |\
  35. BIT_MASK(8))
  36. #define DM646X_EMAC_BASE 0x01c80000
  37. #define DM646X_EMAC_MDIO_BASE (DM646X_EMAC_BASE + 0x4000)
  38. #define DM646X_EMAC_CNTRL_OFFSET 0x0000
  39. #define DM646X_EMAC_CNTRL_MOD_OFFSET 0x1000
  40. #define DM646X_EMAC_CNTRL_RAM_OFFSET 0x2000
  41. #define DM646X_EMAC_CNTRL_RAM_SIZE 0x2000
  42. static struct emac_platform_data dm646x_emac_pdata = {
  43. .ctrl_reg_offset = DM646X_EMAC_CNTRL_OFFSET,
  44. .ctrl_mod_reg_offset = DM646X_EMAC_CNTRL_MOD_OFFSET,
  45. .ctrl_ram_offset = DM646X_EMAC_CNTRL_RAM_OFFSET,
  46. .ctrl_ram_size = DM646X_EMAC_CNTRL_RAM_SIZE,
  47. .version = EMAC_VERSION_2,
  48. };
  49. static struct resource dm646x_emac_resources[] = {
  50. {
  51. .start = DM646X_EMAC_BASE,
  52. .end = DM646X_EMAC_BASE + SZ_16K - 1,
  53. .flags = IORESOURCE_MEM,
  54. },
  55. {
  56. .start = IRQ_DM646X_EMACRXTHINT,
  57. .end = IRQ_DM646X_EMACRXTHINT,
  58. .flags = IORESOURCE_IRQ,
  59. },
  60. {
  61. .start = IRQ_DM646X_EMACRXINT,
  62. .end = IRQ_DM646X_EMACRXINT,
  63. .flags = IORESOURCE_IRQ,
  64. },
  65. {
  66. .start = IRQ_DM646X_EMACTXINT,
  67. .end = IRQ_DM646X_EMACTXINT,
  68. .flags = IORESOURCE_IRQ,
  69. },
  70. {
  71. .start = IRQ_DM646X_EMACMISCINT,
  72. .end = IRQ_DM646X_EMACMISCINT,
  73. .flags = IORESOURCE_IRQ,
  74. },
  75. };
  76. static struct platform_device dm646x_emac_device = {
  77. .name = "davinci_emac",
  78. .id = 1,
  79. .dev = {
  80. .platform_data = &dm646x_emac_pdata,
  81. },
  82. .num_resources = ARRAY_SIZE(dm646x_emac_resources),
  83. .resource = dm646x_emac_resources,
  84. };
  85. static struct resource dm646x_mdio_resources[] = {
  86. {
  87. .start = DM646X_EMAC_MDIO_BASE,
  88. .end = DM646X_EMAC_MDIO_BASE + SZ_4K - 1,
  89. .flags = IORESOURCE_MEM,
  90. },
  91. };
  92. static struct platform_device dm646x_mdio_device = {
  93. .name = "davinci_mdio",
  94. .id = 0,
  95. .num_resources = ARRAY_SIZE(dm646x_mdio_resources),
  96. .resource = dm646x_mdio_resources,
  97. };
  98. /*
  99. * Device specific mux setup
  100. *
  101. * soc description mux mode mode mux dbg
  102. * reg offset mask mode
  103. */
  104. static const struct mux_config dm646x_pins[] = {
  105. #ifdef CONFIG_DAVINCI_MUX
  106. MUX_CFG(DM646X, ATAEN, 0, 0, 5, 1, true)
  107. MUX_CFG(DM646X, AUDCK1, 0, 29, 1, 0, false)
  108. MUX_CFG(DM646X, AUDCK0, 0, 28, 1, 0, false)
  109. MUX_CFG(DM646X, CRGMUX, 0, 24, 7, 5, true)
  110. MUX_CFG(DM646X, STSOMUX_DISABLE, 0, 22, 3, 0, true)
  111. MUX_CFG(DM646X, STSIMUX_DISABLE, 0, 20, 3, 0, true)
  112. MUX_CFG(DM646X, PTSOMUX_DISABLE, 0, 18, 3, 0, true)
  113. MUX_CFG(DM646X, PTSIMUX_DISABLE, 0, 16, 3, 0, true)
  114. MUX_CFG(DM646X, STSOMUX, 0, 22, 3, 2, true)
  115. MUX_CFG(DM646X, STSIMUX, 0, 20, 3, 2, true)
  116. MUX_CFG(DM646X, PTSOMUX_PARALLEL, 0, 18, 3, 2, true)
  117. MUX_CFG(DM646X, PTSIMUX_PARALLEL, 0, 16, 3, 2, true)
  118. MUX_CFG(DM646X, PTSOMUX_SERIAL, 0, 18, 3, 3, true)
  119. MUX_CFG(DM646X, PTSIMUX_SERIAL, 0, 16, 3, 3, true)
  120. #endif
  121. };
  122. static u8 dm646x_default_priorities[DAVINCI_N_AINTC_IRQ] = {
  123. [IRQ_DM646X_VP_VERTINT0] = 7,
  124. [IRQ_DM646X_VP_VERTINT1] = 7,
  125. [IRQ_DM646X_VP_VERTINT2] = 7,
  126. [IRQ_DM646X_VP_VERTINT3] = 7,
  127. [IRQ_DM646X_VP_ERRINT] = 7,
  128. [IRQ_DM646X_RESERVED_1] = 7,
  129. [IRQ_DM646X_RESERVED_2] = 7,
  130. [IRQ_DM646X_WDINT] = 7,
  131. [IRQ_DM646X_CRGENINT0] = 7,
  132. [IRQ_DM646X_CRGENINT1] = 7,
  133. [IRQ_DM646X_TSIFINT0] = 7,
  134. [IRQ_DM646X_TSIFINT1] = 7,
  135. [IRQ_DM646X_VDCEINT] = 7,
  136. [IRQ_DM646X_USBINT] = 7,
  137. [IRQ_DM646X_USBDMAINT] = 7,
  138. [IRQ_DM646X_PCIINT] = 7,
  139. [IRQ_CCINT0] = 7, /* dma */
  140. [IRQ_CCERRINT] = 7, /* dma */
  141. [IRQ_TCERRINT0] = 7, /* dma */
  142. [IRQ_TCERRINT] = 7, /* dma */
  143. [IRQ_DM646X_TCERRINT2] = 7,
  144. [IRQ_DM646X_TCERRINT3] = 7,
  145. [IRQ_DM646X_IDE] = 7,
  146. [IRQ_DM646X_HPIINT] = 7,
  147. [IRQ_DM646X_EMACRXTHINT] = 7,
  148. [IRQ_DM646X_EMACRXINT] = 7,
  149. [IRQ_DM646X_EMACTXINT] = 7,
  150. [IRQ_DM646X_EMACMISCINT] = 7,
  151. [IRQ_DM646X_MCASP0TXINT] = 7,
  152. [IRQ_DM646X_MCASP0RXINT] = 7,
  153. [IRQ_DM646X_RESERVED_3] = 7,
  154. [IRQ_DM646X_MCASP1TXINT] = 7,
  155. [IRQ_TINT0_TINT12] = 7, /* clockevent */
  156. [IRQ_TINT0_TINT34] = 7, /* clocksource */
  157. [IRQ_TINT1_TINT12] = 7, /* DSP timer */
  158. [IRQ_TINT1_TINT34] = 7, /* system tick */
  159. [IRQ_PWMINT0] = 7,
  160. [IRQ_PWMINT1] = 7,
  161. [IRQ_DM646X_VLQINT] = 7,
  162. [IRQ_I2C] = 7,
  163. [IRQ_UARTINT0] = 7,
  164. [IRQ_UARTINT1] = 7,
  165. [IRQ_DM646X_UARTINT2] = 7,
  166. [IRQ_DM646X_SPINT0] = 7,
  167. [IRQ_DM646X_SPINT1] = 7,
  168. [IRQ_DM646X_DSP2ARMINT] = 7,
  169. [IRQ_DM646X_RESERVED_4] = 7,
  170. [IRQ_DM646X_PSCINT] = 7,
  171. [IRQ_DM646X_GPIO0] = 7,
  172. [IRQ_DM646X_GPIO1] = 7,
  173. [IRQ_DM646X_GPIO2] = 7,
  174. [IRQ_DM646X_GPIO3] = 7,
  175. [IRQ_DM646X_GPIO4] = 7,
  176. [IRQ_DM646X_GPIO5] = 7,
  177. [IRQ_DM646X_GPIO6] = 7,
  178. [IRQ_DM646X_GPIO7] = 7,
  179. [IRQ_DM646X_GPIOBNK0] = 7,
  180. [IRQ_DM646X_GPIOBNK1] = 7,
  181. [IRQ_DM646X_GPIOBNK2] = 7,
  182. [IRQ_DM646X_DDRINT] = 7,
  183. [IRQ_DM646X_AEMIFINT] = 7,
  184. [IRQ_COMMTX] = 7,
  185. [IRQ_COMMRX] = 7,
  186. [IRQ_EMUINT] = 7,
  187. };
  188. /*----------------------------------------------------------------------*/
  189. /* Four Transfer Controllers on DM646x */
  190. static s8 dm646x_queue_priority_mapping[][2] = {
  191. /* {event queue no, Priority} */
  192. {0, 4},
  193. {1, 0},
  194. {2, 5},
  195. {3, 1},
  196. {-1, -1},
  197. };
  198. static const struct dma_slave_map dm646x_edma_map[] = {
  199. { "davinci-mcasp.0", "tx", EDMA_FILTER_PARAM(0, 6) },
  200. { "davinci-mcasp.0", "rx", EDMA_FILTER_PARAM(0, 9) },
  201. { "davinci-mcasp.1", "tx", EDMA_FILTER_PARAM(0, 12) },
  202. { "spi_davinci", "tx", EDMA_FILTER_PARAM(0, 16) },
  203. { "spi_davinci", "rx", EDMA_FILTER_PARAM(0, 17) },
  204. };
  205. static struct edma_soc_info dm646x_edma_pdata = {
  206. .queue_priority_mapping = dm646x_queue_priority_mapping,
  207. .default_queue = EVENTQ_1,
  208. .slave_map = dm646x_edma_map,
  209. .slavecnt = ARRAY_SIZE(dm646x_edma_map),
  210. };
  211. static struct resource edma_resources[] = {
  212. {
  213. .name = "edma3_cc",
  214. .start = 0x01c00000,
  215. .end = 0x01c00000 + SZ_64K - 1,
  216. .flags = IORESOURCE_MEM,
  217. },
  218. {
  219. .name = "edma3_tc0",
  220. .start = 0x01c10000,
  221. .end = 0x01c10000 + SZ_1K - 1,
  222. .flags = IORESOURCE_MEM,
  223. },
  224. {
  225. .name = "edma3_tc1",
  226. .start = 0x01c10400,
  227. .end = 0x01c10400 + SZ_1K - 1,
  228. .flags = IORESOURCE_MEM,
  229. },
  230. {
  231. .name = "edma3_tc2",
  232. .start = 0x01c10800,
  233. .end = 0x01c10800 + SZ_1K - 1,
  234. .flags = IORESOURCE_MEM,
  235. },
  236. {
  237. .name = "edma3_tc3",
  238. .start = 0x01c10c00,
  239. .end = 0x01c10c00 + SZ_1K - 1,
  240. .flags = IORESOURCE_MEM,
  241. },
  242. {
  243. .name = "edma3_ccint",
  244. .start = IRQ_CCINT0,
  245. .flags = IORESOURCE_IRQ,
  246. },
  247. {
  248. .name = "edma3_ccerrint",
  249. .start = IRQ_CCERRINT,
  250. .flags = IORESOURCE_IRQ,
  251. },
  252. /* not using TC*_ERR */
  253. };
  254. static const struct platform_device_info dm646x_edma_device __initconst = {
  255. .name = "edma",
  256. .id = 0,
  257. .dma_mask = DMA_BIT_MASK(32),
  258. .res = edma_resources,
  259. .num_res = ARRAY_SIZE(edma_resources),
  260. .data = &dm646x_edma_pdata,
  261. .size_data = sizeof(dm646x_edma_pdata),
  262. };
  263. static struct resource dm646x_mcasp0_resources[] = {
  264. {
  265. .name = "mpu",
  266. .start = DAVINCI_DM646X_MCASP0_REG_BASE,
  267. .end = DAVINCI_DM646X_MCASP0_REG_BASE + (SZ_1K << 1) - 1,
  268. .flags = IORESOURCE_MEM,
  269. },
  270. {
  271. .name = "tx",
  272. .start = DAVINCI_DM646X_DMA_MCASP0_AXEVT0,
  273. .end = DAVINCI_DM646X_DMA_MCASP0_AXEVT0,
  274. .flags = IORESOURCE_DMA,
  275. },
  276. {
  277. .name = "rx",
  278. .start = DAVINCI_DM646X_DMA_MCASP0_AREVT0,
  279. .end = DAVINCI_DM646X_DMA_MCASP0_AREVT0,
  280. .flags = IORESOURCE_DMA,
  281. },
  282. {
  283. .name = "tx",
  284. .start = IRQ_DM646X_MCASP0TXINT,
  285. .flags = IORESOURCE_IRQ,
  286. },
  287. {
  288. .name = "rx",
  289. .start = IRQ_DM646X_MCASP0RXINT,
  290. .flags = IORESOURCE_IRQ,
  291. },
  292. };
  293. /* DIT mode only, rx is not supported */
  294. static struct resource dm646x_mcasp1_resources[] = {
  295. {
  296. .name = "mpu",
  297. .start = DAVINCI_DM646X_MCASP1_REG_BASE,
  298. .end = DAVINCI_DM646X_MCASP1_REG_BASE + (SZ_1K << 1) - 1,
  299. .flags = IORESOURCE_MEM,
  300. },
  301. {
  302. .name = "tx",
  303. .start = DAVINCI_DM646X_DMA_MCASP1_AXEVT1,
  304. .end = DAVINCI_DM646X_DMA_MCASP1_AXEVT1,
  305. .flags = IORESOURCE_DMA,
  306. },
  307. {
  308. .name = "tx",
  309. .start = IRQ_DM646X_MCASP1TXINT,
  310. .flags = IORESOURCE_IRQ,
  311. },
  312. };
  313. static struct platform_device dm646x_mcasp0_device = {
  314. .name = "davinci-mcasp",
  315. .id = 0,
  316. .num_resources = ARRAY_SIZE(dm646x_mcasp0_resources),
  317. .resource = dm646x_mcasp0_resources,
  318. };
  319. static struct platform_device dm646x_mcasp1_device = {
  320. .name = "davinci-mcasp",
  321. .id = 1,
  322. .num_resources = ARRAY_SIZE(dm646x_mcasp1_resources),
  323. .resource = dm646x_mcasp1_resources,
  324. };
  325. static struct platform_device dm646x_dit_device = {
  326. .name = "spdif-dit",
  327. .id = -1,
  328. };
  329. static u64 vpif_dma_mask = DMA_BIT_MASK(32);
  330. static struct resource vpif_resource[] = {
  331. {
  332. .start = DAVINCI_VPIF_BASE,
  333. .end = DAVINCI_VPIF_BASE + 0x03ff,
  334. .flags = IORESOURCE_MEM,
  335. }
  336. };
  337. static struct platform_device vpif_dev = {
  338. .name = "vpif",
  339. .id = -1,
  340. .dev = {
  341. .dma_mask = &vpif_dma_mask,
  342. .coherent_dma_mask = DMA_BIT_MASK(32),
  343. },
  344. .resource = vpif_resource,
  345. .num_resources = ARRAY_SIZE(vpif_resource),
  346. };
  347. static struct resource vpif_display_resource[] = {
  348. {
  349. .start = IRQ_DM646X_VP_VERTINT2,
  350. .end = IRQ_DM646X_VP_VERTINT2,
  351. .flags = IORESOURCE_IRQ,
  352. },
  353. {
  354. .start = IRQ_DM646X_VP_VERTINT3,
  355. .end = IRQ_DM646X_VP_VERTINT3,
  356. .flags = IORESOURCE_IRQ,
  357. },
  358. };
  359. static struct platform_device vpif_display_dev = {
  360. .name = "vpif_display",
  361. .id = -1,
  362. .dev = {
  363. .dma_mask = &vpif_dma_mask,
  364. .coherent_dma_mask = DMA_BIT_MASK(32),
  365. },
  366. .resource = vpif_display_resource,
  367. .num_resources = ARRAY_SIZE(vpif_display_resource),
  368. };
  369. static struct resource vpif_capture_resource[] = {
  370. {
  371. .start = IRQ_DM646X_VP_VERTINT0,
  372. .end = IRQ_DM646X_VP_VERTINT0,
  373. .flags = IORESOURCE_IRQ,
  374. },
  375. {
  376. .start = IRQ_DM646X_VP_VERTINT1,
  377. .end = IRQ_DM646X_VP_VERTINT1,
  378. .flags = IORESOURCE_IRQ,
  379. },
  380. };
  381. static struct platform_device vpif_capture_dev = {
  382. .name = "vpif_capture",
  383. .id = -1,
  384. .dev = {
  385. .dma_mask = &vpif_dma_mask,
  386. .coherent_dma_mask = DMA_BIT_MASK(32),
  387. },
  388. .resource = vpif_capture_resource,
  389. .num_resources = ARRAY_SIZE(vpif_capture_resource),
  390. };
  391. static struct resource dm646x_gpio_resources[] = {
  392. { /* registers */
  393. .start = DAVINCI_GPIO_BASE,
  394. .end = DAVINCI_GPIO_BASE + SZ_4K - 1,
  395. .flags = IORESOURCE_MEM,
  396. },
  397. { /* interrupt */
  398. .start = IRQ_DM646X_GPIOBNK0,
  399. .end = IRQ_DM646X_GPIOBNK0,
  400. .flags = IORESOURCE_IRQ,
  401. },
  402. {
  403. .start = IRQ_DM646X_GPIOBNK1,
  404. .end = IRQ_DM646X_GPIOBNK1,
  405. .flags = IORESOURCE_IRQ,
  406. },
  407. {
  408. .start = IRQ_DM646X_GPIOBNK2,
  409. .end = IRQ_DM646X_GPIOBNK2,
  410. .flags = IORESOURCE_IRQ,
  411. },
  412. };
  413. static struct davinci_gpio_platform_data dm646x_gpio_platform_data = {
  414. .ngpio = 43,
  415. };
  416. int __init dm646x_gpio_register(void)
  417. {
  418. return davinci_gpio_register(dm646x_gpio_resources,
  419. ARRAY_SIZE(dm646x_gpio_resources),
  420. &dm646x_gpio_platform_data);
  421. }
  422. /*----------------------------------------------------------------------*/
  423. static struct map_desc dm646x_io_desc[] = {
  424. {
  425. .virtual = IO_VIRT,
  426. .pfn = __phys_to_pfn(IO_PHYS),
  427. .length = IO_SIZE,
  428. .type = MT_DEVICE
  429. },
  430. };
  431. /* Contents of JTAG ID register used to identify exact cpu type */
  432. static struct davinci_id dm646x_ids[] = {
  433. {
  434. .variant = 0x0,
  435. .part_no = 0xb770,
  436. .manufacturer = 0x017,
  437. .cpu_id = DAVINCI_CPU_ID_DM6467,
  438. .name = "dm6467_rev1.x",
  439. },
  440. {
  441. .variant = 0x1,
  442. .part_no = 0xb770,
  443. .manufacturer = 0x017,
  444. .cpu_id = DAVINCI_CPU_ID_DM6467,
  445. .name = "dm6467_rev3.x",
  446. },
  447. };
  448. /*
  449. * T0_BOT: Timer 0, bottom: clockevent source for hrtimers
  450. * T0_TOP: Timer 0, top : clocksource for generic timekeeping
  451. * T1_BOT: Timer 1, bottom: (used by DSP in TI DSPLink code)
  452. * T1_TOP: Timer 1, top : <unused>
  453. */
  454. static struct davinci_timer_info dm646x_timer_info = {
  455. .timers = davinci_timer_instance,
  456. .clockevent_id = T0_BOT,
  457. .clocksource_id = T0_TOP,
  458. };
  459. static struct plat_serial8250_port dm646x_serial0_platform_data[] = {
  460. {
  461. .mapbase = DAVINCI_UART0_BASE,
  462. .irq = IRQ_UARTINT0,
  463. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST |
  464. UPF_IOREMAP,
  465. .iotype = UPIO_MEM32,
  466. .regshift = 2,
  467. },
  468. {
  469. .flags = 0,
  470. }
  471. };
  472. static struct plat_serial8250_port dm646x_serial1_platform_data[] = {
  473. {
  474. .mapbase = DAVINCI_UART1_BASE,
  475. .irq = IRQ_UARTINT1,
  476. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST |
  477. UPF_IOREMAP,
  478. .iotype = UPIO_MEM32,
  479. .regshift = 2,
  480. },
  481. {
  482. .flags = 0,
  483. }
  484. };
  485. static struct plat_serial8250_port dm646x_serial2_platform_data[] = {
  486. {
  487. .mapbase = DAVINCI_UART2_BASE,
  488. .irq = IRQ_DM646X_UARTINT2,
  489. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST |
  490. UPF_IOREMAP,
  491. .iotype = UPIO_MEM32,
  492. .regshift = 2,
  493. },
  494. {
  495. .flags = 0,
  496. }
  497. };
  498. struct platform_device dm646x_serial_device[] = {
  499. {
  500. .name = "serial8250",
  501. .id = PLAT8250_DEV_PLATFORM,
  502. .dev = {
  503. .platform_data = dm646x_serial0_platform_data,
  504. }
  505. },
  506. {
  507. .name = "serial8250",
  508. .id = PLAT8250_DEV_PLATFORM1,
  509. .dev = {
  510. .platform_data = dm646x_serial1_platform_data,
  511. }
  512. },
  513. {
  514. .name = "serial8250",
  515. .id = PLAT8250_DEV_PLATFORM2,
  516. .dev = {
  517. .platform_data = dm646x_serial2_platform_data,
  518. }
  519. },
  520. {
  521. }
  522. };
  523. static const struct davinci_soc_info davinci_soc_info_dm646x = {
  524. .io_desc = dm646x_io_desc,
  525. .io_desc_num = ARRAY_SIZE(dm646x_io_desc),
  526. .jtag_id_reg = 0x01c40028,
  527. .ids = dm646x_ids,
  528. .ids_num = ARRAY_SIZE(dm646x_ids),
  529. .pinmux_base = DAVINCI_SYSTEM_MODULE_BASE,
  530. .pinmux_pins = dm646x_pins,
  531. .pinmux_pins_num = ARRAY_SIZE(dm646x_pins),
  532. .intc_base = DAVINCI_ARM_INTC_BASE,
  533. .intc_type = DAVINCI_INTC_TYPE_AINTC,
  534. .intc_irq_prios = dm646x_default_priorities,
  535. .intc_irq_num = DAVINCI_N_AINTC_IRQ,
  536. .timer_info = &dm646x_timer_info,
  537. .emac_pdata = &dm646x_emac_pdata,
  538. .sram_dma = 0x10010000,
  539. .sram_len = SZ_32K,
  540. };
  541. void __init dm646x_init_mcasp0(struct snd_platform_data *pdata)
  542. {
  543. dm646x_mcasp0_device.dev.platform_data = pdata;
  544. platform_device_register(&dm646x_mcasp0_device);
  545. }
  546. void __init dm646x_init_mcasp1(struct snd_platform_data *pdata)
  547. {
  548. dm646x_mcasp1_device.dev.platform_data = pdata;
  549. platform_device_register(&dm646x_mcasp1_device);
  550. platform_device_register(&dm646x_dit_device);
  551. }
  552. void dm646x_setup_vpif(struct vpif_display_config *display_config,
  553. struct vpif_capture_config *capture_config)
  554. {
  555. unsigned int value;
  556. value = __raw_readl(DAVINCI_SYSMOD_VIRT(SYSMOD_VSCLKDIS));
  557. value &= ~VSCLKDIS_MASK;
  558. __raw_writel(value, DAVINCI_SYSMOD_VIRT(SYSMOD_VSCLKDIS));
  559. value = __raw_readl(DAVINCI_SYSMOD_VIRT(SYSMOD_VDD3P3VPWDN));
  560. value &= ~VDD3P3V_VID_MASK;
  561. __raw_writel(value, DAVINCI_SYSMOD_VIRT(SYSMOD_VDD3P3VPWDN));
  562. davinci_cfg_reg(DM646X_STSOMUX_DISABLE);
  563. davinci_cfg_reg(DM646X_STSIMUX_DISABLE);
  564. davinci_cfg_reg(DM646X_PTSOMUX_DISABLE);
  565. davinci_cfg_reg(DM646X_PTSIMUX_DISABLE);
  566. vpif_display_dev.dev.platform_data = display_config;
  567. vpif_capture_dev.dev.platform_data = capture_config;
  568. platform_device_register(&vpif_dev);
  569. platform_device_register(&vpif_display_dev);
  570. platform_device_register(&vpif_capture_dev);
  571. }
  572. int __init dm646x_init_edma(struct edma_rsv_info *rsv)
  573. {
  574. struct platform_device *edma_pdev;
  575. dm646x_edma_pdata.rsv = rsv;
  576. edma_pdev = platform_device_register_full(&dm646x_edma_device);
  577. return PTR_ERR_OR_ZERO(edma_pdev);
  578. }
  579. void __init dm646x_init(void)
  580. {
  581. davinci_common_init(&davinci_soc_info_dm646x);
  582. davinci_map_sysmod();
  583. }
  584. void __init dm646x_init_time(unsigned long ref_clk_rate,
  585. unsigned long aux_clkin_rate)
  586. {
  587. void __iomem *pll1, *psc;
  588. struct clk *clk;
  589. clk_register_fixed_rate(NULL, "ref_clk", NULL, 0, ref_clk_rate);
  590. clk_register_fixed_rate(NULL, "aux_clkin", NULL, 0, aux_clkin_rate);
  591. pll1 = ioremap(DAVINCI_PLL1_BASE, SZ_1K);
  592. dm646x_pll1_init(NULL, pll1, NULL);
  593. psc = ioremap(DAVINCI_PWR_SLEEP_CNTRL_BASE, SZ_4K);
  594. dm646x_psc_init(NULL, psc);
  595. clk = clk_get(NULL, "timer0");
  596. davinci_timer_init(clk);
  597. }
  598. static struct resource dm646x_pll2_resources[] = {
  599. {
  600. .start = DAVINCI_PLL2_BASE,
  601. .end = DAVINCI_PLL2_BASE + SZ_1K - 1,
  602. .flags = IORESOURCE_MEM,
  603. },
  604. };
  605. static struct platform_device dm646x_pll2_device = {
  606. .name = "dm646x-pll2",
  607. .id = -1,
  608. .resource = dm646x_pll2_resources,
  609. .num_resources = ARRAY_SIZE(dm646x_pll2_resources),
  610. };
  611. void __init dm646x_register_clocks(void)
  612. {
  613. /* PLL1 and PSC are registered in dm646x_init_time() */
  614. platform_device_register(&dm646x_pll2_device);
  615. }
  616. static int __init dm646x_init_devices(void)
  617. {
  618. int ret = 0;
  619. if (!cpu_is_davinci_dm646x())
  620. return 0;
  621. platform_device_register(&dm646x_mdio_device);
  622. platform_device_register(&dm646x_emac_device);
  623. ret = davinci_init_wdt();
  624. if (ret)
  625. pr_warn("%s: watchdog init failed: %d\n", __func__, ret);
  626. return ret;
  627. }
  628. postcore_initcall(dm646x_init_devices);