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>
This commit is contained in:
parent
17a0751e60
commit
3e09a81e16
|
@ -1861,31 +1861,17 @@ static int mmci_get_cd(struct mmc_host *mmc)
|
|||
static int mmci_sig_volt_switch(struct mmc_host *mmc, struct mmc_ios *ios)
|
||||
{
|
||||
struct mmci_host *host = mmc_priv(mmc);
|
||||
int ret = 0;
|
||||
int ret;
|
||||
|
||||
if (!IS_ERR(mmc->supply.vqmmc)) {
|
||||
ret = mmc_regulator_set_vqmmc(mmc, ios);
|
||||
|
||||
switch (ios->signal_voltage) {
|
||||
case MMC_SIGNAL_VOLTAGE_330:
|
||||
ret = regulator_set_voltage(mmc->supply.vqmmc,
|
||||
2700000, 3600000);
|
||||
break;
|
||||
case MMC_SIGNAL_VOLTAGE_180:
|
||||
ret = regulator_set_voltage(mmc->supply.vqmmc,
|
||||
1700000, 1950000);
|
||||
break;
|
||||
case MMC_SIGNAL_VOLTAGE_120:
|
||||
ret = regulator_set_voltage(mmc->supply.vqmmc,
|
||||
1100000, 1300000);
|
||||
break;
|
||||
}
|
||||
if (!ret && host->ops && host->ops->post_sig_volt_switch)
|
||||
ret = host->ops->post_sig_volt_switch(host, ios);
|
||||
else if (ret)
|
||||
ret = 0;
|
||||
|
||||
if (!ret && host->ops && host->ops->post_sig_volt_switch)
|
||||
ret = host->ops->post_sig_volt_switch(host, ios);
|
||||
|
||||
if (ret)
|
||||
dev_warn(mmc_dev(mmc), "Voltage switch failed\n");
|
||||
}
|
||||
if (ret < 0)
|
||||
dev_warn(mmc_dev(mmc), "Voltage switch failed\n");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue