dm644x.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747
  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/dmaengine.h>
  15. #include <linux/init.h>
  16. #include <linux/platform_data/edma.h>
  17. #include <linux/platform_data/gpio-davinci.h>
  18. #include <linux/platform_device.h>
  19. #include <linux/serial_8250.h>
  20. #include <asm/mach/map.h>
  21. #include <mach/common.h>
  22. #include <mach/cputype.h>
  23. #include <mach/irqs.h>
  24. #include <mach/mux.h>
  25. #include <mach/serial.h>
  26. #include <mach/time.h>
  27. #include "asp.h"
  28. #include "davinci.h"
  29. #include "mux.h"
  30. /*
  31. * Device specific clocks
  32. */
  33. #define DM644X_REF_FREQ 27000000
  34. #define DM644X_EMAC_BASE 0x01c80000
  35. #define DM644X_EMAC_MDIO_BASE (DM644X_EMAC_BASE + 0x4000)
  36. #define DM644X_EMAC_CNTRL_OFFSET 0x0000
  37. #define DM644X_EMAC_CNTRL_MOD_OFFSET 0x1000
  38. #define DM644X_EMAC_CNTRL_RAM_OFFSET 0x2000
  39. #define DM644X_EMAC_CNTRL_RAM_SIZE 0x2000
  40. static struct emac_platform_data dm644x_emac_pdata = {
  41. .ctrl_reg_offset = DM644X_EMAC_CNTRL_OFFSET,
  42. .ctrl_mod_reg_offset = DM644X_EMAC_CNTRL_MOD_OFFSET,
  43. .ctrl_ram_offset = DM644X_EMAC_CNTRL_RAM_OFFSET,
  44. .ctrl_ram_size = DM644X_EMAC_CNTRL_RAM_SIZE,
  45. .version = EMAC_VERSION_1,
  46. };
  47. static struct resource dm644x_emac_resources[] = {
  48. {
  49. .start = DM644X_EMAC_BASE,
  50. .end = DM644X_EMAC_BASE + SZ_16K - 1,
  51. .flags = IORESOURCE_MEM,
  52. },
  53. {
  54. .start = IRQ_EMACINT,
  55. .end = IRQ_EMACINT,
  56. .flags = IORESOURCE_IRQ,
  57. },
  58. };
  59. static struct platform_device dm644x_emac_device = {
  60. .name = "davinci_emac",
  61. .id = 1,
  62. .dev = {
  63. .platform_data = &dm644x_emac_pdata,
  64. },
  65. .num_resources = ARRAY_SIZE(dm644x_emac_resources),
  66. .resource = dm644x_emac_resources,
  67. };
  68. static struct resource dm644x_mdio_resources[] = {
  69. {
  70. .start = DM644X_EMAC_MDIO_BASE,
  71. .end = DM644X_EMAC_MDIO_BASE + SZ_4K - 1,
  72. .flags = IORESOURCE_MEM,
  73. },
  74. };
  75. static struct platform_device dm644x_mdio_device = {
  76. .name = "davinci_mdio",
  77. .id = 0,
  78. .num_resources = ARRAY_SIZE(dm644x_mdio_resources),
  79. .resource = dm644x_mdio_resources,
  80. };
  81. /*
  82. * Device specific mux setup
  83. *
  84. * soc description mux mode mode mux dbg
  85. * reg offset mask mode
  86. */
  87. static const struct mux_config dm644x_pins[] = {
  88. #ifdef CONFIG_DAVINCI_MUX
  89. MUX_CFG(DM644X, HDIREN, 0, 16, 1, 1, true)
  90. MUX_CFG(DM644X, ATAEN, 0, 17, 1, 1, true)
  91. MUX_CFG(DM644X, ATAEN_DISABLE, 0, 17, 1, 0, true)
  92. MUX_CFG(DM644X, HPIEN_DISABLE, 0, 29, 1, 0, true)
  93. MUX_CFG(DM644X, AEAW, 0, 0, 31, 31, true)
  94. MUX_CFG(DM644X, AEAW0, 0, 0, 1, 0, true)
  95. MUX_CFG(DM644X, AEAW1, 0, 1, 1, 0, true)
  96. MUX_CFG(DM644X, AEAW2, 0, 2, 1, 0, true)
  97. MUX_CFG(DM644X, AEAW3, 0, 3, 1, 0, true)
  98. MUX_CFG(DM644X, AEAW4, 0, 4, 1, 0, true)
  99. MUX_CFG(DM644X, MSTK, 1, 9, 1, 0, false)
  100. MUX_CFG(DM644X, I2C, 1, 7, 1, 1, false)
  101. MUX_CFG(DM644X, MCBSP, 1, 10, 1, 1, false)
  102. MUX_CFG(DM644X, UART1, 1, 1, 1, 1, true)
  103. MUX_CFG(DM644X, UART2, 1, 2, 1, 1, true)
  104. MUX_CFG(DM644X, PWM0, 1, 4, 1, 1, false)
  105. MUX_CFG(DM644X, PWM1, 1, 5, 1, 1, false)
  106. MUX_CFG(DM644X, PWM2, 1, 6, 1, 1, false)
  107. MUX_CFG(DM644X, VLYNQEN, 0, 15, 1, 1, false)
  108. MUX_CFG(DM644X, VLSCREN, 0, 14, 1, 1, false)
  109. MUX_CFG(DM644X, VLYNQWD, 0, 12, 3, 3, false)
  110. MUX_CFG(DM644X, EMACEN, 0, 31, 1, 1, true)
  111. MUX_CFG(DM644X, GPIO3V, 0, 31, 1, 0, true)
  112. MUX_CFG(DM644X, GPIO0, 0, 24, 1, 0, true)
  113. MUX_CFG(DM644X, GPIO3, 0, 25, 1, 0, false)
  114. MUX_CFG(DM644X, GPIO43_44, 1, 7, 1, 0, false)
  115. MUX_CFG(DM644X, GPIO46_47, 0, 22, 1, 0, true)
  116. MUX_CFG(DM644X, RGB666, 0, 22, 1, 1, true)
  117. MUX_CFG(DM644X, LOEEN, 0, 24, 1, 1, true)
  118. MUX_CFG(DM644X, LFLDEN, 0, 25, 1, 1, false)
  119. #endif
  120. };
  121. /* FIQ are pri 0-1; otherwise 2-7, with 7 lowest priority */
  122. static u8 dm644x_default_priorities[DAVINCI_N_AINTC_IRQ] = {
  123. [IRQ_VDINT0] = 2,
  124. [IRQ_VDINT1] = 6,
  125. [IRQ_VDINT2] = 6,
  126. [IRQ_HISTINT] = 6,
  127. [IRQ_H3AINT] = 6,
  128. [IRQ_PRVUINT] = 6,
  129. [IRQ_RSZINT] = 6,
  130. [7] = 7,
  131. [IRQ_VENCINT] = 6,
  132. [IRQ_ASQINT] = 6,
  133. [IRQ_IMXINT] = 6,
  134. [IRQ_VLCDINT] = 6,
  135. [IRQ_USBINT] = 4,
  136. [IRQ_EMACINT] = 4,
  137. [14] = 7,
  138. [15] = 7,
  139. [IRQ_CCINT0] = 5, /* dma */
  140. [IRQ_CCERRINT] = 5, /* dma */
  141. [IRQ_TCERRINT0] = 5, /* dma */
  142. [IRQ_TCERRINT] = 5, /* dma */
  143. [IRQ_PSCIN] = 7,
  144. [21] = 7,
  145. [IRQ_IDE] = 4,
  146. [23] = 7,
  147. [IRQ_MBXINT] = 7,
  148. [IRQ_MBRINT] = 7,
  149. [IRQ_MMCINT] = 7,
  150. [IRQ_SDIOINT] = 7,
  151. [28] = 7,
  152. [IRQ_DDRINT] = 7,
  153. [IRQ_AEMIFINT] = 7,
  154. [IRQ_VLQINT] = 4,
  155. [IRQ_TINT0_TINT12] = 2, /* clockevent */
  156. [IRQ_TINT0_TINT34] = 2, /* 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_PWMINT2] = 7,
  162. [IRQ_I2C] = 3,
  163. [IRQ_UARTINT0] = 3,
  164. [IRQ_UARTINT1] = 3,
  165. [IRQ_UARTINT2] = 3,
  166. [IRQ_SPINT0] = 3,
  167. [IRQ_SPINT1] = 3,
  168. [45] = 7,
  169. [IRQ_DSP2ARM0] = 4,
  170. [IRQ_DSP2ARM1] = 4,
  171. [IRQ_GPIO0] = 7,
  172. [IRQ_GPIO1] = 7,
  173. [IRQ_GPIO2] = 7,
  174. [IRQ_GPIO3] = 7,
  175. [IRQ_GPIO4] = 7,
  176. [IRQ_GPIO5] = 7,
  177. [IRQ_GPIO6] = 7,
  178. [IRQ_GPIO7] = 7,
  179. [IRQ_GPIOBNK0] = 7,
  180. [IRQ_GPIOBNK1] = 7,
  181. [IRQ_GPIOBNK2] = 7,
  182. [IRQ_GPIOBNK3] = 7,
  183. [IRQ_GPIOBNK4] = 7,
  184. [IRQ_COMMTX] = 7,
  185. [IRQ_COMMRX] = 7,
  186. [IRQ_EMUINT] = 7,
  187. };
  188. /*----------------------------------------------------------------------*/
  189. static s8 queue_priority_mapping[][2] = {
  190. /* {event queue no, Priority} */
  191. {0, 3},
  192. {1, 7},
  193. {-1, -1},
  194. };
  195. static const struct dma_slave_map dm644x_edma_map[] = {
  196. { "davinci-mcbsp", "tx", EDMA_FILTER_PARAM(0, 2) },
  197. { "davinci-mcbsp", "rx", EDMA_FILTER_PARAM(0, 3) },
  198. { "spi_davinci", "tx", EDMA_FILTER_PARAM(0, 16) },
  199. { "spi_davinci", "rx", EDMA_FILTER_PARAM(0, 17) },
  200. { "dm6441-mmc.0", "rx", EDMA_FILTER_PARAM(0, 26) },
  201. { "dm6441-mmc.0", "tx", EDMA_FILTER_PARAM(0, 27) },
  202. };
  203. static struct edma_soc_info dm644x_edma_pdata = {
  204. .queue_priority_mapping = queue_priority_mapping,
  205. .default_queue = EVENTQ_1,
  206. .slave_map = dm644x_edma_map,
  207. .slavecnt = ARRAY_SIZE(dm644x_edma_map),
  208. };
  209. static struct resource edma_resources[] = {
  210. {
  211. .name = "edma3_cc",
  212. .start = 0x01c00000,
  213. .end = 0x01c00000 + SZ_64K - 1,
  214. .flags = IORESOURCE_MEM,
  215. },
  216. {
  217. .name = "edma3_tc0",
  218. .start = 0x01c10000,
  219. .end = 0x01c10000 + SZ_1K - 1,
  220. .flags = IORESOURCE_MEM,
  221. },
  222. {
  223. .name = "edma3_tc1",
  224. .start = 0x01c10400,
  225. .end = 0x01c10400 + SZ_1K - 1,
  226. .flags = IORESOURCE_MEM,
  227. },
  228. {
  229. .name = "edma3_ccint",
  230. .start = IRQ_CCINT0,
  231. .flags = IORESOURCE_IRQ,
  232. },
  233. {
  234. .name = "edma3_ccerrint",
  235. .start = IRQ_CCERRINT,
  236. .flags = IORESOURCE_IRQ,
  237. },
  238. /* not using TC*_ERR */
  239. };
  240. static const struct platform_device_info dm644x_edma_device __initconst = {
  241. .name = "edma",
  242. .id = 0,
  243. .dma_mask = DMA_BIT_MASK(32),
  244. .res = edma_resources,
  245. .num_res = ARRAY_SIZE(edma_resources),
  246. .data = &dm644x_edma_pdata,
  247. .size_data = sizeof(dm644x_edma_pdata),
  248. };
  249. /* DM6446 EVM uses ASP0; line-out is a pair of RCA jacks */
  250. static struct resource dm644x_asp_resources[] = {
  251. {
  252. .name = "mpu",
  253. .start = DAVINCI_ASP0_BASE,
  254. .end = DAVINCI_ASP0_BASE + SZ_8K - 1,
  255. .flags = IORESOURCE_MEM,
  256. },
  257. {
  258. .start = DAVINCI_DMA_ASP0_TX,
  259. .end = DAVINCI_DMA_ASP0_TX,
  260. .flags = IORESOURCE_DMA,
  261. },
  262. {
  263. .start = DAVINCI_DMA_ASP0_RX,
  264. .end = DAVINCI_DMA_ASP0_RX,
  265. .flags = IORESOURCE_DMA,
  266. },
  267. };
  268. static struct platform_device dm644x_asp_device = {
  269. .name = "davinci-mcbsp",
  270. .id = -1,
  271. .num_resources = ARRAY_SIZE(dm644x_asp_resources),
  272. .resource = dm644x_asp_resources,
  273. };
  274. #define DM644X_VPSS_BASE 0x01c73400
  275. static struct resource dm644x_vpss_resources[] = {
  276. {
  277. /* VPSS Base address */
  278. .name = "vpss",
  279. .start = DM644X_VPSS_BASE,
  280. .end = DM644X_VPSS_BASE + 0xff,
  281. .flags = IORESOURCE_MEM,
  282. },
  283. };
  284. static struct platform_device dm644x_vpss_device = {
  285. .name = "vpss",
  286. .id = -1,
  287. .dev.platform_data = "dm644x_vpss",
  288. .num_resources = ARRAY_SIZE(dm644x_vpss_resources),
  289. .resource = dm644x_vpss_resources,
  290. };
  291. static struct resource dm644x_vpfe_resources[] = {
  292. {
  293. .start = IRQ_VDINT0,
  294. .end = IRQ_VDINT0,
  295. .flags = IORESOURCE_IRQ,
  296. },
  297. {
  298. .start = IRQ_VDINT1,
  299. .end = IRQ_VDINT1,
  300. .flags = IORESOURCE_IRQ,
  301. },
  302. };
  303. static u64 dm644x_video_dma_mask = DMA_BIT_MASK(32);
  304. static struct resource dm644x_ccdc_resource[] = {
  305. /* CCDC Base address */
  306. {
  307. .start = 0x01c70400,
  308. .end = 0x01c70400 + 0xff,
  309. .flags = IORESOURCE_MEM,
  310. },
  311. };
  312. static struct platform_device dm644x_ccdc_dev = {
  313. .name = "dm644x_ccdc",
  314. .id = -1,
  315. .num_resources = ARRAY_SIZE(dm644x_ccdc_resource),
  316. .resource = dm644x_ccdc_resource,
  317. .dev = {
  318. .dma_mask = &dm644x_video_dma_mask,
  319. .coherent_dma_mask = DMA_BIT_MASK(32),
  320. },
  321. };
  322. static struct platform_device dm644x_vpfe_dev = {
  323. .name = CAPTURE_DRV_NAME,
  324. .id = -1,
  325. .num_resources = ARRAY_SIZE(dm644x_vpfe_resources),
  326. .resource = dm644x_vpfe_resources,
  327. .dev = {
  328. .dma_mask = &dm644x_video_dma_mask,
  329. .coherent_dma_mask = DMA_BIT_MASK(32),
  330. },
  331. };
  332. #define DM644X_OSD_BASE 0x01c72600
  333. static struct resource dm644x_osd_resources[] = {
  334. {
  335. .start = DM644X_OSD_BASE,
  336. .end = DM644X_OSD_BASE + 0x1ff,
  337. .flags = IORESOURCE_MEM,
  338. },
  339. };
  340. static struct platform_device dm644x_osd_dev = {
  341. .name = DM644X_VPBE_OSD_SUBDEV_NAME,
  342. .id = -1,
  343. .num_resources = ARRAY_SIZE(dm644x_osd_resources),
  344. .resource = dm644x_osd_resources,
  345. .dev = {
  346. .dma_mask = &dm644x_video_dma_mask,
  347. .coherent_dma_mask = DMA_BIT_MASK(32),
  348. },
  349. };
  350. #define DM644X_VENC_BASE 0x01c72400
  351. static struct resource dm644x_venc_resources[] = {
  352. {
  353. .start = DM644X_VENC_BASE,
  354. .end = DM644X_VENC_BASE + 0x17f,
  355. .flags = IORESOURCE_MEM,
  356. },
  357. };
  358. #define DM644X_VPSS_MUXSEL_PLL2_MODE BIT(0)
  359. #define DM644X_VPSS_MUXSEL_VPBECLK_MODE BIT(1)
  360. #define DM644X_VPSS_VENCLKEN BIT(3)
  361. #define DM644X_VPSS_DACCLKEN BIT(4)
  362. static int dm644x_venc_setup_clock(enum vpbe_enc_timings_type type,
  363. unsigned int pclock)
  364. {
  365. int ret = 0;
  366. u32 v = DM644X_VPSS_VENCLKEN;
  367. switch (type) {
  368. case VPBE_ENC_STD:
  369. v |= DM644X_VPSS_DACCLKEN;
  370. writel(v, DAVINCI_SYSMOD_VIRT(SYSMOD_VPSS_CLKCTL));
  371. break;
  372. case VPBE_ENC_DV_TIMINGS:
  373. if (pclock <= 27000000) {
  374. v |= DM644X_VPSS_DACCLKEN;
  375. writel(v, DAVINCI_SYSMOD_VIRT(SYSMOD_VPSS_CLKCTL));
  376. } else {
  377. /*
  378. * For HD, use external clock source since
  379. * HD requires higher clock rate
  380. */
  381. v |= DM644X_VPSS_MUXSEL_VPBECLK_MODE;
  382. writel(v, DAVINCI_SYSMOD_VIRT(SYSMOD_VPSS_CLKCTL));
  383. }
  384. break;
  385. default:
  386. ret = -EINVAL;
  387. }
  388. return ret;
  389. }
  390. static struct resource dm644x_v4l2_disp_resources[] = {
  391. {
  392. .start = IRQ_VENCINT,
  393. .end = IRQ_VENCINT,
  394. .flags = IORESOURCE_IRQ,
  395. },
  396. };
  397. static struct platform_device dm644x_vpbe_display = {
  398. .name = "vpbe-v4l2",
  399. .id = -1,
  400. .num_resources = ARRAY_SIZE(dm644x_v4l2_disp_resources),
  401. .resource = dm644x_v4l2_disp_resources,
  402. .dev = {
  403. .dma_mask = &dm644x_video_dma_mask,
  404. .coherent_dma_mask = DMA_BIT_MASK(32),
  405. },
  406. };
  407. static struct venc_platform_data dm644x_venc_pdata = {
  408. .setup_clock = dm644x_venc_setup_clock,
  409. };
  410. static struct platform_device dm644x_venc_dev = {
  411. .name = DM644X_VPBE_VENC_SUBDEV_NAME,
  412. .id = -1,
  413. .num_resources = ARRAY_SIZE(dm644x_venc_resources),
  414. .resource = dm644x_venc_resources,
  415. .dev = {
  416. .dma_mask = &dm644x_video_dma_mask,
  417. .coherent_dma_mask = DMA_BIT_MASK(32),
  418. .platform_data = &dm644x_venc_pdata,
  419. },
  420. };
  421. static struct platform_device dm644x_vpbe_dev = {
  422. .name = "vpbe_controller",
  423. .id = -1,
  424. .dev = {
  425. .dma_mask = &dm644x_video_dma_mask,
  426. .coherent_dma_mask = DMA_BIT_MASK(32),
  427. },
  428. };
  429. static struct resource dm644_gpio_resources[] = {
  430. { /* registers */
  431. .start = DAVINCI_GPIO_BASE,
  432. .end = DAVINCI_GPIO_BASE + SZ_4K - 1,
  433. .flags = IORESOURCE_MEM,
  434. },
  435. { /* interrupt */
  436. .start = IRQ_GPIOBNK0,
  437. .end = IRQ_GPIOBNK0,
  438. .flags = IORESOURCE_IRQ,
  439. },
  440. {
  441. .start = IRQ_GPIOBNK1,
  442. .end = IRQ_GPIOBNK1,
  443. .flags = IORESOURCE_IRQ,
  444. },
  445. {
  446. .start = IRQ_GPIOBNK2,
  447. .end = IRQ_GPIOBNK2,
  448. .flags = IORESOURCE_IRQ,
  449. },
  450. {
  451. .start = IRQ_GPIOBNK3,
  452. .end = IRQ_GPIOBNK3,
  453. .flags = IORESOURCE_IRQ,
  454. },
  455. {
  456. .start = IRQ_GPIOBNK4,
  457. .end = IRQ_GPIOBNK4,
  458. .flags = IORESOURCE_IRQ,
  459. },
  460. };
  461. static struct davinci_gpio_platform_data dm644_gpio_platform_data = {
  462. .ngpio = 71,
  463. };
  464. int __init dm644x_gpio_register(void)
  465. {
  466. return davinci_gpio_register(dm644_gpio_resources,
  467. ARRAY_SIZE(dm644_gpio_resources),
  468. &dm644_gpio_platform_data);
  469. }
  470. /*----------------------------------------------------------------------*/
  471. static struct map_desc dm644x_io_desc[] = {
  472. {
  473. .virtual = IO_VIRT,
  474. .pfn = __phys_to_pfn(IO_PHYS),
  475. .length = IO_SIZE,
  476. .type = MT_DEVICE
  477. },
  478. };
  479. /* Contents of JTAG ID register used to identify exact cpu type */
  480. static struct davinci_id dm644x_ids[] = {
  481. {
  482. .variant = 0x0,
  483. .part_no = 0xb700,
  484. .manufacturer = 0x017,
  485. .cpu_id = DAVINCI_CPU_ID_DM6446,
  486. .name = "dm6446",
  487. },
  488. {
  489. .variant = 0x1,
  490. .part_no = 0xb700,
  491. .manufacturer = 0x017,
  492. .cpu_id = DAVINCI_CPU_ID_DM6446,
  493. .name = "dm6446a",
  494. },
  495. };
  496. /*
  497. * T0_BOT: Timer 0, bottom: clockevent source for hrtimers
  498. * T0_TOP: Timer 0, top : clocksource for generic timekeeping
  499. * T1_BOT: Timer 1, bottom: (used by DSP in TI DSPLink code)
  500. * T1_TOP: Timer 1, top : <unused>
  501. */
  502. static struct davinci_timer_info dm644x_timer_info = {
  503. .timers = davinci_timer_instance,
  504. .clockevent_id = T0_BOT,
  505. .clocksource_id = T0_TOP,
  506. };
  507. static struct plat_serial8250_port dm644x_serial0_platform_data[] = {
  508. {
  509. .mapbase = DAVINCI_UART0_BASE,
  510. .irq = IRQ_UARTINT0,
  511. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST |
  512. UPF_IOREMAP,
  513. .iotype = UPIO_MEM,
  514. .regshift = 2,
  515. },
  516. {
  517. .flags = 0,
  518. }
  519. };
  520. static struct plat_serial8250_port dm644x_serial1_platform_data[] = {
  521. {
  522. .mapbase = DAVINCI_UART1_BASE,
  523. .irq = IRQ_UARTINT1,
  524. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST |
  525. UPF_IOREMAP,
  526. .iotype = UPIO_MEM,
  527. .regshift = 2,
  528. },
  529. {
  530. .flags = 0,
  531. }
  532. };
  533. static struct plat_serial8250_port dm644x_serial2_platform_data[] = {
  534. {
  535. .mapbase = DAVINCI_UART2_BASE,
  536. .irq = IRQ_UARTINT2,
  537. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST |
  538. UPF_IOREMAP,
  539. .iotype = UPIO_MEM,
  540. .regshift = 2,
  541. },
  542. {
  543. .flags = 0,
  544. }
  545. };
  546. struct platform_device dm644x_serial_device[] = {
  547. {
  548. .name = "serial8250",
  549. .id = PLAT8250_DEV_PLATFORM,
  550. .dev = {
  551. .platform_data = dm644x_serial0_platform_data,
  552. }
  553. },
  554. {
  555. .name = "serial8250",
  556. .id = PLAT8250_DEV_PLATFORM1,
  557. .dev = {
  558. .platform_data = dm644x_serial1_platform_data,
  559. }
  560. },
  561. {
  562. .name = "serial8250",
  563. .id = PLAT8250_DEV_PLATFORM2,
  564. .dev = {
  565. .platform_data = dm644x_serial2_platform_data,
  566. }
  567. },
  568. {
  569. }
  570. };
  571. static const struct davinci_soc_info davinci_soc_info_dm644x = {
  572. .io_desc = dm644x_io_desc,
  573. .io_desc_num = ARRAY_SIZE(dm644x_io_desc),
  574. .jtag_id_reg = 0x01c40028,
  575. .ids = dm644x_ids,
  576. .ids_num = ARRAY_SIZE(dm644x_ids),
  577. .pinmux_base = DAVINCI_SYSTEM_MODULE_BASE,
  578. .pinmux_pins = dm644x_pins,
  579. .pinmux_pins_num = ARRAY_SIZE(dm644x_pins),
  580. .intc_base = DAVINCI_ARM_INTC_BASE,
  581. .intc_type = DAVINCI_INTC_TYPE_AINTC,
  582. .intc_irq_prios = dm644x_default_priorities,
  583. .intc_irq_num = DAVINCI_N_AINTC_IRQ,
  584. .timer_info = &dm644x_timer_info,
  585. .emac_pdata = &dm644x_emac_pdata,
  586. .sram_dma = 0x00008000,
  587. .sram_len = SZ_16K,
  588. };
  589. void __init dm644x_init_asp(void)
  590. {
  591. davinci_cfg_reg(DM644X_MCBSP);
  592. platform_device_register(&dm644x_asp_device);
  593. }
  594. void __init dm644x_init(void)
  595. {
  596. davinci_common_init(&davinci_soc_info_dm644x);
  597. davinci_map_sysmod();
  598. }
  599. void __init dm644x_init_time(void)
  600. {
  601. void __iomem *pll1, *psc;
  602. struct clk *clk;
  603. clk_register_fixed_rate(NULL, "ref_clk", NULL, 0, DM644X_REF_FREQ);
  604. pll1 = ioremap(DAVINCI_PLL1_BASE, SZ_1K);
  605. dm644x_pll1_init(NULL, pll1, NULL);
  606. psc = ioremap(DAVINCI_PWR_SLEEP_CNTRL_BASE, SZ_4K);
  607. dm644x_psc_init(NULL, psc);
  608. clk = clk_get(NULL, "timer0");
  609. davinci_timer_init(clk);
  610. }
  611. static struct resource dm644x_pll2_resources[] = {
  612. {
  613. .start = DAVINCI_PLL2_BASE,
  614. .end = DAVINCI_PLL2_BASE + SZ_1K - 1,
  615. .flags = IORESOURCE_MEM,
  616. },
  617. };
  618. static struct platform_device dm644x_pll2_device = {
  619. .name = "dm644x-pll2",
  620. .id = -1,
  621. .resource = dm644x_pll2_resources,
  622. .num_resources = ARRAY_SIZE(dm644x_pll2_resources),
  623. };
  624. void __init dm644x_register_clocks(void)
  625. {
  626. /* PLL1 and PSC are registered in dm644x_init_time() */
  627. platform_device_register(&dm644x_pll2_device);
  628. }
  629. int __init dm644x_init_video(struct vpfe_config *vpfe_cfg,
  630. struct vpbe_config *vpbe_cfg)
  631. {
  632. if (vpfe_cfg || vpbe_cfg)
  633. platform_device_register(&dm644x_vpss_device);
  634. if (vpfe_cfg) {
  635. dm644x_vpfe_dev.dev.platform_data = vpfe_cfg;
  636. platform_device_register(&dm644x_ccdc_dev);
  637. platform_device_register(&dm644x_vpfe_dev);
  638. }
  639. if (vpbe_cfg) {
  640. dm644x_vpbe_dev.dev.platform_data = vpbe_cfg;
  641. platform_device_register(&dm644x_osd_dev);
  642. platform_device_register(&dm644x_venc_dev);
  643. platform_device_register(&dm644x_vpbe_dev);
  644. platform_device_register(&dm644x_vpbe_display);
  645. }
  646. return 0;
  647. }
  648. void __init dm644x_init_devices(void)
  649. {
  650. struct platform_device *edma_pdev;
  651. int ret;
  652. edma_pdev = platform_device_register_full(&dm644x_edma_device);
  653. if (IS_ERR(edma_pdev))
  654. pr_warn("%s: Failed to register eDMA\n", __func__);
  655. platform_device_register(&dm644x_mdio_device);
  656. platform_device_register(&dm644x_emac_device);
  657. ret = davinci_init_wdt();
  658. if (ret)
  659. pr_warn("%s: watchdog init failed: %d\n", __func__, ret);
  660. }