Skip to content

Commit 918f4cb

Browse files
Jisheng Zhangstorulf
authored andcommitted
mmc: sdhci: restore behavior when setting VDD via external regulator
After commit 5222161 ("mmc: sdhci: Improve external VDD regulator support"), for the VDD is supplied via external regulators, we ignore the code to convert a VDD voltage request into one of the standard SDHCI voltage levels, then program it in the SDHCI_POWER_CONTROL. This brings two issues: 1. SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON quirk isn't handled properly any more. 2. What's more, once SDHCI_POWER_ON bit is set, some controllers such as the sdhci-pxav3 used in marvell berlin SoCs require the voltage levels programming in the SDHCI_POWER_CONTROL register, even the VDD is supplied by external regulator. So the host in marvell berlin SoCs still works fine after the commit. However, commit 3cbc612 ("mmc: sdhci: Set SDHCI_POWER_ON with external vmmc") sets the SDHCI_POWER_ON bit, this would make the host in marvell berlin SoCs won't work any more with external vmmc. This patch restores the behavior when setting VDD through external regulator by moving the call of mmc_regulator_set_ocr() to the end of sdhci_set_power() function. After this patch, the sdcard on Marvell Berlin SoC boards work again. Signed-off-by: Jisheng Zhang <jszhang@marvell.com> Fixes: 5222161 ("mmc: sdhci: Improve external VDD ...") Reviewed-by: Ludovic Desroches <ludovic.desroches@atmel.com> Tested-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 520322d commit 918f4cb

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

drivers/mmc/host/sdhci.c

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,19 +1275,6 @@ static void sdhci_set_power(struct sdhci_host *host, unsigned char mode,
12751275
struct mmc_host *mmc = host->mmc;
12761276
u8 pwr = 0;
12771277

1278-
if (!IS_ERR(mmc->supply.vmmc)) {
1279-
spin_unlock_irq(&host->lock);
1280-
mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd);
1281-
spin_lock_irq(&host->lock);
1282-
1283-
if (mode != MMC_POWER_OFF)
1284-
sdhci_writeb(host, SDHCI_POWER_ON, SDHCI_POWER_CONTROL);
1285-
else
1286-
sdhci_writeb(host, 0, SDHCI_POWER_CONTROL);
1287-
1288-
return;
1289-
}
1290-
12911278
if (mode != MMC_POWER_OFF) {
12921279
switch (1 << vdd) {
12931280
case MMC_VDD_165_195:
@@ -1348,6 +1335,12 @@ static void sdhci_set_power(struct sdhci_host *host, unsigned char mode,
13481335
if (host->quirks & SDHCI_QUIRK_DELAY_AFTER_POWER)
13491336
mdelay(10);
13501337
}
1338+
1339+
if (!IS_ERR(mmc->supply.vmmc)) {
1340+
spin_unlock_irq(&host->lock);
1341+
mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd);
1342+
spin_lock_irq(&host->lock);
1343+
}
13511344
}
13521345

13531346
/*****************************************************************************\

0 commit comments

Comments
 (0)