2 * SDHCI Controller driver for TI's OMAP SoCs
4 * Copyright (C) 2017 Texas Instruments
5 * Author: Kishon Vijay Abraham I <kishon@ti.com>
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 of
9 * the License as published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include <linux/delay.h>
21 #include <linux/mmc/slot-gpio.h>
22 #include <linux/module.h>
24 #include <linux/of_device.h>
25 #include <linux/platform_device.h>
26 #include <linux/pm_runtime.h>
27 #include <linux/regulator/consumer.h>
29 #include "sdhci-pltfm.h"
31 #define SDHCI_OMAP_CON 0x12c
32 #define CON_DW8 BIT(5)
33 #define CON_DMA_MASTER BIT(20)
34 #define CON_DDR BIT(19)
35 #define CON_CLKEXTFREE BIT(16)
36 #define CON_PADEN BIT(15)
37 #define CON_INIT BIT(1)
40 #define SDHCI_OMAP_DLL 0x0134
41 #define DLL_SWT BIT(20)
42 #define DLL_FORCE_SR_C_SHIFT 13
43 #define DLL_FORCE_SR_C_MASK (0x7f << DLL_FORCE_SR_C_SHIFT)
44 #define DLL_FORCE_VALUE BIT(12)
45 #define DLL_CALIB BIT(1)
47 #define SDHCI_OMAP_CMD 0x20c
49 #define SDHCI_OMAP_PSTATE 0x0224
50 #define PSTATE_DLEV_DAT0 BIT(20)
51 #define PSTATE_DATI BIT(1)
53 #define SDHCI_OMAP_HCTL 0x228
54 #define HCTL_SDBP BIT(8)
55 #define HCTL_SDVS_SHIFT 9
56 #define HCTL_SDVS_MASK (0x7 << HCTL_SDVS_SHIFT)
57 #define HCTL_SDVS_33 (0x7 << HCTL_SDVS_SHIFT)
58 #define HCTL_SDVS_30 (0x6 << HCTL_SDVS_SHIFT)
59 #define HCTL_SDVS_18 (0x5 << HCTL_SDVS_SHIFT)
61 #define SDHCI_OMAP_SYSCTL 0x22c
62 #define SYSCTL_CEN BIT(2)
63 #define SYSCTL_CLKD_SHIFT 6
64 #define SYSCTL_CLKD_MASK 0x3ff
66 #define SDHCI_OMAP_STAT 0x230
68 #define SDHCI_OMAP_IE 0x234
69 #define INT_CC_EN BIT(0)
71 #define SDHCI_OMAP_AC12 0x23c
72 #define AC12_V1V8_SIGEN BIT(19)
73 #define AC12_SCLK_SEL BIT(23)
75 #define SDHCI_OMAP_CAPA 0x240
76 #define CAPA_VS33 BIT(24)
77 #define CAPA_VS30 BIT(25)
78 #define CAPA_VS18 BIT(26)
80 #define SDHCI_OMAP_CAPA2 0x0244
81 #define CAPA2_TSDR50 BIT(13)
83 #define SDHCI_OMAP_TIMEOUT 1 /* 1 msec */
85 #define SYSCTL_CLKD_MAX 0x3FF
87 #define IOV_1V8 1800000 /* 180000 uV */
88 #define IOV_3V0 3000000 /* 300000 uV */
89 #define IOV_3V3 3300000 /* 330000 uV */
91 #define MAX_PHASE_DELAY 0x7C
93 struct sdhci_omap_data {
97 struct sdhci_omap_host {
100 struct regulator *pbias;
102 struct sdhci_host *host;
107 static inline u32 sdhci_omap_readl(struct sdhci_omap_host *host,
110 return readl(host->base + offset);
113 static inline void sdhci_omap_writel(struct sdhci_omap_host *host,
114 unsigned int offset, u32 data)
116 writel(data, host->base + offset);
119 static int sdhci_omap_set_pbias(struct sdhci_omap_host *omap_host,
120 bool power_on, unsigned int iov)
123 struct device *dev = omap_host->dev;
125 if (IS_ERR(omap_host->pbias))
129 ret = regulator_set_voltage(omap_host->pbias, iov, iov);
131 dev_err(dev, "pbias set voltage failed\n");
135 if (omap_host->pbias_enabled)
138 ret = regulator_enable(omap_host->pbias);
140 dev_err(dev, "pbias reg enable fail\n");
144 omap_host->pbias_enabled = true;
146 if (!omap_host->pbias_enabled)
149 ret = regulator_disable(omap_host->pbias);
151 dev_err(dev, "pbias reg disable fail\n");
154 omap_host->pbias_enabled = false;
160 static int sdhci_omap_enable_iov(struct sdhci_omap_host *omap_host,
164 struct sdhci_host *host = omap_host->host;
165 struct mmc_host *mmc = host->mmc;
167 ret = sdhci_omap_set_pbias(omap_host, false, 0);
171 if (!IS_ERR(mmc->supply.vqmmc)) {
172 ret = regulator_set_voltage(mmc->supply.vqmmc, iov, iov);
174 dev_err(mmc_dev(mmc), "vqmmc set voltage failed\n");
179 ret = sdhci_omap_set_pbias(omap_host, true, iov);
186 static void sdhci_omap_conf_bus_power(struct sdhci_omap_host *omap_host,
187 unsigned char signal_voltage)
192 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_HCTL);
193 reg &= ~HCTL_SDVS_MASK;
195 if (signal_voltage == MMC_SIGNAL_VOLTAGE_330)
200 sdhci_omap_writel(omap_host, SDHCI_OMAP_HCTL, reg);
203 sdhci_omap_writel(omap_host, SDHCI_OMAP_HCTL, reg);
206 timeout = ktime_add_ms(ktime_get(), SDHCI_OMAP_TIMEOUT);
207 while (!(sdhci_omap_readl(omap_host, SDHCI_OMAP_HCTL) & HCTL_SDBP)) {
208 if (WARN_ON(ktime_after(ktime_get(), timeout)))
214 static inline void sdhci_omap_set_dll(struct sdhci_omap_host *omap_host,
220 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_DLL);
221 reg |= DLL_FORCE_VALUE;
222 reg &= ~DLL_FORCE_SR_C_MASK;
223 reg |= (count << DLL_FORCE_SR_C_SHIFT);
224 sdhci_omap_writel(omap_host, SDHCI_OMAP_DLL, reg);
227 sdhci_omap_writel(omap_host, SDHCI_OMAP_DLL, reg);
228 for (i = 0; i < 1000; i++) {
229 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_DLL);
234 sdhci_omap_writel(omap_host, SDHCI_OMAP_DLL, reg);
237 static void sdhci_omap_disable_tuning(struct sdhci_omap_host *omap_host)
241 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_AC12);
242 reg &= ~AC12_SCLK_SEL;
243 sdhci_omap_writel(omap_host, SDHCI_OMAP_AC12, reg);
245 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_DLL);
246 reg &= ~(DLL_FORCE_VALUE | DLL_SWT);
247 sdhci_omap_writel(omap_host, SDHCI_OMAP_DLL, reg);
250 static int sdhci_omap_execute_tuning(struct mmc_host *mmc, u32 opcode)
252 struct sdhci_host *host = mmc_priv(mmc);
253 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
254 struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host);
255 struct device *dev = omap_host->dev;
256 struct mmc_ios *ios = &mmc->ios;
257 u32 start_window = 0, max_window = 0;
258 u8 cur_match, prev_match = 0;
259 u32 length = 0, max_len = 0;
264 pltfm_host = sdhci_priv(host);
265 omap_host = sdhci_pltfm_priv(pltfm_host);
266 dev = omap_host->dev;
268 /* clock tuning is not needed for upto 52MHz */
269 if (ios->clock <= 52000000)
272 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CAPA2);
273 if (ios->timing == MMC_TIMING_UHS_SDR50 && !(reg & CAPA2_TSDR50))
276 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_DLL);
278 sdhci_omap_writel(omap_host, SDHCI_OMAP_DLL, reg);
280 while (phase_delay <= MAX_PHASE_DELAY) {
281 sdhci_omap_set_dll(omap_host, phase_delay);
283 cur_match = !mmc_send_tuning(mmc, opcode, NULL);
288 start_window = phase_delay;
293 if (length > max_len) {
294 max_window = start_window;
298 prev_match = cur_match;
303 dev_err(dev, "Unable to find match\n");
308 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_AC12);
309 if (!(reg & AC12_SCLK_SEL)) {
314 phase_delay = max_window + 4 * (max_len >> 1);
315 sdhci_omap_set_dll(omap_host, phase_delay);
320 dev_err(dev, "Tuning failed\n");
321 sdhci_omap_disable_tuning(omap_host);
324 sdhci_reset(host, SDHCI_RESET_CMD | SDHCI_RESET_DATA);
328 static int sdhci_omap_card_busy(struct mmc_host *mmc)
332 struct sdhci_host *host = mmc_priv(mmc);
333 struct sdhci_pltfm_host *pltfm_host;
334 struct sdhci_omap_host *omap_host;
337 pltfm_host = sdhci_priv(host);
338 omap_host = sdhci_pltfm_priv(pltfm_host);
340 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CON);
341 ac12 = sdhci_omap_readl(omap_host, SDHCI_OMAP_AC12);
342 reg &= ~CON_CLKEXTFREE;
343 if (ac12 & AC12_V1V8_SIGEN)
344 reg |= CON_CLKEXTFREE;
346 sdhci_omap_writel(omap_host, SDHCI_OMAP_CON, reg);
348 disable_irq(host->irq);
349 ier |= SDHCI_INT_CARD_INT;
350 sdhci_writel(host, ier, SDHCI_INT_ENABLE);
351 sdhci_writel(host, ier, SDHCI_SIGNAL_ENABLE);
354 * Delay is required for PSTATE to correctly reflect
355 * DLEV/CLEV values after PADEN is set.
357 usleep_range(50, 100);
358 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_PSTATE);
359 if ((reg & PSTATE_DATI) || !(reg & PSTATE_DLEV_DAT0))
362 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CON);
363 reg &= ~(CON_CLKEXTFREE | CON_PADEN);
364 sdhci_omap_writel(omap_host, SDHCI_OMAP_CON, reg);
366 sdhci_writel(host, host->ier, SDHCI_INT_ENABLE);
367 sdhci_writel(host, host->ier, SDHCI_SIGNAL_ENABLE);
368 enable_irq(host->irq);
373 static int sdhci_omap_start_signal_voltage_switch(struct mmc_host *mmc,
379 struct sdhci_host *host = mmc_priv(mmc);
380 struct sdhci_pltfm_host *pltfm_host;
381 struct sdhci_omap_host *omap_host;
384 pltfm_host = sdhci_priv(host);
385 omap_host = sdhci_pltfm_priv(pltfm_host);
386 dev = omap_host->dev;
388 if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_330) {
389 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CAPA);
390 if (!(reg & CAPA_VS33))
393 sdhci_omap_conf_bus_power(omap_host, ios->signal_voltage);
395 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_AC12);
396 reg &= ~AC12_V1V8_SIGEN;
397 sdhci_omap_writel(omap_host, SDHCI_OMAP_AC12, reg);
400 } else if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_180) {
401 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CAPA);
402 if (!(reg & CAPA_VS18))
405 sdhci_omap_conf_bus_power(omap_host, ios->signal_voltage);
407 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_AC12);
408 reg |= AC12_V1V8_SIGEN;
409 sdhci_omap_writel(omap_host, SDHCI_OMAP_AC12, reg);
416 ret = sdhci_omap_enable_iov(omap_host, iov);
418 dev_err(dev, "failed to switch IO voltage to %dmV\n", iov);
422 dev_dbg(dev, "IO voltage switched to %dmV\n", iov);
426 static void sdhci_omap_set_power_mode(struct sdhci_omap_host *omap_host,
429 if (omap_host->bus_mode == MMC_POWER_OFF)
430 sdhci_omap_disable_tuning(omap_host);
431 omap_host->power_mode = power_mode;
434 static void sdhci_omap_set_bus_mode(struct sdhci_omap_host *omap_host,
439 if (omap_host->bus_mode == mode)
442 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CON);
443 if (mode == MMC_BUSMODE_OPENDRAIN)
447 sdhci_omap_writel(omap_host, SDHCI_OMAP_CON, reg);
449 omap_host->bus_mode = mode;
452 static void sdhci_omap_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
454 struct sdhci_host *host = mmc_priv(mmc);
455 struct sdhci_pltfm_host *pltfm_host;
456 struct sdhci_omap_host *omap_host;
458 pltfm_host = sdhci_priv(host);
459 omap_host = sdhci_pltfm_priv(pltfm_host);
461 sdhci_omap_set_bus_mode(omap_host, ios->bus_mode);
462 sdhci_set_ios(mmc, ios);
463 sdhci_omap_set_power_mode(omap_host, ios->power_mode);
466 static u16 sdhci_omap_calc_divisor(struct sdhci_pltfm_host *host,
471 dsor = DIV_ROUND_UP(clk_get_rate(host->clk), clock);
472 if (dsor > SYSCTL_CLKD_MAX)
473 dsor = SYSCTL_CLKD_MAX;
478 static void sdhci_omap_start_clock(struct sdhci_omap_host *omap_host)
482 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_SYSCTL);
484 sdhci_omap_writel(omap_host, SDHCI_OMAP_SYSCTL, reg);
487 static void sdhci_omap_stop_clock(struct sdhci_omap_host *omap_host)
491 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_SYSCTL);
493 sdhci_omap_writel(omap_host, SDHCI_OMAP_SYSCTL, reg);
496 static void sdhci_omap_set_clock(struct sdhci_host *host, unsigned int clock)
498 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
499 struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host);
500 unsigned long clkdiv;
502 sdhci_omap_stop_clock(omap_host);
507 clkdiv = sdhci_omap_calc_divisor(pltfm_host, clock);
508 clkdiv = (clkdiv & SYSCTL_CLKD_MASK) << SYSCTL_CLKD_SHIFT;
509 sdhci_enable_clk(host, clkdiv);
511 sdhci_omap_start_clock(omap_host);
514 static void sdhci_omap_set_power(struct sdhci_host *host, unsigned char mode,
517 struct mmc_host *mmc = host->mmc;
519 mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd);
522 static int sdhci_omap_enable_dma(struct sdhci_host *host)
525 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
526 struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host);
528 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CON);
529 reg |= CON_DMA_MASTER;
530 sdhci_omap_writel(omap_host, SDHCI_OMAP_CON, reg);
535 static unsigned int sdhci_omap_get_min_clock(struct sdhci_host *host)
537 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
539 return clk_get_rate(pltfm_host->clk) / SYSCTL_CLKD_MAX;
542 static void sdhci_omap_set_bus_width(struct sdhci_host *host, int width)
544 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
545 struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host);
548 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CON);
549 if (width == MMC_BUS_WIDTH_8)
553 sdhci_omap_writel(omap_host, SDHCI_OMAP_CON, reg);
555 sdhci_set_bus_width(host, width);
558 static void sdhci_omap_init_74_clocks(struct sdhci_host *host, u8 power_mode)
562 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
563 struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host);
565 if (omap_host->power_mode == power_mode)
568 if (power_mode != MMC_POWER_ON)
571 disable_irq(host->irq);
573 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CON);
575 sdhci_omap_writel(omap_host, SDHCI_OMAP_CON, reg);
576 sdhci_omap_writel(omap_host, SDHCI_OMAP_CMD, 0x0);
579 timeout = ktime_add_ms(ktime_get(), SDHCI_OMAP_TIMEOUT);
580 while (!(sdhci_omap_readl(omap_host, SDHCI_OMAP_STAT) & INT_CC_EN)) {
581 if (WARN_ON(ktime_after(ktime_get(), timeout)))
586 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CON);
588 sdhci_omap_writel(omap_host, SDHCI_OMAP_CON, reg);
589 sdhci_omap_writel(omap_host, SDHCI_OMAP_STAT, INT_CC_EN);
591 enable_irq(host->irq);
594 static void sdhci_omap_set_uhs_signaling(struct sdhci_host *host,
598 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
599 struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host);
601 sdhci_omap_stop_clock(omap_host);
603 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CON);
604 if (timing == MMC_TIMING_UHS_DDR50 || timing == MMC_TIMING_MMC_DDR52)
608 sdhci_omap_writel(omap_host, SDHCI_OMAP_CON, reg);
610 sdhci_set_uhs_signaling(host, timing);
611 sdhci_omap_start_clock(omap_host);
614 static struct sdhci_ops sdhci_omap_ops = {
615 .set_clock = sdhci_omap_set_clock,
616 .set_power = sdhci_omap_set_power,
617 .enable_dma = sdhci_omap_enable_dma,
618 .get_max_clock = sdhci_pltfm_clk_get_max_clock,
619 .get_min_clock = sdhci_omap_get_min_clock,
620 .set_bus_width = sdhci_omap_set_bus_width,
621 .platform_send_init_74_clocks = sdhci_omap_init_74_clocks,
622 .reset = sdhci_reset,
623 .set_uhs_signaling = sdhci_omap_set_uhs_signaling,
626 static int sdhci_omap_set_capabilities(struct sdhci_omap_host *omap_host)
630 struct device *dev = omap_host->dev;
631 struct regulator *vqmmc;
633 vqmmc = regulator_get(dev, "vqmmc");
635 ret = PTR_ERR(vqmmc);
639 /* voltage capabilities might be set by boot loader, clear it */
640 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_CAPA);
641 reg &= ~(CAPA_VS18 | CAPA_VS30 | CAPA_VS33);
643 if (regulator_is_supported_voltage(vqmmc, IOV_3V3, IOV_3V3))
645 if (regulator_is_supported_voltage(vqmmc, IOV_1V8, IOV_1V8))
648 sdhci_omap_writel(omap_host, SDHCI_OMAP_CAPA, reg);
651 regulator_put(vqmmc);
656 static const struct sdhci_pltfm_data sdhci_omap_pdata = {
657 .quirks = SDHCI_QUIRK_BROKEN_CARD_DETECTION |
658 SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK |
659 SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN |
660 SDHCI_QUIRK_NO_HISPD_BIT |
661 SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC,
662 .quirks2 = SDHCI_QUIRK2_NO_1_8_V |
663 SDHCI_QUIRK2_ACMD23_BROKEN |
664 SDHCI_QUIRK2_RSP_136_HAS_CRC,
665 .ops = &sdhci_omap_ops,
668 static const struct sdhci_omap_data dra7_data = {
672 static const struct of_device_id omap_sdhci_match[] = {
673 { .compatible = "ti,dra7-sdhci", .data = &dra7_data },
676 MODULE_DEVICE_TABLE(of, omap_sdhci_match);
678 static int sdhci_omap_probe(struct platform_device *pdev)
682 struct device *dev = &pdev->dev;
683 struct sdhci_host *host;
684 struct sdhci_pltfm_host *pltfm_host;
685 struct sdhci_omap_host *omap_host;
686 struct mmc_host *mmc;
687 const struct of_device_id *match;
688 struct sdhci_omap_data *data;
690 match = of_match_device(omap_sdhci_match, dev);
694 data = (struct sdhci_omap_data *)match->data;
696 dev_err(dev, "no sdhci omap data\n");
699 offset = data->offset;
701 host = sdhci_pltfm_init(pdev, &sdhci_omap_pdata,
704 dev_err(dev, "Failed sdhci_pltfm_init\n");
705 return PTR_ERR(host);
708 pltfm_host = sdhci_priv(host);
709 omap_host = sdhci_pltfm_priv(pltfm_host);
710 omap_host->host = host;
711 omap_host->base = host->ioaddr;
712 omap_host->dev = dev;
713 omap_host->power_mode = MMC_POWER_UNDEFINED;
714 host->ioaddr += offset;
717 ret = mmc_of_parse(mmc);
721 pltfm_host->clk = devm_clk_get(dev, "fck");
722 if (IS_ERR(pltfm_host->clk)) {
723 ret = PTR_ERR(pltfm_host->clk);
727 ret = clk_set_rate(pltfm_host->clk, mmc->f_max);
729 dev_err(dev, "failed to set clock to %d\n", mmc->f_max);
733 omap_host->pbias = devm_regulator_get_optional(dev, "pbias");
734 if (IS_ERR(omap_host->pbias)) {
735 ret = PTR_ERR(omap_host->pbias);
738 dev_dbg(dev, "unable to get pbias regulator %d\n", ret);
740 omap_host->pbias_enabled = false;
743 * omap_device_pm_domain has callbacks to enable the main
744 * functional clock, interface clock and also configure the
745 * SYSCONFIG register of omap devices. The callback will be invoked
746 * as part of pm_runtime_get_sync.
748 pm_runtime_enable(dev);
749 ret = pm_runtime_get_sync(dev);
751 dev_err(dev, "pm_runtime_get_sync failed\n");
752 pm_runtime_put_noidle(dev);
753 goto err_rpm_disable;
756 ret = sdhci_omap_set_capabilities(omap_host);
758 dev_err(dev, "failed to set system capabilities\n");
762 host->mmc_host_ops.get_ro = mmc_gpio_get_ro;
763 host->mmc_host_ops.start_signal_voltage_switch =
764 sdhci_omap_start_signal_voltage_switch;
765 host->mmc_host_ops.set_ios = sdhci_omap_set_ios;
766 host->mmc_host_ops.card_busy = sdhci_omap_card_busy;
767 host->mmc_host_ops.execute_tuning = sdhci_omap_execute_tuning;
769 sdhci_read_caps(host);
770 host->caps |= SDHCI_CAN_DO_ADMA2;
772 ret = sdhci_add_host(host);
779 pm_runtime_put_sync(dev);
782 pm_runtime_disable(dev);
785 sdhci_pltfm_free(pdev);
789 static int sdhci_omap_remove(struct platform_device *pdev)
791 struct device *dev = &pdev->dev;
792 struct sdhci_host *host = platform_get_drvdata(pdev);
794 sdhci_remove_host(host, true);
795 pm_runtime_put_sync(dev);
796 pm_runtime_disable(dev);
797 sdhci_pltfm_free(pdev);
802 static struct platform_driver sdhci_omap_driver = {
803 .probe = sdhci_omap_probe,
804 .remove = sdhci_omap_remove,
806 .name = "sdhci-omap",
807 .of_match_table = omap_sdhci_match,
811 module_platform_driver(sdhci_omap_driver);
813 MODULE_DESCRIPTION("SDHCI driver for OMAP SoCs");
814 MODULE_AUTHOR("Texas Instruments Inc.");
815 MODULE_LICENSE("GPL v2");
816 MODULE_ALIAS("platform:sdhci_omap");