devices.c 17 KB

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