devices.c 18 KB

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