devices.c 15 KB

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