mmc: Fix bus width setting in enhanced strobe mode

The 8-bit bus width needs to be set first before switching to
DDR bus width when entering HS400 in enhanced strobe mode.
Also use the mmc_select_bus_width() for doing this instead of
rewriting portion of that code.

Change-Id: If9bec799de77714d7183c812a0ba04a9a4ac48f5
Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
[subhashj@codeaurora.org: fixed trivial merge conflicts]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
This commit is contained in:
Venkat Gopalakrishnan 2015-06-11 18:27:27 -07:00 committed by Subhash Jadavani
parent 506b393bf6
commit ac15746a7b

View file

@ -1189,8 +1189,12 @@ static int mmc_select_hs400(struct mmc_card *card)
}
val = EXT_CSD_DDR_BUS_WIDTH_8;
if (card->ext_csd.strobe_support)
if (card->ext_csd.strobe_support) {
err = mmc_select_bus_width(card);
if (IS_ERR_VALUE(err))
return err;
val |= EXT_CSD_BUS_WIDTH_STROBE;
}
/* Switch card to DDR */
err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
@ -1203,25 +1207,6 @@ static int mmc_select_hs400(struct mmc_card *card)
return err;
}
if (card->ext_csd.strobe_support) {
mmc_set_bus_width(host, MMC_BUS_WIDTH_8);
/*
* If controller can't handle bus width test,
* compare ext_csd previously read in 1 bit mode
* against ext_csd at new bus width
*/
if (!(host->caps & MMC_CAP_BUS_WIDTH_TEST))
err = mmc_compare_ext_csds(card, MMC_BUS_WIDTH_8);
else
err = mmc_bus_test(card, MMC_BUS_WIDTH_8);
if (err) {
pr_warn("%s: switch to bus width %d failed\n",
mmc_hostname(host), MMC_BUS_WIDTH_8);
return err;
}
}
/* Switch card to HS400 */
val = EXT_CSD_TIMING_HS400 |
card->drive_strength << EXT_CSD_DRV_STR_SHIFT;