devices.c 15 KB

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