devices.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706
  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/module.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 <mach/hardware.h>
  18. #include <asm/mach-types.h>
  19. #include <asm/mach/map.h>
  20. #include <mach/control.h>
  21. #include <mach/tc.h>
  22. #include <mach/board.h>
  23. #include <mach/mux.h>
  24. #include <mach/gpio.h>
  25. #include <mach/mmc.h>
  26. #if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE)
  27. static struct resource cam_resources[] = {
  28. {
  29. .start = OMAP24XX_CAMERA_BASE,
  30. .end = OMAP24XX_CAMERA_BASE + 0xfff,
  31. .flags = IORESOURCE_MEM,
  32. },
  33. {
  34. .start = INT_24XX_CAM_IRQ,
  35. .flags = IORESOURCE_IRQ,
  36. }
  37. };
  38. static struct platform_device omap_cam_device = {
  39. .name = "omap24xxcam",
  40. .id = -1,
  41. .num_resources = ARRAY_SIZE(cam_resources),
  42. .resource = cam_resources,
  43. };
  44. static inline void omap_init_camera(void)
  45. {
  46. platform_device_register(&omap_cam_device);
  47. }
  48. #elif defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE)
  49. static struct resource omap3isp_resources[] = {
  50. {
  51. .start = OMAP3430_ISP_BASE,
  52. .end = OMAP3430_ISP_END,
  53. .flags = IORESOURCE_MEM,
  54. },
  55. {
  56. .start = OMAP3430_ISP_CBUFF_BASE,
  57. .end = OMAP3430_ISP_CBUFF_END,
  58. .flags = IORESOURCE_MEM,
  59. },
  60. {
  61. .start = OMAP3430_ISP_CCP2_BASE,
  62. .end = OMAP3430_ISP_CCP2_END,
  63. .flags = IORESOURCE_MEM,
  64. },
  65. {
  66. .start = OMAP3430_ISP_CCDC_BASE,
  67. .end = OMAP3430_ISP_CCDC_END,
  68. .flags = IORESOURCE_MEM,
  69. },
  70. {
  71. .start = OMAP3430_ISP_HIST_BASE,
  72. .end = OMAP3430_ISP_HIST_END,
  73. .flags = IORESOURCE_MEM,
  74. },
  75. {
  76. .start = OMAP3430_ISP_H3A_BASE,
  77. .end = OMAP3430_ISP_H3A_END,
  78. .flags = IORESOURCE_MEM,
  79. },
  80. {
  81. .start = OMAP3430_ISP_PREV_BASE,
  82. .end = OMAP3430_ISP_PREV_END,
  83. .flags = IORESOURCE_MEM,
  84. },
  85. {
  86. .start = OMAP3430_ISP_RESZ_BASE,
  87. .end = OMAP3430_ISP_RESZ_END,
  88. .flags = IORESOURCE_MEM,
  89. },
  90. {
  91. .start = OMAP3430_ISP_SBL_BASE,
  92. .end = OMAP3430_ISP_SBL_END,
  93. .flags = IORESOURCE_MEM,
  94. },
  95. {
  96. .start = OMAP3430_ISP_CSI2A_BASE,
  97. .end = OMAP3430_ISP_CSI2A_END,
  98. .flags = IORESOURCE_MEM,
  99. },
  100. {
  101. .start = OMAP3430_ISP_CSI2PHY_BASE,
  102. .end = OMAP3430_ISP_CSI2PHY_END,
  103. .flags = IORESOURCE_MEM,
  104. },
  105. {
  106. .start = INT_34XX_CAM_IRQ,
  107. .flags = IORESOURCE_IRQ,
  108. }
  109. };
  110. static struct platform_device omap3isp_device = {
  111. .name = "omap3isp",
  112. .id = -1,
  113. .num_resources = ARRAY_SIZE(omap3isp_resources),
  114. .resource = omap3isp_resources,
  115. };
  116. static inline void omap_init_camera(void)
  117. {
  118. platform_device_register(&omap3isp_device);
  119. }
  120. #else
  121. static inline void omap_init_camera(void)
  122. {
  123. }
  124. #endif
  125. #if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
  126. #define MBOX_REG_SIZE 0x120
  127. static struct resource omap2_mbox_resources[] = {
  128. {
  129. .start = OMAP24XX_MAILBOX_BASE,
  130. .end = OMAP24XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
  131. .flags = IORESOURCE_MEM,
  132. },
  133. {
  134. .start = INT_24XX_MAIL_U0_MPU,
  135. .flags = IORESOURCE_IRQ,
  136. },
  137. {
  138. .start = INT_24XX_MAIL_U3_MPU,
  139. .flags = IORESOURCE_IRQ,
  140. },
  141. };
  142. static struct resource omap3_mbox_resources[] = {
  143. {
  144. .start = OMAP34XX_MAILBOX_BASE,
  145. .end = OMAP34XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
  146. .flags = IORESOURCE_MEM,
  147. },
  148. {
  149. .start = INT_24XX_MAIL_U0_MPU,
  150. .flags = IORESOURCE_IRQ,
  151. },
  152. };
  153. static struct platform_device mbox_device = {
  154. .name = "omap2-mailbox",
  155. .id = -1,
  156. };
  157. static inline void omap_init_mbox(void)
  158. {
  159. if (cpu_is_omap2420()) {
  160. mbox_device.num_resources = ARRAY_SIZE(omap2_mbox_resources);
  161. mbox_device.resource = omap2_mbox_resources;
  162. } else if (cpu_is_omap3430()) {
  163. mbox_device.num_resources = ARRAY_SIZE(omap3_mbox_resources);
  164. mbox_device.resource = omap3_mbox_resources;
  165. } else {
  166. pr_err("%s: platform not supported\n", __func__);
  167. return;
  168. }
  169. platform_device_register(&mbox_device);
  170. }
  171. #else
  172. static inline void omap_init_mbox(void) { }
  173. #endif /* CONFIG_OMAP_MBOX_FWK */
  174. #if defined(CONFIG_OMAP_STI)
  175. #if defined(CONFIG_ARCH_OMAP2)
  176. #define OMAP2_STI_BASE 0x48068000
  177. #define OMAP2_STI_CHANNEL_BASE 0x54000000
  178. #define OMAP2_STI_IRQ 4
  179. static struct resource sti_resources[] = {
  180. {
  181. .start = OMAP2_STI_BASE,
  182. .end = OMAP2_STI_BASE + 0x7ff,
  183. .flags = IORESOURCE_MEM,
  184. },
  185. {
  186. .start = OMAP2_STI_CHANNEL_BASE,
  187. .end = OMAP2_STI_CHANNEL_BASE + SZ_64K - 1,
  188. .flags = IORESOURCE_MEM,
  189. },
  190. {
  191. .start = OMAP2_STI_IRQ,
  192. .flags = IORESOURCE_IRQ,
  193. }
  194. };
  195. #elif defined(CONFIG_ARCH_OMAP3)
  196. #define OMAP3_SDTI_BASE 0x54500000
  197. #define OMAP3_SDTI_CHANNEL_BASE 0x54600000
  198. static struct resource sti_resources[] = {
  199. {
  200. .start = OMAP3_SDTI_BASE,
  201. .end = OMAP3_SDTI_BASE + 0xFFF,
  202. .flags = IORESOURCE_MEM,
  203. },
  204. {
  205. .start = OMAP3_SDTI_CHANNEL_BASE,
  206. .end = OMAP3_SDTI_CHANNEL_BASE + SZ_1M - 1,
  207. .flags = IORESOURCE_MEM,
  208. }
  209. };
  210. #endif
  211. static struct platform_device sti_device = {
  212. .name = "sti",
  213. .id = -1,
  214. .num_resources = ARRAY_SIZE(sti_resources),
  215. .resource = sti_resources,
  216. };
  217. static inline void omap_init_sti(void)
  218. {
  219. platform_device_register(&sti_device);
  220. }
  221. #else
  222. static inline void omap_init_sti(void) {}
  223. #endif
  224. #if defined(CONFIG_SPI_OMAP24XX) || defined(CONFIG_SPI_OMAP24XX_MODULE)
  225. #include <mach/mcspi.h>
  226. #define OMAP2_MCSPI1_BASE 0x48098000
  227. #define OMAP2_MCSPI2_BASE 0x4809a000
  228. #define OMAP2_MCSPI3_BASE 0x480b8000
  229. #define OMAP2_MCSPI4_BASE 0x480ba000
  230. #define OMAP4_MCSPI1_BASE 0x48098100
  231. #define OMAP4_MCSPI2_BASE 0x4809a100
  232. #define OMAP4_MCSPI3_BASE 0x480b8100
  233. #define OMAP4_MCSPI4_BASE 0x480ba100
  234. static struct omap2_mcspi_platform_config omap2_mcspi1_config = {
  235. .num_cs = 4,
  236. };
  237. static struct resource omap2_mcspi1_resources[] = {
  238. {
  239. .start = OMAP2_MCSPI1_BASE,
  240. .end = OMAP2_MCSPI1_BASE + 0xff,
  241. .flags = IORESOURCE_MEM,
  242. },
  243. };
  244. static struct platform_device omap2_mcspi1 = {
  245. .name = "omap2_mcspi",
  246. .id = 1,
  247. .num_resources = ARRAY_SIZE(omap2_mcspi1_resources),
  248. .resource = omap2_mcspi1_resources,
  249. .dev = {
  250. .platform_data = &omap2_mcspi1_config,
  251. },
  252. };
  253. static struct omap2_mcspi_platform_config omap2_mcspi2_config = {
  254. .num_cs = 2,
  255. };
  256. static struct resource omap2_mcspi2_resources[] = {
  257. {
  258. .start = OMAP2_MCSPI2_BASE,
  259. .end = OMAP2_MCSPI2_BASE + 0xff,
  260. .flags = IORESOURCE_MEM,
  261. },
  262. };
  263. static struct platform_device omap2_mcspi2 = {
  264. .name = "omap2_mcspi",
  265. .id = 2,
  266. .num_resources = ARRAY_SIZE(omap2_mcspi2_resources),
  267. .resource = omap2_mcspi2_resources,
  268. .dev = {
  269. .platform_data = &omap2_mcspi2_config,
  270. },
  271. };
  272. #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) || \
  273. defined(CONFIG_ARCH_OMAP4)
  274. static struct omap2_mcspi_platform_config omap2_mcspi3_config = {
  275. .num_cs = 2,
  276. };
  277. static struct resource omap2_mcspi3_resources[] = {
  278. {
  279. .start = OMAP2_MCSPI3_BASE,
  280. .end = OMAP2_MCSPI3_BASE + 0xff,
  281. .flags = IORESOURCE_MEM,
  282. },
  283. };
  284. static struct platform_device omap2_mcspi3 = {
  285. .name = "omap2_mcspi",
  286. .id = 3,
  287. .num_resources = ARRAY_SIZE(omap2_mcspi3_resources),
  288. .resource = omap2_mcspi3_resources,
  289. .dev = {
  290. .platform_data = &omap2_mcspi3_config,
  291. },
  292. };
  293. #endif
  294. #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
  295. static struct omap2_mcspi_platform_config omap2_mcspi4_config = {
  296. .num_cs = 1,
  297. };
  298. static struct resource omap2_mcspi4_resources[] = {
  299. {
  300. .start = OMAP2_MCSPI4_BASE,
  301. .end = OMAP2_MCSPI4_BASE + 0xff,
  302. .flags = IORESOURCE_MEM,
  303. },
  304. };
  305. static struct platform_device omap2_mcspi4 = {
  306. .name = "omap2_mcspi",
  307. .id = 4,
  308. .num_resources = ARRAY_SIZE(omap2_mcspi4_resources),
  309. .resource = omap2_mcspi4_resources,
  310. .dev = {
  311. .platform_data = &omap2_mcspi4_config,
  312. },
  313. };
  314. #endif
  315. static void omap_init_mcspi(void)
  316. {
  317. if (cpu_is_omap44xx()) {
  318. omap2_mcspi1_resources[0].start = OMAP4_MCSPI1_BASE;
  319. omap2_mcspi1_resources[0].end = OMAP4_MCSPI1_BASE + 0xff;
  320. omap2_mcspi2_resources[0].start = OMAP4_MCSPI2_BASE;
  321. omap2_mcspi2_resources[0].end = OMAP4_MCSPI2_BASE + 0xff;
  322. omap2_mcspi3_resources[0].start = OMAP4_MCSPI3_BASE;
  323. omap2_mcspi3_resources[0].end = OMAP4_MCSPI3_BASE + 0xff;
  324. omap2_mcspi4_resources[0].start = OMAP4_MCSPI4_BASE;
  325. omap2_mcspi4_resources[0].end = OMAP4_MCSPI4_BASE + 0xff;
  326. }
  327. platform_device_register(&omap2_mcspi1);
  328. platform_device_register(&omap2_mcspi2);
  329. #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) || \
  330. defined(CONFIG_ARCH_OMAP4)
  331. if (cpu_is_omap2430() || cpu_is_omap343x() || cpu_is_omap44xx())
  332. platform_device_register(&omap2_mcspi3);
  333. #endif
  334. #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
  335. if (cpu_is_omap343x() || cpu_is_omap44xx())
  336. platform_device_register(&omap2_mcspi4);
  337. #endif
  338. }
  339. #else
  340. static inline void omap_init_mcspi(void) {}
  341. #endif
  342. #ifdef CONFIG_OMAP_SHA1_MD5
  343. static struct resource sha1_md5_resources[] = {
  344. {
  345. .start = OMAP24XX_SEC_SHA1MD5_BASE,
  346. .end = OMAP24XX_SEC_SHA1MD5_BASE + 0x64,
  347. .flags = IORESOURCE_MEM,
  348. },
  349. {
  350. .start = INT_24XX_SHA1MD5,
  351. .flags = IORESOURCE_IRQ,
  352. }
  353. };
  354. static struct platform_device sha1_md5_device = {
  355. .name = "OMAP SHA1/MD5",
  356. .id = -1,
  357. .num_resources = ARRAY_SIZE(sha1_md5_resources),
  358. .resource = sha1_md5_resources,
  359. };
  360. static void omap_init_sha1_md5(void)
  361. {
  362. platform_device_register(&sha1_md5_device);
  363. }
  364. #else
  365. static inline void omap_init_sha1_md5(void) { }
  366. #endif
  367. /*-------------------------------------------------------------------------*/
  368. #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
  369. #define MMCHS_SYSCONFIG 0x0010
  370. #define MMCHS_SYSCONFIG_SWRESET (1 << 1)
  371. #define MMCHS_SYSSTATUS 0x0014
  372. #define MMCHS_SYSSTATUS_RESETDONE (1 << 0)
  373. static struct platform_device dummy_pdev = {
  374. .dev = {
  375. .bus = &platform_bus_type,
  376. },
  377. };
  378. /**
  379. * omap_hsmmc_reset() - Full reset of each HS-MMC controller
  380. *
  381. * Ensure that each MMC controller is fully reset. Controllers
  382. * left in an unknown state (by bootloader) may prevent retention
  383. * or OFF-mode. This is especially important in cases where the
  384. * MMC driver is not enabled, _or_ built as a module.
  385. *
  386. * In order for reset to work, interface, functional and debounce
  387. * clocks must be enabled. The debounce clock comes from func_32k_clk
  388. * and is not under SW control, so we only enable i- and f-clocks.
  389. **/
  390. static void __init omap_hsmmc_reset(void)
  391. {
  392. u32 i, nr_controllers = cpu_is_omap44xx() ? OMAP44XX_NR_MMC :
  393. (cpu_is_omap34xx() ? OMAP34XX_NR_MMC : OMAP24XX_NR_MMC);
  394. for (i = 0; i < nr_controllers; i++) {
  395. u32 v, base = 0;
  396. struct clk *iclk, *fclk;
  397. struct device *dev = &dummy_pdev.dev;
  398. switch (i) {
  399. case 0:
  400. base = OMAP2_MMC1_BASE;
  401. break;
  402. case 1:
  403. base = OMAP2_MMC2_BASE;
  404. break;
  405. case 2:
  406. base = OMAP3_MMC3_BASE;
  407. break;
  408. case 3:
  409. if (!cpu_is_omap44xx())
  410. return;
  411. base = OMAP4_MMC4_BASE;
  412. break;
  413. case 4:
  414. if (!cpu_is_omap44xx())
  415. return;
  416. base = OMAP4_MMC5_BASE;
  417. break;
  418. }
  419. if (cpu_is_omap44xx())
  420. base += OMAP4_MMC_REG_OFFSET;
  421. dummy_pdev.id = i;
  422. dev_set_name(&dummy_pdev.dev, "mmci-omap-hs.%d", i);
  423. iclk = clk_get(dev, "ick");
  424. if (iclk && clk_enable(iclk))
  425. iclk = NULL;
  426. fclk = clk_get(dev, "fck");
  427. if (fclk && clk_enable(fclk))
  428. fclk = NULL;
  429. if (!iclk || !fclk) {
  430. printk(KERN_WARNING
  431. "%s: Unable to enable clocks for MMC%d, "
  432. "cannot reset.\n", __func__, i);
  433. break;
  434. }
  435. omap_writel(MMCHS_SYSCONFIG_SWRESET, base + MMCHS_SYSCONFIG);
  436. v = omap_readl(base + MMCHS_SYSSTATUS);
  437. while (!(omap_readl(base + MMCHS_SYSSTATUS) &
  438. MMCHS_SYSSTATUS_RESETDONE))
  439. cpu_relax();
  440. if (fclk) {
  441. clk_disable(fclk);
  442. clk_put(fclk);
  443. }
  444. if (iclk) {
  445. clk_disable(iclk);
  446. clk_put(iclk);
  447. }
  448. }
  449. }
  450. #else
  451. static inline void omap_hsmmc_reset(void) {}
  452. #endif
  453. #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
  454. defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
  455. static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller,
  456. int controller_nr)
  457. {
  458. if (cpu_is_omap2420() && controller_nr == 0) {
  459. omap_cfg_reg(H18_24XX_MMC_CMD);
  460. omap_cfg_reg(H15_24XX_MMC_CLKI);
  461. omap_cfg_reg(G19_24XX_MMC_CLKO);
  462. omap_cfg_reg(F20_24XX_MMC_DAT0);
  463. omap_cfg_reg(F19_24XX_MMC_DAT_DIR0);
  464. omap_cfg_reg(G18_24XX_MMC_CMD_DIR);
  465. if (mmc_controller->slots[0].wires == 4) {
  466. omap_cfg_reg(H14_24XX_MMC_DAT1);
  467. omap_cfg_reg(E19_24XX_MMC_DAT2);
  468. omap_cfg_reg(D19_24XX_MMC_DAT3);
  469. omap_cfg_reg(E20_24XX_MMC_DAT_DIR1);
  470. omap_cfg_reg(F18_24XX_MMC_DAT_DIR2);
  471. omap_cfg_reg(E18_24XX_MMC_DAT_DIR3);
  472. }
  473. /*
  474. * Use internal loop-back in MMC/SDIO Module Input Clock
  475. * selection
  476. */
  477. if (mmc_controller->slots[0].internal_clock) {
  478. u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
  479. v |= (1 << 24);
  480. omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
  481. }
  482. }
  483. if (cpu_is_omap3430()) {
  484. if (controller_nr == 0) {
  485. omap_cfg_reg(N28_3430_MMC1_CLK);
  486. omap_cfg_reg(M27_3430_MMC1_CMD);
  487. omap_cfg_reg(N27_3430_MMC1_DAT0);
  488. if (mmc_controller->slots[0].wires == 4 ||
  489. mmc_controller->slots[0].wires == 8) {
  490. omap_cfg_reg(N26_3430_MMC1_DAT1);
  491. omap_cfg_reg(N25_3430_MMC1_DAT2);
  492. omap_cfg_reg(P28_3430_MMC1_DAT3);
  493. }
  494. if (mmc_controller->slots[0].wires == 8) {
  495. omap_cfg_reg(P27_3430_MMC1_DAT4);
  496. omap_cfg_reg(P26_3430_MMC1_DAT5);
  497. omap_cfg_reg(R27_3430_MMC1_DAT6);
  498. omap_cfg_reg(R25_3430_MMC1_DAT7);
  499. }
  500. }
  501. if (controller_nr == 1) {
  502. /* MMC2 */
  503. omap_cfg_reg(AE2_3430_MMC2_CLK);
  504. omap_cfg_reg(AG5_3430_MMC2_CMD);
  505. omap_cfg_reg(AH5_3430_MMC2_DAT0);
  506. /*
  507. * For 8 wire configurations, Lines DAT4, 5, 6 and 7 need to be muxed
  508. * in the board-*.c files
  509. */
  510. if (mmc_controller->slots[0].wires == 4 ||
  511. mmc_controller->slots[0].wires == 8) {
  512. omap_cfg_reg(AH4_3430_MMC2_DAT1);
  513. omap_cfg_reg(AG4_3430_MMC2_DAT2);
  514. omap_cfg_reg(AF4_3430_MMC2_DAT3);
  515. }
  516. }
  517. /*
  518. * For MMC3 the pins need to be muxed in the board-*.c files
  519. */
  520. }
  521. }
  522. void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
  523. int nr_controllers)
  524. {
  525. int i;
  526. char *name;
  527. for (i = 0; i < nr_controllers; i++) {
  528. unsigned long base, size;
  529. unsigned int irq = 0;
  530. if (!mmc_data[i])
  531. continue;
  532. omap2_mmc_mux(mmc_data[i], i);
  533. switch (i) {
  534. case 0:
  535. base = OMAP2_MMC1_BASE;
  536. irq = INT_24XX_MMC_IRQ;
  537. break;
  538. case 1:
  539. base = OMAP2_MMC2_BASE;
  540. irq = INT_24XX_MMC2_IRQ;
  541. break;
  542. case 2:
  543. if (!cpu_is_omap44xx() && !cpu_is_omap34xx())
  544. return;
  545. base = OMAP3_MMC3_BASE;
  546. irq = INT_34XX_MMC3_IRQ;
  547. break;
  548. case 3:
  549. if (!cpu_is_omap44xx())
  550. return;
  551. base = OMAP4_MMC4_BASE + OMAP4_MMC_REG_OFFSET;
  552. irq = INT_44XX_MMC4_IRQ;
  553. break;
  554. case 4:
  555. if (!cpu_is_omap44xx())
  556. return;
  557. base = OMAP4_MMC5_BASE + OMAP4_MMC_REG_OFFSET;
  558. irq = INT_44XX_MMC5_IRQ;
  559. break;
  560. default:
  561. continue;
  562. }
  563. if (cpu_is_omap2420()) {
  564. size = OMAP2420_MMC_SIZE;
  565. name = "mmci-omap";
  566. } else if (cpu_is_omap44xx()) {
  567. if (i < 3) {
  568. base += OMAP4_MMC_REG_OFFSET;
  569. irq += IRQ_GIC_START;
  570. }
  571. size = OMAP4_HSMMC_SIZE;
  572. name = "mmci-omap-hs";
  573. } else {
  574. size = OMAP3_HSMMC_SIZE;
  575. name = "mmci-omap-hs";
  576. }
  577. omap_mmc_add(name, i, base, size, irq, mmc_data[i]);
  578. };
  579. }
  580. #endif
  581. /*-------------------------------------------------------------------------*/
  582. #if defined(CONFIG_HDQ_MASTER_OMAP) || defined(CONFIG_HDQ_MASTER_OMAP_MODULE)
  583. #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3430)
  584. #define OMAP_HDQ_BASE 0x480B2000
  585. #endif
  586. static struct resource omap_hdq_resources[] = {
  587. {
  588. .start = OMAP_HDQ_BASE,
  589. .end = OMAP_HDQ_BASE + 0x1C,
  590. .flags = IORESOURCE_MEM,
  591. },
  592. {
  593. .start = INT_24XX_HDQ_IRQ,
  594. .flags = IORESOURCE_IRQ,
  595. },
  596. };
  597. static struct platform_device omap_hdq_dev = {
  598. .name = "omap_hdq",
  599. .id = 0,
  600. .dev = {
  601. .platform_data = NULL,
  602. },
  603. .num_resources = ARRAY_SIZE(omap_hdq_resources),
  604. .resource = omap_hdq_resources,
  605. };
  606. static inline void omap_hdq_init(void)
  607. {
  608. (void) platform_device_register(&omap_hdq_dev);
  609. }
  610. #else
  611. static inline void omap_hdq_init(void) {}
  612. #endif
  613. /*-------------------------------------------------------------------------*/
  614. static int __init omap2_init_devices(void)
  615. {
  616. /* please keep these calls, and their implementations above,
  617. * in alphabetical order so they're easier to sort through.
  618. */
  619. omap_hsmmc_reset();
  620. omap_init_camera();
  621. omap_init_mbox();
  622. omap_init_mcspi();
  623. omap_hdq_init();
  624. omap_init_sti();
  625. omap_init_sha1_md5();
  626. return 0;
  627. }
  628. arch_initcall(omap2_init_devices);