Skip to content

Commit c506f6d

Browse files
Marek Vasutfourmone
authored andcommitted
mmc: mmci: Switch to mmc_regulator_set_vqmmc()
Instead of reimplementing the logic in mmc_regulator_set_vqmmc(), use the mmc code function directly. This also allows us to fix a related issue on STM32MP1, when a voltage switch of 1.8V is done for the eMMC, but the current level is already set to 1.8V. More precisely, in this scenario the call to the ->post_sig_volt_switch() hangs, indefinitely waiting for the voltage switch to complete. Fix this problem by checking if mmc_regulator_set_vqmmc() returned 1 and then skip invoking the callback. Signed-off-by: Marek Vasut <marex@denx.de> Link: https://lore.kernel.org/r/20200416163649.336967-3-marex@denx.de [Ulf: Updated the commit message] Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Change-Id: Iab201cc9b850385258fa0296f86bbaf1723f9830 Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/linux-stm32/+/227065 Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com> Reviewed-by: Yann GAUTIER <yann.gautier@foss.st.com> Reviewed-by: CIBUILD <MDG-smet-aci-builds@list.st.com> Reviewed-by: Christophe KERELLO <christophe.kerello@st.com> Tested-by: Yann GAUTIER <yann.gautier@foss.st.com>
1 parent f37908d commit c506f6d

File tree

1 file changed

+8
-22
lines changed

1 file changed

+8
-22
lines changed

drivers/mmc/host/mmci.c

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1833,31 +1833,17 @@ static int mmci_get_cd(struct mmc_host *mmc)
18331833
static int mmci_sig_volt_switch(struct mmc_host *mmc, struct mmc_ios *ios)
18341834
{
18351835
struct mmci_host *host = mmc_priv(mmc);
1836-
int ret = 0;
1836+
int ret;
18371837

1838-
if (!IS_ERR(mmc->supply.vqmmc)) {
1838+
ret = mmc_regulator_set_vqmmc(mmc, ios);
18391839

1840-
switch (ios->signal_voltage) {
1841-
case MMC_SIGNAL_VOLTAGE_330:
1842-
ret = regulator_set_voltage(mmc->supply.vqmmc,
1843-
2700000, 3600000);
1844-
break;
1845-
case MMC_SIGNAL_VOLTAGE_180:
1846-
ret = regulator_set_voltage(mmc->supply.vqmmc,
1847-
1700000, 1950000);
1848-
break;
1849-
case MMC_SIGNAL_VOLTAGE_120:
1850-
ret = regulator_set_voltage(mmc->supply.vqmmc,
1851-
1100000, 1300000);
1852-
break;
1853-
}
1854-
1855-
if (!ret && host->ops && host->ops->volt_switch)
1856-
ret = host->ops->volt_switch(host, ios);
1840+
if (!ret && host->ops && host->ops->volt_switch)
1841+
ret = host->ops->volt_switch(host, ios);
1842+
else if (ret)
1843+
ret = 0;
18571844

1858-
if (ret)
1859-
dev_warn(mmc_dev(mmc), "Voltage switch failed\n");
1860-
}
1845+
if (ret < 0)
1846+
dev_warn(mmc_dev(mmc), "Voltage switch failed\n");
18611847

18621848
return ret;
18631849
}

0 commit comments

Comments
 (0)