hsmmc.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600
  1. /*
  2. * linux/arch/arm/mach-omap2/hsmmc.c
  3. *
  4. * Copyright (C) 2007-2008 Texas Instruments
  5. * Copyright (C) 2008 Nokia Corporation
  6. * Author: Texas Instruments
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #include <linux/kernel.h>
  13. #include <linux/slab.h>
  14. #include <linux/string.h>
  15. #include <linux/delay.h>
  16. #include <linux/gpio.h>
  17. #include <mach/hardware.h>
  18. #include <plat/mmc.h>
  19. #include <plat/omap-pm.h>
  20. #include <plat/mux.h>
  21. #include <plat/omap_device.h>
  22. #include "mux.h"
  23. #include "hsmmc.h"
  24. #include "control.h"
  25. #if defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
  26. static u16 control_pbias_offset;
  27. static u16 control_devconf1_offset;
  28. static u16 control_mmc1;
  29. #define HSMMC_NAME_LEN 9
  30. #if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM)
  31. static int hsmmc_get_context_loss(struct device *dev)
  32. {
  33. return omap_pm_get_dev_context_loss_count(dev);
  34. }
  35. #else
  36. #define hsmmc_get_context_loss NULL
  37. #endif
  38. static void omap_hsmmc1_before_set_reg(struct device *dev, int slot,
  39. int power_on, int vdd)
  40. {
  41. u32 reg, prog_io;
  42. struct omap_mmc_platform_data *mmc = dev->platform_data;
  43. if (mmc->slots[0].remux)
  44. mmc->slots[0].remux(dev, slot, power_on);
  45. /*
  46. * Assume we power both OMAP VMMC1 (for CMD, CLK, DAT0..3) and the
  47. * card with Vcc regulator (from twl4030 or whatever). OMAP has both
  48. * 1.8V and 3.0V modes, controlled by the PBIAS register.
  49. *
  50. * In 8-bit modes, OMAP VMMC1A (for DAT4..7) needs a supply, which
  51. * is most naturally TWL VSIM; those pins also use PBIAS.
  52. *
  53. * FIXME handle VMMC1A as needed ...
  54. */
  55. if (power_on) {
  56. if (cpu_is_omap2430()) {
  57. reg = omap_ctrl_readl(OMAP243X_CONTROL_DEVCONF1);
  58. if ((1 << vdd) >= MMC_VDD_30_31)
  59. reg |= OMAP243X_MMC1_ACTIVE_OVERWRITE;
  60. else
  61. reg &= ~OMAP243X_MMC1_ACTIVE_OVERWRITE;
  62. omap_ctrl_writel(reg, OMAP243X_CONTROL_DEVCONF1);
  63. }
  64. if (mmc->slots[0].internal_clock) {
  65. reg = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
  66. reg |= OMAP2_MMCSDIO1ADPCLKISEL;
  67. omap_ctrl_writel(reg, OMAP2_CONTROL_DEVCONF0);
  68. }
  69. reg = omap_ctrl_readl(control_pbias_offset);
  70. if (cpu_is_omap3630()) {
  71. /* Set MMC I/O to 52Mhz */
  72. prog_io = omap_ctrl_readl(OMAP343X_CONTROL_PROG_IO1);
  73. prog_io |= OMAP3630_PRG_SDMMC1_SPEEDCTRL;
  74. omap_ctrl_writel(prog_io, OMAP343X_CONTROL_PROG_IO1);
  75. } else {
  76. reg |= OMAP2_PBIASSPEEDCTRL0;
  77. }
  78. reg &= ~OMAP2_PBIASLITEPWRDNZ0;
  79. omap_ctrl_writel(reg, control_pbias_offset);
  80. } else {
  81. reg = omap_ctrl_readl(control_pbias_offset);
  82. reg &= ~OMAP2_PBIASLITEPWRDNZ0;
  83. omap_ctrl_writel(reg, control_pbias_offset);
  84. }
  85. }
  86. static void omap_hsmmc1_after_set_reg(struct device *dev, int slot,
  87. int power_on, int vdd)
  88. {
  89. u32 reg;
  90. /* 100ms delay required for PBIAS configuration */
  91. msleep(100);
  92. if (power_on) {
  93. reg = omap_ctrl_readl(control_pbias_offset);
  94. reg |= (OMAP2_PBIASLITEPWRDNZ0 | OMAP2_PBIASSPEEDCTRL0);
  95. if ((1 << vdd) <= MMC_VDD_165_195)
  96. reg &= ~OMAP2_PBIASLITEVMODE0;
  97. else
  98. reg |= OMAP2_PBIASLITEVMODE0;
  99. omap_ctrl_writel(reg, control_pbias_offset);
  100. } else {
  101. reg = omap_ctrl_readl(control_pbias_offset);
  102. reg |= (OMAP2_PBIASSPEEDCTRL0 | OMAP2_PBIASLITEPWRDNZ0 |
  103. OMAP2_PBIASLITEVMODE0);
  104. omap_ctrl_writel(reg, control_pbias_offset);
  105. }
  106. }
  107. static void omap4_hsmmc1_before_set_reg(struct device *dev, int slot,
  108. int power_on, int vdd)
  109. {
  110. u32 reg;
  111. /*
  112. * Assume we power both OMAP VMMC1 (for CMD, CLK, DAT0..3) and the
  113. * card with Vcc regulator (from twl4030 or whatever). OMAP has both
  114. * 1.8V and 3.0V modes, controlled by the PBIAS register.
  115. */
  116. reg = omap4_ctrl_pad_readl(control_pbias_offset);
  117. reg &= ~(OMAP4_MMC1_PBIASLITE_PWRDNZ_MASK |
  118. OMAP4_MMC1_PWRDNZ_MASK |
  119. OMAP4_MMC1_PBIASLITE_VMODE_MASK);
  120. omap4_ctrl_pad_writel(reg, control_pbias_offset);
  121. }
  122. static void omap4_hsmmc1_after_set_reg(struct device *dev, int slot,
  123. int power_on, int vdd)
  124. {
  125. u32 reg;
  126. unsigned long timeout;
  127. if (power_on) {
  128. reg = omap4_ctrl_pad_readl(control_pbias_offset);
  129. reg |= OMAP4_MMC1_PBIASLITE_PWRDNZ_MASK;
  130. if ((1 << vdd) <= MMC_VDD_165_195)
  131. reg &= ~OMAP4_MMC1_PBIASLITE_VMODE_MASK;
  132. else
  133. reg |= OMAP4_MMC1_PBIASLITE_VMODE_MASK;
  134. reg |= (OMAP4_MMC1_PBIASLITE_PWRDNZ_MASK |
  135. OMAP4_MMC1_PWRDNZ_MASK);
  136. omap4_ctrl_pad_writel(reg, control_pbias_offset);
  137. timeout = jiffies + msecs_to_jiffies(5);
  138. do {
  139. reg = omap4_ctrl_pad_readl(control_pbias_offset);
  140. if (!(reg & OMAP4_MMC1_PBIASLITE_VMODE_ERROR_MASK))
  141. break;
  142. usleep_range(100, 200);
  143. } while (!time_after(jiffies, timeout));
  144. if (reg & OMAP4_MMC1_PBIASLITE_VMODE_ERROR_MASK) {
  145. pr_err("Pbias Voltage is not same as LDO\n");
  146. /* Caution : On VMODE_ERROR Power Down MMC IO */
  147. reg &= ~(OMAP4_MMC1_PWRDNZ_MASK);
  148. omap4_ctrl_pad_writel(reg, control_pbias_offset);
  149. }
  150. }
  151. }
  152. static void hsmmc2_select_input_clk_src(struct omap_mmc_platform_data *mmc)
  153. {
  154. u32 reg;
  155. reg = omap_ctrl_readl(control_devconf1_offset);
  156. if (mmc->slots[0].internal_clock)
  157. reg |= OMAP2_MMCSDIO2ADPCLKISEL;
  158. else
  159. reg &= ~OMAP2_MMCSDIO2ADPCLKISEL;
  160. omap_ctrl_writel(reg, control_devconf1_offset);
  161. }
  162. static void hsmmc2_before_set_reg(struct device *dev, int slot,
  163. int power_on, int vdd)
  164. {
  165. struct omap_mmc_platform_data *mmc = dev->platform_data;
  166. if (mmc->slots[0].remux)
  167. mmc->slots[0].remux(dev, slot, power_on);
  168. if (power_on)
  169. hsmmc2_select_input_clk_src(mmc);
  170. }
  171. static int am35x_hsmmc2_set_power(struct device *dev, int slot,
  172. int power_on, int vdd)
  173. {
  174. struct omap_mmc_platform_data *mmc = dev->platform_data;
  175. if (power_on)
  176. hsmmc2_select_input_clk_src(mmc);
  177. return 0;
  178. }
  179. static int nop_mmc_set_power(struct device *dev, int slot, int power_on,
  180. int vdd)
  181. {
  182. return 0;
  183. }
  184. static inline void omap_hsmmc_mux(struct omap_mmc_platform_data *mmc_controller,
  185. int controller_nr)
  186. {
  187. if (gpio_is_valid(mmc_controller->slots[0].switch_pin) &&
  188. (mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES))
  189. omap_mux_init_gpio(mmc_controller->slots[0].switch_pin,
  190. OMAP_PIN_INPUT_PULLUP);
  191. if (gpio_is_valid(mmc_controller->slots[0].gpio_wp) &&
  192. (mmc_controller->slots[0].gpio_wp < OMAP_MAX_GPIO_LINES))
  193. omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp,
  194. OMAP_PIN_INPUT_PULLUP);
  195. if (cpu_is_omap34xx()) {
  196. if (controller_nr == 0) {
  197. omap_mux_init_signal("sdmmc1_clk",
  198. OMAP_PIN_INPUT_PULLUP);
  199. omap_mux_init_signal("sdmmc1_cmd",
  200. OMAP_PIN_INPUT_PULLUP);
  201. omap_mux_init_signal("sdmmc1_dat0",
  202. OMAP_PIN_INPUT_PULLUP);
  203. if (mmc_controller->slots[0].caps &
  204. (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) {
  205. omap_mux_init_signal("sdmmc1_dat1",
  206. OMAP_PIN_INPUT_PULLUP);
  207. omap_mux_init_signal("sdmmc1_dat2",
  208. OMAP_PIN_INPUT_PULLUP);
  209. omap_mux_init_signal("sdmmc1_dat3",
  210. OMAP_PIN_INPUT_PULLUP);
  211. }
  212. if (mmc_controller->slots[0].caps &
  213. MMC_CAP_8_BIT_DATA) {
  214. omap_mux_init_signal("sdmmc1_dat4",
  215. OMAP_PIN_INPUT_PULLUP);
  216. omap_mux_init_signal("sdmmc1_dat5",
  217. OMAP_PIN_INPUT_PULLUP);
  218. omap_mux_init_signal("sdmmc1_dat6",
  219. OMAP_PIN_INPUT_PULLUP);
  220. omap_mux_init_signal("sdmmc1_dat7",
  221. OMAP_PIN_INPUT_PULLUP);
  222. }
  223. }
  224. if (controller_nr == 1) {
  225. /* MMC2 */
  226. omap_mux_init_signal("sdmmc2_clk",
  227. OMAP_PIN_INPUT_PULLUP);
  228. omap_mux_init_signal("sdmmc2_cmd",
  229. OMAP_PIN_INPUT_PULLUP);
  230. omap_mux_init_signal("sdmmc2_dat0",
  231. OMAP_PIN_INPUT_PULLUP);
  232. /*
  233. * For 8 wire configurations, Lines DAT4, 5, 6 and 7
  234. * need to be muxed in the board-*.c files
  235. */
  236. if (mmc_controller->slots[0].caps &
  237. (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) {
  238. omap_mux_init_signal("sdmmc2_dat1",
  239. OMAP_PIN_INPUT_PULLUP);
  240. omap_mux_init_signal("sdmmc2_dat2",
  241. OMAP_PIN_INPUT_PULLUP);
  242. omap_mux_init_signal("sdmmc2_dat3",
  243. OMAP_PIN_INPUT_PULLUP);
  244. }
  245. if (mmc_controller->slots[0].caps &
  246. MMC_CAP_8_BIT_DATA) {
  247. omap_mux_init_signal("sdmmc2_dat4.sdmmc2_dat4",
  248. OMAP_PIN_INPUT_PULLUP);
  249. omap_mux_init_signal("sdmmc2_dat5.sdmmc2_dat5",
  250. OMAP_PIN_INPUT_PULLUP);
  251. omap_mux_init_signal("sdmmc2_dat6.sdmmc2_dat6",
  252. OMAP_PIN_INPUT_PULLUP);
  253. omap_mux_init_signal("sdmmc2_dat7.sdmmc2_dat7",
  254. OMAP_PIN_INPUT_PULLUP);
  255. }
  256. }
  257. /*
  258. * For MMC3 the pins need to be muxed in the board-*.c files
  259. */
  260. }
  261. }
  262. static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
  263. struct omap_mmc_platform_data *mmc)
  264. {
  265. char *hc_name;
  266. hc_name = kzalloc(sizeof(char) * (HSMMC_NAME_LEN + 1), GFP_KERNEL);
  267. if (!hc_name) {
  268. pr_err("Cannot allocate memory for controller slot name\n");
  269. kfree(hc_name);
  270. return -ENOMEM;
  271. }
  272. if (c->name)
  273. strncpy(hc_name, c->name, HSMMC_NAME_LEN);
  274. else
  275. snprintf(hc_name, (HSMMC_NAME_LEN + 1), "mmc%islot%i",
  276. c->mmc, 1);
  277. mmc->slots[0].name = hc_name;
  278. mmc->nr_slots = 1;
  279. mmc->slots[0].caps = c->caps;
  280. mmc->slots[0].pm_caps = c->pm_caps;
  281. mmc->slots[0].internal_clock = !c->ext_clock;
  282. mmc->max_freq = c->max_freq;
  283. if (cpu_is_omap44xx())
  284. mmc->reg_offset = OMAP4_MMC_REG_OFFSET;
  285. else
  286. mmc->reg_offset = 0;
  287. mmc->get_context_loss_count = hsmmc_get_context_loss;
  288. mmc->slots[0].switch_pin = c->gpio_cd;
  289. mmc->slots[0].gpio_wp = c->gpio_wp;
  290. mmc->slots[0].remux = c->remux;
  291. mmc->slots[0].init_card = c->init_card;
  292. if (c->cover_only)
  293. mmc->slots[0].cover = 1;
  294. if (c->nonremovable)
  295. mmc->slots[0].nonremovable = 1;
  296. if (c->power_saving)
  297. mmc->slots[0].power_saving = 1;
  298. if (c->no_off)
  299. mmc->slots[0].no_off = 1;
  300. if (c->no_off_init)
  301. mmc->slots[0].no_regulator_off_init = c->no_off_init;
  302. if (c->vcc_aux_disable_is_sleep)
  303. mmc->slots[0].vcc_aux_disable_is_sleep = 1;
  304. /*
  305. * NOTE: MMC slots should have a Vcc regulator set up.
  306. * This may be from a TWL4030-family chip, another
  307. * controllable regulator, or a fixed supply.
  308. *
  309. * temporary HACK: ocr_mask instead of fixed supply
  310. */
  311. if (soc_is_am35xx())
  312. mmc->slots[0].ocr_mask = MMC_VDD_165_195 |
  313. MMC_VDD_26_27 |
  314. MMC_VDD_27_28 |
  315. MMC_VDD_29_30 |
  316. MMC_VDD_30_31 |
  317. MMC_VDD_31_32;
  318. else
  319. mmc->slots[0].ocr_mask = c->ocr_mask;
  320. if (!soc_is_am35xx())
  321. mmc->slots[0].features |= HSMMC_HAS_PBIAS;
  322. if (cpu_is_omap44xx() && (omap_rev() > OMAP4430_REV_ES1_0))
  323. mmc->slots[0].features |= HSMMC_HAS_UPDATED_RESET;
  324. switch (c->mmc) {
  325. case 1:
  326. if (mmc->slots[0].features & HSMMC_HAS_PBIAS) {
  327. /* on-chip level shifting via PBIAS0/PBIAS1 */
  328. if (cpu_is_omap44xx()) {
  329. mmc->slots[0].before_set_reg =
  330. omap4_hsmmc1_before_set_reg;
  331. mmc->slots[0].after_set_reg =
  332. omap4_hsmmc1_after_set_reg;
  333. } else {
  334. mmc->slots[0].before_set_reg =
  335. omap_hsmmc1_before_set_reg;
  336. mmc->slots[0].after_set_reg =
  337. omap_hsmmc1_after_set_reg;
  338. }
  339. }
  340. if (soc_is_am35xx())
  341. mmc->slots[0].set_power = nop_mmc_set_power;
  342. /* OMAP3630 HSMMC1 supports only 4-bit */
  343. if (cpu_is_omap3630() &&
  344. (c->caps & MMC_CAP_8_BIT_DATA)) {
  345. c->caps &= ~MMC_CAP_8_BIT_DATA;
  346. c->caps |= MMC_CAP_4_BIT_DATA;
  347. mmc->slots[0].caps = c->caps;
  348. }
  349. break;
  350. case 2:
  351. if (soc_is_am35xx())
  352. mmc->slots[0].set_power = am35x_hsmmc2_set_power;
  353. if (c->ext_clock)
  354. c->transceiver = 1;
  355. if (c->transceiver && (c->caps & MMC_CAP_8_BIT_DATA)) {
  356. c->caps &= ~MMC_CAP_8_BIT_DATA;
  357. c->caps |= MMC_CAP_4_BIT_DATA;
  358. }
  359. if (mmc->slots[0].features & HSMMC_HAS_PBIAS) {
  360. /* off-chip level shifting, or none */
  361. mmc->slots[0].before_set_reg = hsmmc2_before_set_reg;
  362. mmc->slots[0].after_set_reg = NULL;
  363. }
  364. break;
  365. case 3:
  366. case 4:
  367. case 5:
  368. mmc->slots[0].before_set_reg = NULL;
  369. mmc->slots[0].after_set_reg = NULL;
  370. break;
  371. default:
  372. pr_err("MMC%d configuration not supported!\n", c->mmc);
  373. kfree(hc_name);
  374. return -ENODEV;
  375. }
  376. return 0;
  377. }
  378. static int omap_hsmmc_done;
  379. void omap_hsmmc_late_init(struct omap2_hsmmc_info *c)
  380. {
  381. struct platform_device *pdev;
  382. struct omap_mmc_platform_data *mmc_pdata;
  383. int res;
  384. if (omap_hsmmc_done != 1)
  385. return;
  386. omap_hsmmc_done++;
  387. for (; c->mmc; c++) {
  388. if (!c->deferred)
  389. continue;
  390. pdev = c->pdev;
  391. if (!pdev)
  392. continue;
  393. mmc_pdata = pdev->dev.platform_data;
  394. if (!mmc_pdata)
  395. continue;
  396. mmc_pdata->slots[0].switch_pin = c->gpio_cd;
  397. mmc_pdata->slots[0].gpio_wp = c->gpio_wp;
  398. res = omap_device_register(pdev);
  399. if (res)
  400. pr_err("Could not late init MMC %s\n",
  401. c->name);
  402. }
  403. }
  404. #define MAX_OMAP_MMC_HWMOD_NAME_LEN 16
  405. static void __init omap_hsmmc_init_one(struct omap2_hsmmc_info *hsmmcinfo,
  406. int ctrl_nr)
  407. {
  408. struct omap_hwmod *oh;
  409. struct omap_hwmod *ohs[1];
  410. struct omap_device *od;
  411. struct platform_device *pdev;
  412. char oh_name[MAX_OMAP_MMC_HWMOD_NAME_LEN];
  413. struct omap_mmc_platform_data *mmc_data;
  414. struct omap_mmc_dev_attr *mmc_dev_attr;
  415. char *name;
  416. int res;
  417. mmc_data = kzalloc(sizeof(struct omap_mmc_platform_data), GFP_KERNEL);
  418. if (!mmc_data) {
  419. pr_err("Cannot allocate memory for mmc device!\n");
  420. return;
  421. }
  422. res = omap_hsmmc_pdata_init(hsmmcinfo, mmc_data);
  423. if (res < 0)
  424. goto free_mmc;
  425. omap_hsmmc_mux(mmc_data, (ctrl_nr - 1));
  426. name = "omap_hsmmc";
  427. res = snprintf(oh_name, MAX_OMAP_MMC_HWMOD_NAME_LEN,
  428. "mmc%d", ctrl_nr);
  429. WARN(res >= MAX_OMAP_MMC_HWMOD_NAME_LEN,
  430. "String buffer overflow in MMC%d device setup\n", ctrl_nr);
  431. oh = omap_hwmod_lookup(oh_name);
  432. if (!oh) {
  433. pr_err("Could not look up %s\n", oh_name);
  434. goto free_name;
  435. }
  436. ohs[0] = oh;
  437. if (oh->dev_attr != NULL) {
  438. mmc_dev_attr = oh->dev_attr;
  439. mmc_data->controller_flags = mmc_dev_attr->flags;
  440. /*
  441. * erratum 2.1.1.128 doesn't apply if board has
  442. * a transceiver is attached
  443. */
  444. if (hsmmcinfo->transceiver)
  445. mmc_data->controller_flags &=
  446. ~OMAP_HSMMC_BROKEN_MULTIBLOCK_READ;
  447. }
  448. pdev = platform_device_alloc(name, ctrl_nr - 1);
  449. if (!pdev) {
  450. pr_err("Could not allocate pdev for %s\n", name);
  451. goto free_name;
  452. }
  453. dev_set_name(&pdev->dev, "%s.%d", pdev->name, pdev->id);
  454. od = omap_device_alloc(pdev, ohs, 1, NULL, 0);
  455. if (!od) {
  456. pr_err("Could not allocate od for %s\n", name);
  457. goto put_pdev;
  458. }
  459. res = platform_device_add_data(pdev, mmc_data,
  460. sizeof(struct omap_mmc_platform_data));
  461. if (res) {
  462. pr_err("Could not add pdata for %s\n", name);
  463. goto put_pdev;
  464. }
  465. hsmmcinfo->pdev = pdev;
  466. if (hsmmcinfo->deferred)
  467. goto free_mmc;
  468. res = omap_device_register(pdev);
  469. if (res) {
  470. pr_err("Could not register od for %s\n", name);
  471. goto free_od;
  472. }
  473. goto free_mmc;
  474. free_od:
  475. omap_device_delete(od);
  476. put_pdev:
  477. platform_device_put(pdev);
  478. free_name:
  479. kfree(mmc_data->slots[0].name);
  480. free_mmc:
  481. kfree(mmc_data);
  482. }
  483. void __init omap_hsmmc_init(struct omap2_hsmmc_info *controllers)
  484. {
  485. u32 reg;
  486. if (omap_hsmmc_done)
  487. return;
  488. omap_hsmmc_done = 1;
  489. if (!cpu_is_omap44xx()) {
  490. if (cpu_is_omap2430()) {
  491. control_pbias_offset = OMAP243X_CONTROL_PBIAS_LITE;
  492. control_devconf1_offset = OMAP243X_CONTROL_DEVCONF1;
  493. } else {
  494. control_pbias_offset = OMAP343X_CONTROL_PBIAS_LITE;
  495. control_devconf1_offset = OMAP343X_CONTROL_DEVCONF1;
  496. }
  497. } else {
  498. control_pbias_offset =
  499. OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_PBIASLITE;
  500. control_mmc1 = OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_MMC1;
  501. reg = omap4_ctrl_pad_readl(control_mmc1);
  502. reg |= (OMAP4_SDMMC1_PUSTRENGTH_GRP0_MASK |
  503. OMAP4_SDMMC1_PUSTRENGTH_GRP1_MASK);
  504. reg &= ~(OMAP4_SDMMC1_PUSTRENGTH_GRP2_MASK |
  505. OMAP4_SDMMC1_PUSTRENGTH_GRP3_MASK);
  506. reg |= (OMAP4_SDMMC1_DR0_SPEEDCTRL_MASK |
  507. OMAP4_SDMMC1_DR1_SPEEDCTRL_MASK |
  508. OMAP4_SDMMC1_DR2_SPEEDCTRL_MASK);
  509. omap4_ctrl_pad_writel(reg, control_mmc1);
  510. }
  511. for (; controllers->mmc; controllers++)
  512. omap_hsmmc_init_one(controllers, controllers->mmc);
  513. }
  514. #endif