Commit d1f1dd86 authored by Doug Anderson's avatar Doug Anderson Committed by Ulf Hansson

mmc: dw_mmc: Give a good reset after we give power

We should give dw_mmc a good reset after we apply power.  On some
boards vqmmc may actually be connected to the IP block in the SoC so
it's good to reset after power comes in.

Without this we sometimes see failures enumerating cards on rk3288.
Signed-off-by: default avatarDoug Anderson <dianders@chromium.org>
Tested-by: default avatarJavier Martinez Canillas <javier.martinez@collabora.co.uk>
Signed-off-by: default avatarJaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 655babbd
...@@ -1120,13 +1120,23 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) ...@@ -1120,13 +1120,23 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
mci_writel(slot->host, PWREN, regs); mci_writel(slot->host, PWREN, regs);
break; break;
case MMC_POWER_ON: case MMC_POWER_ON:
if (!IS_ERR(mmc->supply.vqmmc) && !slot->host->vqmmc_enabled) { if (!slot->host->vqmmc_enabled) {
ret = regulator_enable(mmc->supply.vqmmc); if (!IS_ERR(mmc->supply.vqmmc)) {
if (ret < 0) ret = regulator_enable(mmc->supply.vqmmc);
dev_err(slot->host->dev, if (ret < 0)
"failed to enable vqmmc regulator\n"); dev_err(slot->host->dev,
else "failed to enable vqmmc\n");
else
slot->host->vqmmc_enabled = true;
} else {
/* Keep track so we don't reset again */
slot->host->vqmmc_enabled = true; slot->host->vqmmc_enabled = true;
}
/* Reset our state machine after powering on */
dw_mci_ctrl_reset(slot->host,
SDMMC_CTRL_ALL_RESET_FLAGS);
} }
/* Adjust clock / bus width after power is up */ /* Adjust clock / bus width after power is up */
...@@ -1140,10 +1150,9 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) ...@@ -1140,10 +1150,9 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
if (!IS_ERR(mmc->supply.vmmc)) if (!IS_ERR(mmc->supply.vmmc))
mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0); mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0);
if (!IS_ERR(mmc->supply.vqmmc) && slot->host->vqmmc_enabled) { if (!IS_ERR(mmc->supply.vqmmc) && slot->host->vqmmc_enabled)
regulator_disable(mmc->supply.vqmmc); regulator_disable(mmc->supply.vqmmc);
slot->host->vqmmc_enabled = false; slot->host->vqmmc_enabled = false;
}
regs = mci_readl(slot->host, PWREN); regs = mci_readl(slot->host, PWREN);
regs &= ~(1 << slot->id); regs &= ~(1 << slot->id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment