summaryrefslogtreecommitdiff
path: root/drivers/mmc
diff options
context:
space:
mode:
authorDoug Anderson <dianders@chromium.org>2015-02-20 18:57:18 (GMT)
committerUlf Hansson <ulf.hansson@linaro.org>2015-03-23 13:13:29 (GMT)
commit655babbde6fdbd5a4a4072b7cdd8b1fb1a23db24 (patch)
tree0e5365efd7a6f71b43dca019b2427772753aefab /drivers/mmc
parentbdb9a90b3d123d9d421dd840c0f7fba1d1dfeba2 (diff)
downloadlinux-655babbde6fdbd5a4a4072b7cdd8b1fb1a23db24.tar.xz
mmc: dw_mmc: Make sure we only adjust the clock when power is on
It appears that we can confuse things if we try to turn on the MMC clock when the power is off. Adjust is so that we turn the clock on (using dw_mci_setup_bus) after power is all the way on and we turn the clock off before the power goes off. Signed-off-by: Doug Anderson <dianders@chromium.org> Tested-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/dw_mmc.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index bed0f94..a5315b2 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -1102,12 +1102,6 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
if (drv_data && drv_data->set_ios)
drv_data->set_ios(slot->host, ios);
- /* Slot specific timing and width adjustment */
- dw_mci_setup_bus(slot, false);
-
- if (slot->host->state == STATE_WAITING_CMD11_DONE && ios->clock != 0)
- slot->host->state = STATE_IDLE;
-
switch (ios->power_mode) {
case MMC_POWER_UP:
if (!IS_ERR(mmc->supply.vmmc)) {
@@ -1134,8 +1128,15 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
else
slot->host->vqmmc_enabled = true;
}
+
+ /* Adjust clock / bus width after power is up */
+ dw_mci_setup_bus(slot, false);
+
break;
case MMC_POWER_OFF:
+ /* Turn clock off before power goes down */
+ dw_mci_setup_bus(slot, false);
+
if (!IS_ERR(mmc->supply.vmmc))
mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0);
@@ -1151,6 +1152,9 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
default:
break;
}
+
+ if (slot->host->state == STATE_WAITING_CMD11_DONE && ios->clock != 0)
+ slot->host->state = STATE_IDLE;
}
static int dw_mci_card_busy(struct mmc_host *mmc)