From b3ccc39737d7bf036faefe005b65d9a6f7264843 Mon Sep 17 00:00:00 2001 From: Sayali Lokhande Date: Wed, 5 Jul 2017 11:21:28 +0530 Subject: [PATCH] mmc: core: Select HS mode in device first and then in the host While switching from hs400 to hs200 mode, high speed mode timing should be selected in the device before changing the clock frequency in the host. But current implementation, (mmc_hs400_to_hs200) first updates the frequency in the host and then updates mode in the device. This is a spec violation. Hence update the sequence to comply with the spec. Change-Id: I0694edac9dd005ec68add9cc38bbe6fa4245ed48 Signed-off-by: Veerabhadrarao Badiganti Signed-off-by: Sayali Lokhande --- drivers/mmc/core/mmc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index b975d6d0116f..71dbb11a880e 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1236,10 +1236,6 @@ int mmc_hs400_to_hs200(struct mmc_card *card) int err; u8 val; - /* Reduce frequency to HS */ - max_dtr = card->ext_csd.hs_max_dtr; - mmc_set_clock(host, max_dtr); - /* Switch HS400 to HS DDR */ val = EXT_CSD_TIMING_HS; err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_HS_TIMING, @@ -1250,6 +1246,10 @@ int mmc_hs400_to_hs200(struct mmc_card *card) mmc_set_timing(host, MMC_TIMING_MMC_DDR52); + /* Reduce frequency to HS */ + max_dtr = card->ext_csd.hs_max_dtr; + mmc_set_clock(host, max_dtr); + err = mmc_switch_status(card); if (err) goto out_err;