Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: core: Update CMD13 polling policy when switch to HS DDR mode

According to the JEDEC specification, during bus timing change operations
for mmc, sending a CMD13 could trigger CRC errors.

As switching to HS DDR mode indeed causes a bus timing change, polling with
CMD13 to detect card busy, may thus potentially trigger CRC errors.
Currently these errors are treated as the switch to HS DDR mode failed.

To improve this behaviour, let's instead tell __mmc_switch() to retry when
it encounters CRC errors during polling.

Moreover, when switching to HS DDR mode, let's make sure the CMD13 polling
is done by having the mmc host and the mmc card, being configured to
operate at the same selected bus speed timing. Fix this by providing
MMC_TIMING_MMC_DDR52 as the timing parameter to __mmc_switch().

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>

+6 -7
+6 -7
drivers/mmc/core/mmc.c
··· 1040 1040 ext_csd_bits = (bus_width == MMC_BUS_WIDTH_8) ? 1041 1041 EXT_CSD_DDR_BUS_WIDTH_8 : EXT_CSD_DDR_BUS_WIDTH_4; 1042 1042 1043 - err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, 1044 - EXT_CSD_BUS_WIDTH, 1045 - ext_csd_bits, 1046 - card->ext_csd.generic_cmd6_time); 1043 + err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, 1044 + EXT_CSD_BUS_WIDTH, 1045 + ext_csd_bits, 1046 + card->ext_csd.generic_cmd6_time, 1047 + MMC_TIMING_MMC_DDR52, 1048 + true, true, true); 1047 1049 if (err) { 1048 1050 pr_err("%s: switch to bus width %d ddr failed\n", 1049 1051 mmc_hostname(host), 1 << bus_width); ··· 1087 1085 /* make sure vccq is 3.3v after switching disaster */ 1088 1086 if (err) 1089 1087 err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330); 1090 - 1091 - if (!err) 1092 - mmc_set_timing(host, MMC_TIMING_MMC_DDR52); 1093 1088 1094 1089 return err; 1095 1090 }