devices.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775
  1. /*
  2. * linux/arch/arm/mach-omap2/devices.c
  3. *
  4. * OMAP2 platform device setup/initialization
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. */
  11. #include <linux/gpio.h>
  12. #include <linux/kernel.h>
  13. #include <linux/init.h>
  14. #include <linux/platform_device.h>
  15. #include <linux/io.h>
  16. #include <linux/clk.h>
  17. #include <linux/err.h>
  18. #include <linux/slab.h>
  19. #include <linux/of.h>
  20. #include <linux/platform_data/omap4-keypad.h>
  21. #include <mach/hardware.h>
  22. #include <mach/irqs.h>
  23. #include <asm/mach-types.h>
  24. #include <asm/mach/map.h>
  25. #include <asm/pmu.h>
  26. #include "iomap.h"
  27. #include <plat/board.h>
  28. #include <plat/mmc.h>
  29. #include <plat/dma.h>
  30. #include <plat/omap_hwmod.h>
  31. #include <plat/omap_device.h>
  32. #include <plat/omap4-keypad.h>
  33. #include "mux.h"
  34. #include "control.h"
  35. #include "devices.h"
  36. #define L3_MODULES_MAX_LEN 12
  37. #define L3_MODULES 3
  38. static int __init omap3_l3_init(void)
  39. {
  40. int l;
  41. struct omap_hwmod *oh;
  42. struct platform_device *pdev;
  43. char oh_name[L3_MODULES_MAX_LEN];
  44. /*
  45. * To avoid code running on other OMAPs in
  46. * multi-omap builds
  47. */
  48. if (!(cpu_is_omap34xx()))
  49. return -ENODEV;
  50. l = snprintf(oh_name, L3_MODULES_MAX_LEN, "l3_main");
  51. oh = omap_hwmod_lookup(oh_name);
  52. if (!oh)
  53. pr_err("could not look up %s\n", oh_name);
  54. pdev = omap_device_build("omap_l3_smx", 0, oh, NULL, 0,
  55. NULL, 0, 0);
  56. WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name);
  57. return IS_ERR(pdev) ? PTR_ERR(pdev) : 0;
  58. }
  59. postcore_initcall(omap3_l3_init);
  60. static int __init omap4_l3_init(void)
  61. {
  62. int l, i;
  63. struct omap_hwmod *oh[3];
  64. struct platform_device *pdev;
  65. char oh_name[L3_MODULES_MAX_LEN];
  66. /* If dtb is there, the devices will be created dynamically */
  67. if (of_have_populated_dt())
  68. return -ENODEV;
  69. /*
  70. * To avoid code running on other OMAPs in
  71. * multi-omap builds
  72. */
  73. if (!(cpu_is_omap44xx()))
  74. return -ENODEV;
  75. for (i = 0; i < L3_MODULES; i++) {
  76. l = snprintf(oh_name, L3_MODULES_MAX_LEN, "l3_main_%d", i+1);
  77. oh[i] = omap_hwmod_lookup(oh_name);
  78. if (!(oh[i]))
  79. pr_err("could not look up %s\n", oh_name);
  80. }
  81. pdev = omap_device_build_ss("omap_l3_noc", 0, oh, 3, NULL,
  82. 0, NULL, 0, 0);
  83. WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name);
  84. return IS_ERR(pdev) ? PTR_ERR(pdev) : 0;
  85. }
  86. postcore_initcall(omap4_l3_init);
  87. #if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE)
  88. static struct resource omap2cam_resources[] = {
  89. {
  90. .start = OMAP24XX_CAMERA_BASE,
  91. .end = OMAP24XX_CAMERA_BASE + 0xfff,
  92. .flags = IORESOURCE_MEM,
  93. },
  94. {
  95. .start = INT_24XX_CAM_IRQ,
  96. .flags = IORESOURCE_IRQ,
  97. }
  98. };
  99. static struct platform_device omap2cam_device = {
  100. .name = "omap24xxcam",
  101. .id = -1,
  102. .num_resources = ARRAY_SIZE(omap2cam_resources),
  103. .resource = omap2cam_resources,
  104. };
  105. #endif
  106. #if defined(CONFIG_IOMMU_API)
  107. #include <plat/iommu.h>
  108. static struct resource omap3isp_resources[] = {
  109. {
  110. .start = OMAP3430_ISP_BASE,
  111. .end = OMAP3430_ISP_END,
  112. .flags = IORESOURCE_MEM,
  113. },
  114. {
  115. .start = OMAP3430_ISP_CCP2_BASE,
  116. .end = OMAP3430_ISP_CCP2_END,
  117. .flags = IORESOURCE_MEM,
  118. },
  119. {
  120. .start = OMAP3430_ISP_CCDC_BASE,
  121. .end = OMAP3430_ISP_CCDC_END,
  122. .flags = IORESOURCE_MEM,
  123. },
  124. {
  125. .start = OMAP3430_ISP_HIST_BASE,
  126. .end = OMAP3430_ISP_HIST_END,
  127. .flags = IORESOURCE_MEM,
  128. },
  129. {
  130. .start = OMAP3430_ISP_H3A_BASE,
  131. .end = OMAP3430_ISP_H3A_END,
  132. .flags = IORESOURCE_MEM,
  133. },
  134. {
  135. .start = OMAP3430_ISP_PREV_BASE,
  136. .end = OMAP3430_ISP_PREV_END,
  137. .flags = IORESOURCE_MEM,
  138. },
  139. {
  140. .start = OMAP3430_ISP_RESZ_BASE,
  141. .end = OMAP3430_ISP_RESZ_END,
  142. .flags = IORESOURCE_MEM,
  143. },
  144. {
  145. .start = OMAP3430_ISP_SBL_BASE,
  146. .end = OMAP3430_ISP_SBL_END,
  147. .flags = IORESOURCE_MEM,
  148. },
  149. {
  150. .start = OMAP3430_ISP_CSI2A_REGS1_BASE,
  151. .end = OMAP3430_ISP_CSI2A_REGS1_END,
  152. .flags = IORESOURCE_MEM,
  153. },
  154. {
  155. .start = OMAP3430_ISP_CSIPHY2_BASE,
  156. .end = OMAP3430_ISP_CSIPHY2_END,
  157. .flags = IORESOURCE_MEM,
  158. },
  159. {
  160. .start = OMAP3630_ISP_CSI2A_REGS2_BASE,
  161. .end = OMAP3630_ISP_CSI2A_REGS2_END,
  162. .flags = IORESOURCE_MEM,
  163. },
  164. {
  165. .start = OMAP3630_ISP_CSI2C_REGS1_BASE,
  166. .end = OMAP3630_ISP_CSI2C_REGS1_END,
  167. .flags = IORESOURCE_MEM,
  168. },
  169. {
  170. .start = OMAP3630_ISP_CSIPHY1_BASE,
  171. .end = OMAP3630_ISP_CSIPHY1_END,
  172. .flags = IORESOURCE_MEM,
  173. },
  174. {
  175. .start = OMAP3630_ISP_CSI2C_REGS2_BASE,
  176. .end = OMAP3630_ISP_CSI2C_REGS2_END,
  177. .flags = IORESOURCE_MEM,
  178. },
  179. {
  180. .start = INT_34XX_CAM_IRQ,
  181. .flags = IORESOURCE_IRQ,
  182. }
  183. };
  184. static struct platform_device omap3isp_device = {
  185. .name = "omap3isp",
  186. .id = -1,
  187. .num_resources = ARRAY_SIZE(omap3isp_resources),
  188. .resource = omap3isp_resources,
  189. };
  190. static struct omap_iommu_arch_data omap3_isp_iommu = {
  191. .name = "isp",
  192. };
  193. int omap3_init_camera(struct isp_platform_data *pdata)
  194. {
  195. omap3isp_device.dev.platform_data = pdata;
  196. omap3isp_device.dev.archdata.iommu = &omap3_isp_iommu;
  197. return platform_device_register(&omap3isp_device);
  198. }
  199. #else /* !CONFIG_IOMMU_API */
  200. int omap3_init_camera(struct isp_platform_data *pdata)
  201. {
  202. return 0;
  203. }
  204. #endif
  205. static inline void omap_init_camera(void)
  206. {
  207. #if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE)
  208. if (cpu_is_omap24xx())
  209. platform_device_register(&omap2cam_device);
  210. #endif
  211. }
  212. int __init omap4_keyboard_init(struct omap4_keypad_platform_data
  213. *sdp4430_keypad_data, struct omap_board_data *bdata)
  214. {
  215. struct platform_device *pdev;
  216. struct omap_hwmod *oh;
  217. struct omap4_keypad_platform_data *keypad_data;
  218. unsigned int id = -1;
  219. char *oh_name = "kbd";
  220. char *name = "omap4-keypad";
  221. oh = omap_hwmod_lookup(oh_name);
  222. if (!oh) {
  223. pr_err("Could not look up %s\n", oh_name);
  224. return -ENODEV;
  225. }
  226. keypad_data = sdp4430_keypad_data;
  227. pdev = omap_device_build(name, id, oh, keypad_data,
  228. sizeof(struct omap4_keypad_platform_data), NULL, 0, 0);
  229. if (IS_ERR(pdev)) {
  230. WARN(1, "Can't build omap_device for %s:%s.\n",
  231. name, oh->name);
  232. return PTR_ERR(pdev);
  233. }
  234. oh->mux = omap_hwmod_mux_init(bdata->pads, bdata->pads_cnt);
  235. return 0;
  236. }
  237. #if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
  238. static inline void __init omap_init_mbox(void)
  239. {
  240. struct omap_hwmod *oh;
  241. struct platform_device *pdev;
  242. oh = omap_hwmod_lookup("mailbox");
  243. if (!oh) {
  244. pr_err("%s: unable to find hwmod\n", __func__);
  245. return;
  246. }
  247. pdev = omap_device_build("omap-mailbox", -1, oh, NULL, 0, NULL, 0, 0);
  248. WARN(IS_ERR(pdev), "%s: could not build device, err %ld\n",
  249. __func__, PTR_ERR(pdev));
  250. }
  251. #else
  252. static inline void omap_init_mbox(void) { }
  253. #endif /* CONFIG_OMAP_MBOX_FWK */
  254. static inline void omap_init_sti(void) {}
  255. #if defined(CONFIG_SND_SOC) || defined(CONFIG_SND_SOC_MODULE)
  256. static struct platform_device omap_pcm = {
  257. .name = "omap-pcm-audio",
  258. .id = -1,
  259. };
  260. static void omap_init_audio(void)
  261. {
  262. platform_device_register(&omap_pcm);
  263. }
  264. #else
  265. static inline void omap_init_audio(void) {}
  266. #endif
  267. #if defined(CONFIG_SND_OMAP_SOC_MCPDM) || \
  268. defined(CONFIG_SND_OMAP_SOC_MCPDM_MODULE)
  269. static void __init omap_init_mcpdm(void)
  270. {
  271. struct omap_hwmod *oh;
  272. struct platform_device *pdev;
  273. oh = omap_hwmod_lookup("mcpdm");
  274. if (!oh) {
  275. printk(KERN_ERR "Could not look up mcpdm hw_mod\n");
  276. return;
  277. }
  278. pdev = omap_device_build("omap-mcpdm", -1, oh, NULL, 0, NULL, 0, 0);
  279. WARN(IS_ERR(pdev), "Can't build omap_device for omap-mcpdm.\n");
  280. }
  281. #else
  282. static inline void omap_init_mcpdm(void) {}
  283. #endif
  284. #if defined(CONFIG_SND_OMAP_SOC_DMIC) || \
  285. defined(CONFIG_SND_OMAP_SOC_DMIC_MODULE)
  286. static void __init omap_init_dmic(void)
  287. {
  288. struct omap_hwmod *oh;
  289. struct platform_device *pdev;
  290. oh = omap_hwmod_lookup("dmic");
  291. if (!oh) {
  292. printk(KERN_ERR "Could not look up mcpdm hw_mod\n");
  293. return;
  294. }
  295. pdev = omap_device_build("omap-dmic", -1, oh, NULL, 0, NULL, 0, 0);
  296. WARN(IS_ERR(pdev), "Can't build omap_device for omap-dmic.\n");
  297. }
  298. #else
  299. static inline void omap_init_dmic(void) {}
  300. #endif
  301. #if defined(CONFIG_SND_OMAP_SOC_OMAP_HDMI) || \
  302. defined(CONFIG_SND_OMAP_SOC_OMAP_HDMI_MODULE)
  303. static struct platform_device omap_hdmi_audio = {
  304. .name = "omap-hdmi-audio",
  305. .id = -1,
  306. };
  307. static void __init omap_init_hdmi_audio(void)
  308. {
  309. struct omap_hwmod *oh;
  310. struct platform_device *pdev;
  311. oh = omap_hwmod_lookup("dss_hdmi");
  312. if (!oh) {
  313. printk(KERN_ERR "Could not look up dss_hdmi hw_mod\n");
  314. return;
  315. }
  316. pdev = omap_device_build("omap-hdmi-audio-dai",
  317. -1, oh, NULL, 0, NULL, 0, 0);
  318. WARN(IS_ERR(pdev),
  319. "Can't build omap_device for omap-hdmi-audio-dai.\n");
  320. platform_device_register(&omap_hdmi_audio);
  321. }
  322. #else
  323. static inline void omap_init_hdmi_audio(void) {}
  324. #endif
  325. #if defined(CONFIG_SPI_OMAP24XX) || defined(CONFIG_SPI_OMAP24XX_MODULE)
  326. #include <plat/mcspi.h>
  327. static int __init omap_mcspi_init(struct omap_hwmod *oh, void *unused)
  328. {
  329. struct platform_device *pdev;
  330. char *name = "omap2_mcspi";
  331. struct omap2_mcspi_platform_config *pdata;
  332. static int spi_num;
  333. struct omap2_mcspi_dev_attr *mcspi_attrib = oh->dev_attr;
  334. pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
  335. if (!pdata) {
  336. pr_err("Memory allocation for McSPI device failed\n");
  337. return -ENOMEM;
  338. }
  339. pdata->num_cs = mcspi_attrib->num_chipselect;
  340. switch (oh->class->rev) {
  341. case OMAP2_MCSPI_REV:
  342. case OMAP3_MCSPI_REV:
  343. pdata->regs_offset = 0;
  344. break;
  345. case OMAP4_MCSPI_REV:
  346. pdata->regs_offset = OMAP4_MCSPI_REG_OFFSET;
  347. break;
  348. default:
  349. pr_err("Invalid McSPI Revision value\n");
  350. kfree(pdata);
  351. return -EINVAL;
  352. }
  353. spi_num++;
  354. pdev = omap_device_build(name, spi_num, oh, pdata,
  355. sizeof(*pdata), NULL, 0, 0);
  356. WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s\n",
  357. name, oh->name);
  358. kfree(pdata);
  359. return 0;
  360. }
  361. static void omap_init_mcspi(void)
  362. {
  363. omap_hwmod_for_each_by_class("mcspi", omap_mcspi_init, NULL);
  364. }
  365. #else
  366. static inline void omap_init_mcspi(void) {}
  367. #endif
  368. static struct resource omap2_pmu_resource = {
  369. .start = 3,
  370. .end = 3,
  371. .flags = IORESOURCE_IRQ,
  372. };
  373. static struct resource omap3_pmu_resource = {
  374. .start = INT_34XX_BENCH_MPU_EMUL,
  375. .end = INT_34XX_BENCH_MPU_EMUL,
  376. .flags = IORESOURCE_IRQ,
  377. };
  378. static struct platform_device omap_pmu_device = {
  379. .name = "arm-pmu",
  380. .id = ARM_PMU_DEVICE_CPU,
  381. .num_resources = 1,
  382. };
  383. static void omap_init_pmu(void)
  384. {
  385. if (cpu_is_omap24xx())
  386. omap_pmu_device.resource = &omap2_pmu_resource;
  387. else if (cpu_is_omap34xx())
  388. omap_pmu_device.resource = &omap3_pmu_resource;
  389. else
  390. return;
  391. platform_device_register(&omap_pmu_device);
  392. }
  393. #if defined(CONFIG_CRYPTO_DEV_OMAP_SHAM) || defined(CONFIG_CRYPTO_DEV_OMAP_SHAM_MODULE)
  394. #ifdef CONFIG_ARCH_OMAP2
  395. static struct resource omap2_sham_resources[] = {
  396. {
  397. .start = OMAP24XX_SEC_SHA1MD5_BASE,
  398. .end = OMAP24XX_SEC_SHA1MD5_BASE + 0x64,
  399. .flags = IORESOURCE_MEM,
  400. },
  401. {
  402. .start = INT_24XX_SHA1MD5,
  403. .flags = IORESOURCE_IRQ,
  404. }
  405. };
  406. static int omap2_sham_resources_sz = ARRAY_SIZE(omap2_sham_resources);
  407. #else
  408. #define omap2_sham_resources NULL
  409. #define omap2_sham_resources_sz 0
  410. #endif
  411. #ifdef CONFIG_ARCH_OMAP3
  412. static struct resource omap3_sham_resources[] = {
  413. {
  414. .start = OMAP34XX_SEC_SHA1MD5_BASE,
  415. .end = OMAP34XX_SEC_SHA1MD5_BASE + 0x64,
  416. .flags = IORESOURCE_MEM,
  417. },
  418. {
  419. .start = INT_34XX_SHA1MD52_IRQ,
  420. .flags = IORESOURCE_IRQ,
  421. },
  422. {
  423. .start = OMAP34XX_DMA_SHA1MD5_RX,
  424. .flags = IORESOURCE_DMA,
  425. }
  426. };
  427. static int omap3_sham_resources_sz = ARRAY_SIZE(omap3_sham_resources);
  428. #else
  429. #define omap3_sham_resources NULL
  430. #define omap3_sham_resources_sz 0
  431. #endif
  432. static struct platform_device sham_device = {
  433. .name = "omap-sham",
  434. .id = -1,
  435. };
  436. static void omap_init_sham(void)
  437. {
  438. if (cpu_is_omap24xx()) {
  439. sham_device.resource = omap2_sham_resources;
  440. sham_device.num_resources = omap2_sham_resources_sz;
  441. } else if (cpu_is_omap34xx()) {
  442. sham_device.resource = omap3_sham_resources;
  443. sham_device.num_resources = omap3_sham_resources_sz;
  444. } else {
  445. pr_err("%s: platform not supported\n", __func__);
  446. return;
  447. }
  448. platform_device_register(&sham_device);
  449. }
  450. #else
  451. static inline void omap_init_sham(void) { }
  452. #endif
  453. #if defined(CONFIG_CRYPTO_DEV_OMAP_AES) || defined(CONFIG_CRYPTO_DEV_OMAP_AES_MODULE)
  454. #ifdef CONFIG_ARCH_OMAP2
  455. static struct resource omap2_aes_resources[] = {
  456. {
  457. .start = OMAP24XX_SEC_AES_BASE,
  458. .end = OMAP24XX_SEC_AES_BASE + 0x4C,
  459. .flags = IORESOURCE_MEM,
  460. },
  461. {
  462. .start = OMAP24XX_DMA_AES_TX,
  463. .flags = IORESOURCE_DMA,
  464. },
  465. {
  466. .start = OMAP24XX_DMA_AES_RX,
  467. .flags = IORESOURCE_DMA,
  468. }
  469. };
  470. static int omap2_aes_resources_sz = ARRAY_SIZE(omap2_aes_resources);
  471. #else
  472. #define omap2_aes_resources NULL
  473. #define omap2_aes_resources_sz 0
  474. #endif
  475. #ifdef CONFIG_ARCH_OMAP3
  476. static struct resource omap3_aes_resources[] = {
  477. {
  478. .start = OMAP34XX_SEC_AES_BASE,
  479. .end = OMAP34XX_SEC_AES_BASE + 0x4C,
  480. .flags = IORESOURCE_MEM,
  481. },
  482. {
  483. .start = OMAP34XX_DMA_AES2_TX,
  484. .flags = IORESOURCE_DMA,
  485. },
  486. {
  487. .start = OMAP34XX_DMA_AES2_RX,
  488. .flags = IORESOURCE_DMA,
  489. }
  490. };
  491. static int omap3_aes_resources_sz = ARRAY_SIZE(omap3_aes_resources);
  492. #else
  493. #define omap3_aes_resources NULL
  494. #define omap3_aes_resources_sz 0
  495. #endif
  496. static struct platform_device aes_device = {
  497. .name = "omap-aes",
  498. .id = -1,
  499. };
  500. static void omap_init_aes(void)
  501. {
  502. if (cpu_is_omap24xx()) {
  503. aes_device.resource = omap2_aes_resources;
  504. aes_device.num_resources = omap2_aes_resources_sz;
  505. } else if (cpu_is_omap34xx()) {
  506. aes_device.resource = omap3_aes_resources;
  507. aes_device.num_resources = omap3_aes_resources_sz;
  508. } else {
  509. pr_err("%s: platform not supported\n", __func__);
  510. return;
  511. }
  512. platform_device_register(&aes_device);
  513. }
  514. #else
  515. static inline void omap_init_aes(void) { }
  516. #endif
  517. /*-------------------------------------------------------------------------*/
  518. #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
  519. static inline void omap242x_mmc_mux(struct omap_mmc_platform_data
  520. *mmc_controller)
  521. {
  522. if ((mmc_controller->slots[0].switch_pin > 0) && \
  523. (mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES))
  524. omap_mux_init_gpio(mmc_controller->slots[0].switch_pin,
  525. OMAP_PIN_INPUT_PULLUP);
  526. if ((mmc_controller->slots[0].gpio_wp > 0) && \
  527. (mmc_controller->slots[0].gpio_wp < OMAP_MAX_GPIO_LINES))
  528. omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp,
  529. OMAP_PIN_INPUT_PULLUP);
  530. omap_mux_init_signal("sdmmc_cmd", 0);
  531. omap_mux_init_signal("sdmmc_clki", 0);
  532. omap_mux_init_signal("sdmmc_clko", 0);
  533. omap_mux_init_signal("sdmmc_dat0", 0);
  534. omap_mux_init_signal("sdmmc_dat_dir0", 0);
  535. omap_mux_init_signal("sdmmc_cmd_dir", 0);
  536. if (mmc_controller->slots[0].caps & MMC_CAP_4_BIT_DATA) {
  537. omap_mux_init_signal("sdmmc_dat1", 0);
  538. omap_mux_init_signal("sdmmc_dat2", 0);
  539. omap_mux_init_signal("sdmmc_dat3", 0);
  540. omap_mux_init_signal("sdmmc_dat_dir1", 0);
  541. omap_mux_init_signal("sdmmc_dat_dir2", 0);
  542. omap_mux_init_signal("sdmmc_dat_dir3", 0);
  543. }
  544. /*
  545. * Use internal loop-back in MMC/SDIO Module Input Clock
  546. * selection
  547. */
  548. if (mmc_controller->slots[0].internal_clock) {
  549. u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
  550. v |= (1 << 24);
  551. omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
  552. }
  553. }
  554. void __init omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data)
  555. {
  556. char *name = "mmci-omap";
  557. if (!mmc_data[0]) {
  558. pr_err("%s fails: Incomplete platform data\n", __func__);
  559. return;
  560. }
  561. omap242x_mmc_mux(mmc_data[0]);
  562. omap_mmc_add(name, 0, OMAP2_MMC1_BASE, OMAP2420_MMC_SIZE,
  563. INT_24XX_MMC_IRQ, mmc_data[0]);
  564. }
  565. #endif
  566. /*-------------------------------------------------------------------------*/
  567. #if defined(CONFIG_HDQ_MASTER_OMAP) || defined(CONFIG_HDQ_MASTER_OMAP_MODULE)
  568. #define OMAP_HDQ_BASE 0x480B2000
  569. static struct resource omap_hdq_resources[] = {
  570. {
  571. .start = OMAP_HDQ_BASE,
  572. .end = OMAP_HDQ_BASE + 0x1C,
  573. .flags = IORESOURCE_MEM,
  574. },
  575. {
  576. .start = INT_24XX_HDQ_IRQ,
  577. .flags = IORESOURCE_IRQ,
  578. },
  579. };
  580. static struct platform_device omap_hdq_dev = {
  581. .name = "omap_hdq",
  582. .id = 0,
  583. .dev = {
  584. .platform_data = NULL,
  585. },
  586. .num_resources = ARRAY_SIZE(omap_hdq_resources),
  587. .resource = omap_hdq_resources,
  588. };
  589. static inline void omap_hdq_init(void)
  590. {
  591. if (cpu_is_omap2420())
  592. return;
  593. platform_device_register(&omap_hdq_dev);
  594. }
  595. #else
  596. static inline void omap_hdq_init(void) {}
  597. #endif
  598. /*---------------------------------------------------------------------------*/
  599. #if defined(CONFIG_VIDEO_OMAP2_VOUT) || \
  600. defined(CONFIG_VIDEO_OMAP2_VOUT_MODULE)
  601. #if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE)
  602. static struct resource omap_vout_resource[3 - CONFIG_FB_OMAP2_NUM_FBS] = {
  603. };
  604. #else
  605. static struct resource omap_vout_resource[2] = {
  606. };
  607. #endif
  608. static struct platform_device omap_vout_device = {
  609. .name = "omap_vout",
  610. .num_resources = ARRAY_SIZE(omap_vout_resource),
  611. .resource = &omap_vout_resource[0],
  612. .id = -1,
  613. };
  614. static void omap_init_vout(void)
  615. {
  616. if (platform_device_register(&omap_vout_device) < 0)
  617. printk(KERN_ERR "Unable to register OMAP-VOUT device\n");
  618. }
  619. #else
  620. static inline void omap_init_vout(void) {}
  621. #endif
  622. /*-------------------------------------------------------------------------*/
  623. static int __init omap2_init_devices(void)
  624. {
  625. /*
  626. * please keep these calls, and their implementations above,
  627. * in alphabetical order so they're easier to sort through.
  628. */
  629. omap_init_audio();
  630. omap_init_mcpdm();
  631. omap_init_dmic();
  632. omap_init_camera();
  633. omap_init_hdmi_audio();
  634. omap_init_mbox();
  635. omap_init_mcspi();
  636. omap_init_pmu();
  637. omap_hdq_init();
  638. omap_init_sti();
  639. omap_init_sham();
  640. omap_init_aes();
  641. omap_init_vout();
  642. return 0;
  643. }
  644. arch_initcall(omap2_init_devices);
  645. #if defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE)
  646. static int __init omap_init_wdt(void)
  647. {
  648. int id = -1;
  649. struct platform_device *pdev;
  650. struct omap_hwmod *oh;
  651. char *oh_name = "wd_timer2";
  652. char *dev_name = "omap_wdt";
  653. if (!cpu_class_is_omap2())
  654. return 0;
  655. oh = omap_hwmod_lookup(oh_name);
  656. if (!oh) {
  657. pr_err("Could not look up wd_timer%d hwmod\n", id);
  658. return -EINVAL;
  659. }
  660. pdev = omap_device_build(dev_name, id, oh, NULL, 0, NULL, 0, 0);
  661. WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s.\n",
  662. dev_name, oh->name);
  663. return 0;
  664. }
  665. subsys_initcall(omap_init_wdt);
  666. #endif