devices.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737
  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. #ifdef CONFIG_ARCH_OMAP4
  316. static inline void omap4_mcspi_fixup(void)
  317. {
  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. #else
  328. static inline void omap4_mcspi_fixup(void)
  329. {
  330. }
  331. #endif
  332. #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) || \
  333. defined(CONFIG_ARCH_OMAP4)
  334. static inline void omap2_mcspi3_init(void)
  335. {
  336. platform_device_register(&omap2_mcspi3);
  337. }
  338. #else
  339. static inline void omap2_mcspi3_init(void)
  340. {
  341. }
  342. #endif
  343. #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
  344. static inline void omap2_mcspi4_init(void)
  345. {
  346. platform_device_register(&omap2_mcspi4);
  347. }
  348. #else
  349. static inline void omap2_mcspi4_init(void)
  350. {
  351. }
  352. #endif
  353. static void omap_init_mcspi(void)
  354. {
  355. if (cpu_is_omap44xx())
  356. omap4_mcspi_fixup();
  357. platform_device_register(&omap2_mcspi1);
  358. platform_device_register(&omap2_mcspi2);
  359. if (cpu_is_omap2430() || cpu_is_omap343x() || cpu_is_omap44xx())
  360. omap2_mcspi3_init();
  361. if (cpu_is_omap343x() || cpu_is_omap44xx())
  362. omap2_mcspi4_init();
  363. }
  364. #else
  365. static inline void omap_init_mcspi(void) {}
  366. #endif
  367. #ifdef CONFIG_OMAP_SHA1_MD5
  368. static struct resource sha1_md5_resources[] = {
  369. {
  370. .start = OMAP24XX_SEC_SHA1MD5_BASE,
  371. .end = OMAP24XX_SEC_SHA1MD5_BASE + 0x64,
  372. .flags = IORESOURCE_MEM,
  373. },
  374. {
  375. .start = INT_24XX_SHA1MD5,
  376. .flags = IORESOURCE_IRQ,
  377. }
  378. };
  379. static struct platform_device sha1_md5_device = {
  380. .name = "OMAP SHA1/MD5",
  381. .id = -1,
  382. .num_resources = ARRAY_SIZE(sha1_md5_resources),
  383. .resource = sha1_md5_resources,
  384. };
  385. static void omap_init_sha1_md5(void)
  386. {
  387. platform_device_register(&sha1_md5_device);
  388. }
  389. #else
  390. static inline void omap_init_sha1_md5(void) { }
  391. #endif
  392. /*-------------------------------------------------------------------------*/
  393. #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
  394. #define MMCHS_SYSCONFIG 0x0010
  395. #define MMCHS_SYSCONFIG_SWRESET (1 << 1)
  396. #define MMCHS_SYSSTATUS 0x0014
  397. #define MMCHS_SYSSTATUS_RESETDONE (1 << 0)
  398. static struct platform_device dummy_pdev = {
  399. .dev = {
  400. .bus = &platform_bus_type,
  401. },
  402. };
  403. /**
  404. * omap_hsmmc_reset() - Full reset of each HS-MMC controller
  405. *
  406. * Ensure that each MMC controller is fully reset. Controllers
  407. * left in an unknown state (by bootloader) may prevent retention
  408. * or OFF-mode. This is especially important in cases where the
  409. * MMC driver is not enabled, _or_ built as a module.
  410. *
  411. * In order for reset to work, interface, functional and debounce
  412. * clocks must be enabled. The debounce clock comes from func_32k_clk
  413. * and is not under SW control, so we only enable i- and f-clocks.
  414. **/
  415. static void __init omap_hsmmc_reset(void)
  416. {
  417. u32 i, nr_controllers = cpu_is_omap44xx() ? OMAP44XX_NR_MMC :
  418. (cpu_is_omap34xx() ? OMAP34XX_NR_MMC : OMAP24XX_NR_MMC);
  419. for (i = 0; i < nr_controllers; i++) {
  420. u32 v, base = 0;
  421. struct clk *iclk, *fclk;
  422. struct device *dev = &dummy_pdev.dev;
  423. switch (i) {
  424. case 0:
  425. base = OMAP2_MMC1_BASE;
  426. break;
  427. case 1:
  428. base = OMAP2_MMC2_BASE;
  429. break;
  430. case 2:
  431. base = OMAP3_MMC3_BASE;
  432. break;
  433. case 3:
  434. if (!cpu_is_omap44xx())
  435. return;
  436. base = OMAP4_MMC4_BASE;
  437. break;
  438. case 4:
  439. if (!cpu_is_omap44xx())
  440. return;
  441. base = OMAP4_MMC5_BASE;
  442. break;
  443. }
  444. if (cpu_is_omap44xx())
  445. base += OMAP4_MMC_REG_OFFSET;
  446. dummy_pdev.id = i;
  447. dev_set_name(&dummy_pdev.dev, "mmci-omap-hs.%d", i);
  448. iclk = clk_get(dev, "ick");
  449. if (iclk && clk_enable(iclk))
  450. iclk = NULL;
  451. fclk = clk_get(dev, "fck");
  452. if (fclk && clk_enable(fclk))
  453. fclk = NULL;
  454. if (!iclk || !fclk) {
  455. printk(KERN_WARNING
  456. "%s: Unable to enable clocks for MMC%d, "
  457. "cannot reset.\n", __func__, i);
  458. break;
  459. }
  460. omap_writel(MMCHS_SYSCONFIG_SWRESET, base + MMCHS_SYSCONFIG);
  461. v = omap_readl(base + MMCHS_SYSSTATUS);
  462. while (!(omap_readl(base + MMCHS_SYSSTATUS) &
  463. MMCHS_SYSSTATUS_RESETDONE))
  464. cpu_relax();
  465. if (fclk) {
  466. clk_disable(fclk);
  467. clk_put(fclk);
  468. }
  469. if (iclk) {
  470. clk_disable(iclk);
  471. clk_put(iclk);
  472. }
  473. }
  474. }
  475. #else
  476. static inline void omap_hsmmc_reset(void) {}
  477. #endif
  478. #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
  479. defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
  480. static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller,
  481. int controller_nr)
  482. {
  483. if (cpu_is_omap2420() && controller_nr == 0) {
  484. omap_cfg_reg(H18_24XX_MMC_CMD);
  485. omap_cfg_reg(H15_24XX_MMC_CLKI);
  486. omap_cfg_reg(G19_24XX_MMC_CLKO);
  487. omap_cfg_reg(F20_24XX_MMC_DAT0);
  488. omap_cfg_reg(F19_24XX_MMC_DAT_DIR0);
  489. omap_cfg_reg(G18_24XX_MMC_CMD_DIR);
  490. if (mmc_controller->slots[0].wires == 4) {
  491. omap_cfg_reg(H14_24XX_MMC_DAT1);
  492. omap_cfg_reg(E19_24XX_MMC_DAT2);
  493. omap_cfg_reg(D19_24XX_MMC_DAT3);
  494. omap_cfg_reg(E20_24XX_MMC_DAT_DIR1);
  495. omap_cfg_reg(F18_24XX_MMC_DAT_DIR2);
  496. omap_cfg_reg(E18_24XX_MMC_DAT_DIR3);
  497. }
  498. /*
  499. * Use internal loop-back in MMC/SDIO Module Input Clock
  500. * selection
  501. */
  502. if (mmc_controller->slots[0].internal_clock) {
  503. u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
  504. v |= (1 << 24);
  505. omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
  506. }
  507. }
  508. if (cpu_is_omap3430()) {
  509. if (controller_nr == 0) {
  510. omap_cfg_reg(N28_3430_MMC1_CLK);
  511. omap_cfg_reg(M27_3430_MMC1_CMD);
  512. omap_cfg_reg(N27_3430_MMC1_DAT0);
  513. if (mmc_controller->slots[0].wires == 4 ||
  514. mmc_controller->slots[0].wires == 8) {
  515. omap_cfg_reg(N26_3430_MMC1_DAT1);
  516. omap_cfg_reg(N25_3430_MMC1_DAT2);
  517. omap_cfg_reg(P28_3430_MMC1_DAT3);
  518. }
  519. if (mmc_controller->slots[0].wires == 8) {
  520. omap_cfg_reg(P27_3430_MMC1_DAT4);
  521. omap_cfg_reg(P26_3430_MMC1_DAT5);
  522. omap_cfg_reg(R27_3430_MMC1_DAT6);
  523. omap_cfg_reg(R25_3430_MMC1_DAT7);
  524. }
  525. }
  526. if (controller_nr == 1) {
  527. /* MMC2 */
  528. omap_cfg_reg(AE2_3430_MMC2_CLK);
  529. omap_cfg_reg(AG5_3430_MMC2_CMD);
  530. omap_cfg_reg(AH5_3430_MMC2_DAT0);
  531. /*
  532. * For 8 wire configurations, Lines DAT4, 5, 6 and 7 need to be muxed
  533. * in the board-*.c files
  534. */
  535. if (mmc_controller->slots[0].wires == 4 ||
  536. mmc_controller->slots[0].wires == 8) {
  537. omap_cfg_reg(AH4_3430_MMC2_DAT1);
  538. omap_cfg_reg(AG4_3430_MMC2_DAT2);
  539. omap_cfg_reg(AF4_3430_MMC2_DAT3);
  540. }
  541. }
  542. /*
  543. * For MMC3 the pins need to be muxed in the board-*.c files
  544. */
  545. }
  546. }
  547. void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
  548. int nr_controllers)
  549. {
  550. int i;
  551. char *name;
  552. for (i = 0; i < nr_controllers; i++) {
  553. unsigned long base, size;
  554. unsigned int irq = 0;
  555. if (!mmc_data[i])
  556. continue;
  557. omap2_mmc_mux(mmc_data[i], i);
  558. switch (i) {
  559. case 0:
  560. base = OMAP2_MMC1_BASE;
  561. irq = INT_24XX_MMC_IRQ;
  562. break;
  563. case 1:
  564. base = OMAP2_MMC2_BASE;
  565. irq = INT_24XX_MMC2_IRQ;
  566. break;
  567. case 2:
  568. if (!cpu_is_omap44xx() && !cpu_is_omap34xx())
  569. return;
  570. base = OMAP3_MMC3_BASE;
  571. irq = INT_34XX_MMC3_IRQ;
  572. break;
  573. case 3:
  574. if (!cpu_is_omap44xx())
  575. return;
  576. base = OMAP4_MMC4_BASE + OMAP4_MMC_REG_OFFSET;
  577. irq = INT_44XX_MMC4_IRQ;
  578. break;
  579. case 4:
  580. if (!cpu_is_omap44xx())
  581. return;
  582. base = OMAP4_MMC5_BASE + OMAP4_MMC_REG_OFFSET;
  583. irq = INT_44XX_MMC5_IRQ;
  584. break;
  585. default:
  586. continue;
  587. }
  588. if (cpu_is_omap2420()) {
  589. size = OMAP2420_MMC_SIZE;
  590. name = "mmci-omap";
  591. } else if (cpu_is_omap44xx()) {
  592. if (i < 3) {
  593. base += OMAP4_MMC_REG_OFFSET;
  594. irq += IRQ_GIC_START;
  595. }
  596. size = OMAP4_HSMMC_SIZE;
  597. name = "mmci-omap-hs";
  598. } else {
  599. size = OMAP3_HSMMC_SIZE;
  600. name = "mmci-omap-hs";
  601. }
  602. omap_mmc_add(name, i, base, size, irq, mmc_data[i]);
  603. };
  604. }
  605. #endif
  606. /*-------------------------------------------------------------------------*/
  607. #if defined(CONFIG_HDQ_MASTER_OMAP) || defined(CONFIG_HDQ_MASTER_OMAP_MODULE)
  608. #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3430)
  609. #define OMAP_HDQ_BASE 0x480B2000
  610. #endif
  611. static struct resource omap_hdq_resources[] = {
  612. {
  613. .start = OMAP_HDQ_BASE,
  614. .end = OMAP_HDQ_BASE + 0x1C,
  615. .flags = IORESOURCE_MEM,
  616. },
  617. {
  618. .start = INT_24XX_HDQ_IRQ,
  619. .flags = IORESOURCE_IRQ,
  620. },
  621. };
  622. static struct platform_device omap_hdq_dev = {
  623. .name = "omap_hdq",
  624. .id = 0,
  625. .dev = {
  626. .platform_data = NULL,
  627. },
  628. .num_resources = ARRAY_SIZE(omap_hdq_resources),
  629. .resource = omap_hdq_resources,
  630. };
  631. static inline void omap_hdq_init(void)
  632. {
  633. (void) platform_device_register(&omap_hdq_dev);
  634. }
  635. #else
  636. static inline void omap_hdq_init(void) {}
  637. #endif
  638. /*-------------------------------------------------------------------------*/
  639. static int __init omap2_init_devices(void)
  640. {
  641. /* please keep these calls, and their implementations above,
  642. * in alphabetical order so they're easier to sort through.
  643. */
  644. omap_hsmmc_reset();
  645. omap_init_camera();
  646. omap_init_mbox();
  647. omap_init_mcspi();
  648. omap_hdq_init();
  649. omap_init_sti();
  650. omap_init_sha1_md5();
  651. return 0;
  652. }
  653. arch_initcall(omap2_init_devices);