summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorHaibo Chen <haibo.chen@nxp.com>2019-03-18 16:01:45 +0800
committerHaibo Chen <haibo.chen@nxp.com>2019-03-19 11:15:58 +0800
commit0ba8e1c6efa2e9c34c9b54105d6c50ee293ec1d7 (patch)
tree1fd67fc9f8a1ae778dd770f3cff6db945c51fc27 /drivers
parent5dbade95cb7ebc1f3a309b00430ebf2b466d7aba (diff)
MLK-21176 mmc: correct the HS400 initialization process
After the commit b9a2a0e2e9c0 ("mmc: Add support for downgrading HS200/HS400 to HS mode"), it add a parameter in mmc_set_card_speed() which indicates that the HS200/HS400 to HS downgrade is happening. During the HS400 initialization, first select to HS200, and config the related clock rate, then downgrade to HS mode. So here also need to config the downgrade value to be true, make sure in the function mmc_set_card_speed(), after switch to HS mode, first config the clock rate, then read the EXT_CSD. Otherwise read EXT_CSD in HS mode at wrong clock rate, e.g. 200MHz, may lead to uncertain result. Test on i.MX8QM MEK board, some Micron eMMC will stuck in transfer mode in this case, and USDHC will never get data transfer complete status, cause the uboot hang. Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mmc/mmc.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 963c00fba4..85762b82e0 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1924,8 +1924,7 @@ static int mmc_select_hs400(struct mmc *mmc)
}
/* Set back to HS */
- mmc_set_card_speed(mmc, MMC_HS, false);
- mmc_set_clock(mmc, mmc_mode2freq(mmc, MMC_HS), false);
+ mmc_set_card_speed(mmc, MMC_HS, true);
err = mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BUS_WIDTH,
EXT_CSD_BUS_WIDTH_8 | EXT_CSD_DDR_FLAG);
@@ -1962,14 +1961,10 @@ static int mmc_select_hs400es(struct mmc *mmc)
{
int err;
- err = mmc_set_card_speed(mmc, MMC_HS, false);
+ err = mmc_set_card_speed(mmc, MMC_HS, true);
if (err)
return err;
- /* configure the bus mode (host) */
- mmc_select_mode(mmc, MMC_HS);
- mmc_set_clock(mmc, mmc->tran_speed, false);
-
err = mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL,
EXT_CSD_BUS_WIDTH, EXT_CSD_BUS_WIDTH_8 |
EXT_CSD_DDR_FLAG | EXT_CSD_BUS_WIDTH_STROBE);