From aff06730c3dea8ca06a22b7ff6b7d5253e9d025c Mon Sep 17 00:00:00 2001 From: Asutosh Das Date: Thu, 25 Feb 2016 17:30:38 +0530 Subject: [PATCH] mmc: core: modify scaling up/down sequence The scaling down sequence requires the clock to be set after selecting the corresponding bus-speed mode in the controller. The scaling up to HS400 requires the timing and clock to be set to legacy. Without the above configuration, bus-width switch fails, further leading to CRC errors. Change-Id: If502f28e19924264dfb99d76f6881d3167f56a05 Signed-off-by: Asutosh Das Signed-off-by: Pavan Anamula --- drivers/mmc/core/mmc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index fa3fd73b4bc5..e3760d8a8741 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1550,7 +1550,6 @@ static int mmc_select_hs_ddr52(struct mmc_host *host) int err; mmc_select_hs(host->card); - mmc_set_clock(host, MMC_HIGH_52_MAX_DTR); err = mmc_select_bus_width(host->card); if (err < 0) { pr_err("%s: %s: select_bus_width failed(%d)\n", @@ -1559,6 +1558,7 @@ static int mmc_select_hs_ddr52(struct mmc_host *host) } err = mmc_select_hs_ddr(host->card); + mmc_set_clock(host, MMC_HIGH_52_MAX_DTR); return err; } @@ -1610,6 +1610,11 @@ static int mmc_scale_high(struct mmc_host *host) { int err = 0; + if (mmc_card_ddr52(host->card)) { + mmc_set_timing(host, MMC_TIMING_LEGACY); + mmc_set_clock(host, MMC_HIGH_26_MAX_DTR); + } + if (!host->card->ext_csd.strobe_support) { if (!(host->card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS200)) { pr_err("%s: %s: card does not support HS200\n",