devices.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684
  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/pinctrl/machine.h>
  21. #include <linux/platform_data/omap4-keypad.h>
  22. #include <asm/mach-types.h>
  23. #include <asm/mach/map.h>
  24. #include <asm/pmu.h>
  25. #include "iomap.h"
  26. #include <plat/dma.h>
  27. #include <plat/omap_hwmod.h>
  28. #include <plat/omap_device.h>
  29. #include <plat/omap4-keypad.h>
  30. #include "soc.h"
  31. #include "common.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 = 24 + OMAP_INTC_START,
  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 = 24 + OMAP_INTC_START,
  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 + OMAP_INTC_START,
  368. .flags = IORESOURCE_IRQ,
  369. };
  370. static struct resource omap3_pmu_resource = {
  371. .start = 3 + OMAP_INTC_START,
  372. .flags = IORESOURCE_IRQ,
  373. };
  374. static struct platform_device omap_pmu_device = {
  375. .name = "arm-pmu",
  376. .id = ARM_PMU_DEVICE_CPU,
  377. .num_resources = 1,
  378. };
  379. static void omap_init_pmu(void)
  380. {
  381. if (cpu_is_omap24xx())
  382. omap_pmu_device.resource = &omap2_pmu_resource;
  383. else if (cpu_is_omap34xx())
  384. omap_pmu_device.resource = &omap3_pmu_resource;
  385. else
  386. return;
  387. platform_device_register(&omap_pmu_device);
  388. }
  389. #if defined(CONFIG_CRYPTO_DEV_OMAP_SHAM) || defined(CONFIG_CRYPTO_DEV_OMAP_SHAM_MODULE)
  390. #ifdef CONFIG_ARCH_OMAP2
  391. static struct resource omap2_sham_resources[] = {
  392. {
  393. .start = OMAP24XX_SEC_SHA1MD5_BASE,
  394. .end = OMAP24XX_SEC_SHA1MD5_BASE + 0x64,
  395. .flags = IORESOURCE_MEM,
  396. },
  397. {
  398. .start = 51 + OMAP_INTC_START,
  399. .flags = IORESOURCE_IRQ,
  400. }
  401. };
  402. static int omap2_sham_resources_sz = ARRAY_SIZE(omap2_sham_resources);
  403. #else
  404. #define omap2_sham_resources NULL
  405. #define omap2_sham_resources_sz 0
  406. #endif
  407. #ifdef CONFIG_ARCH_OMAP3
  408. static struct resource omap3_sham_resources[] = {
  409. {
  410. .start = OMAP34XX_SEC_SHA1MD5_BASE,
  411. .end = OMAP34XX_SEC_SHA1MD5_BASE + 0x64,
  412. .flags = IORESOURCE_MEM,
  413. },
  414. {
  415. .start = 49 + OMAP_INTC_START,
  416. .flags = IORESOURCE_IRQ,
  417. },
  418. {
  419. .start = OMAP34XX_DMA_SHA1MD5_RX,
  420. .flags = IORESOURCE_DMA,
  421. }
  422. };
  423. static int omap3_sham_resources_sz = ARRAY_SIZE(omap3_sham_resources);
  424. #else
  425. #define omap3_sham_resources NULL
  426. #define omap3_sham_resources_sz 0
  427. #endif
  428. static struct platform_device sham_device = {
  429. .name = "omap-sham",
  430. .id = -1,
  431. };
  432. static void omap_init_sham(void)
  433. {
  434. if (cpu_is_omap24xx()) {
  435. sham_device.resource = omap2_sham_resources;
  436. sham_device.num_resources = omap2_sham_resources_sz;
  437. } else if (cpu_is_omap34xx()) {
  438. sham_device.resource = omap3_sham_resources;
  439. sham_device.num_resources = omap3_sham_resources_sz;
  440. } else {
  441. pr_err("%s: platform not supported\n", __func__);
  442. return;
  443. }
  444. platform_device_register(&sham_device);
  445. }
  446. #else
  447. static inline void omap_init_sham(void) { }
  448. #endif
  449. #if defined(CONFIG_CRYPTO_DEV_OMAP_AES) || defined(CONFIG_CRYPTO_DEV_OMAP_AES_MODULE)
  450. #ifdef CONFIG_ARCH_OMAP2
  451. static struct resource omap2_aes_resources[] = {
  452. {
  453. .start = OMAP24XX_SEC_AES_BASE,
  454. .end = OMAP24XX_SEC_AES_BASE + 0x4C,
  455. .flags = IORESOURCE_MEM,
  456. },
  457. {
  458. .start = OMAP24XX_DMA_AES_TX,
  459. .flags = IORESOURCE_DMA,
  460. },
  461. {
  462. .start = OMAP24XX_DMA_AES_RX,
  463. .flags = IORESOURCE_DMA,
  464. }
  465. };
  466. static int omap2_aes_resources_sz = ARRAY_SIZE(omap2_aes_resources);
  467. #else
  468. #define omap2_aes_resources NULL
  469. #define omap2_aes_resources_sz 0
  470. #endif
  471. #ifdef CONFIG_ARCH_OMAP3
  472. static struct resource omap3_aes_resources[] = {
  473. {
  474. .start = OMAP34XX_SEC_AES_BASE,
  475. .end = OMAP34XX_SEC_AES_BASE + 0x4C,
  476. .flags = IORESOURCE_MEM,
  477. },
  478. {
  479. .start = OMAP34XX_DMA_AES2_TX,
  480. .flags = IORESOURCE_DMA,
  481. },
  482. {
  483. .start = OMAP34XX_DMA_AES2_RX,
  484. .flags = IORESOURCE_DMA,
  485. }
  486. };
  487. static int omap3_aes_resources_sz = ARRAY_SIZE(omap3_aes_resources);
  488. #else
  489. #define omap3_aes_resources NULL
  490. #define omap3_aes_resources_sz 0
  491. #endif
  492. static struct platform_device aes_device = {
  493. .name = "omap-aes",
  494. .id = -1,
  495. };
  496. static void omap_init_aes(void)
  497. {
  498. if (cpu_is_omap24xx()) {
  499. aes_device.resource = omap2_aes_resources;
  500. aes_device.num_resources = omap2_aes_resources_sz;
  501. } else if (cpu_is_omap34xx()) {
  502. aes_device.resource = omap3_aes_resources;
  503. aes_device.num_resources = omap3_aes_resources_sz;
  504. } else {
  505. pr_err("%s: platform not supported\n", __func__);
  506. return;
  507. }
  508. platform_device_register(&aes_device);
  509. }
  510. #else
  511. static inline void omap_init_aes(void) { }
  512. #endif
  513. /*-------------------------------------------------------------------------*/
  514. #if defined(CONFIG_VIDEO_OMAP2_VOUT) || \
  515. defined(CONFIG_VIDEO_OMAP2_VOUT_MODULE)
  516. #if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE)
  517. static struct resource omap_vout_resource[3 - CONFIG_FB_OMAP2_NUM_FBS] = {
  518. };
  519. #else
  520. static struct resource omap_vout_resource[2] = {
  521. };
  522. #endif
  523. static struct platform_device omap_vout_device = {
  524. .name = "omap_vout",
  525. .num_resources = ARRAY_SIZE(omap_vout_resource),
  526. .resource = &omap_vout_resource[0],
  527. .id = -1,
  528. };
  529. static void omap_init_vout(void)
  530. {
  531. if (platform_device_register(&omap_vout_device) < 0)
  532. printk(KERN_ERR "Unable to register OMAP-VOUT device\n");
  533. }
  534. #else
  535. static inline void omap_init_vout(void) {}
  536. #endif
  537. /*-------------------------------------------------------------------------*/
  538. static int __init omap2_init_devices(void)
  539. {
  540. /* Enable dummy states for those platforms without pinctrl support */
  541. if (!of_have_populated_dt())
  542. pinctrl_provide_dummies();
  543. /*
  544. * please keep these calls, and their implementations above,
  545. * in alphabetical order so they're easier to sort through.
  546. */
  547. omap_init_audio();
  548. omap_init_camera();
  549. omap_init_hdmi_audio();
  550. omap_init_mbox();
  551. /* If dtb is there, the devices will be created dynamically */
  552. if (!of_have_populated_dt()) {
  553. omap_init_dmic();
  554. omap_init_mcpdm();
  555. omap_init_mcspi();
  556. }
  557. omap_init_pmu();
  558. omap_init_sti();
  559. omap_init_sham();
  560. omap_init_aes();
  561. omap_init_vout();
  562. return 0;
  563. }
  564. arch_initcall(omap2_init_devices);
  565. #if defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE)
  566. static int __init omap_init_wdt(void)
  567. {
  568. int id = -1;
  569. struct platform_device *pdev;
  570. struct omap_hwmod *oh;
  571. char *oh_name = "wd_timer2";
  572. char *dev_name = "omap_wdt";
  573. if (!cpu_class_is_omap2() || of_have_populated_dt())
  574. return 0;
  575. oh = omap_hwmod_lookup(oh_name);
  576. if (!oh) {
  577. pr_err("Could not look up wd_timer%d hwmod\n", id);
  578. return -EINVAL;
  579. }
  580. pdev = omap_device_build(dev_name, id, oh, NULL, 0, NULL, 0, 0);
  581. WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s.\n",
  582. dev_name, oh->name);
  583. return 0;
  584. }
  585. subsys_initcall(omap_init_wdt);
  586. #endif