Skip to content
/ linux Public

Commit 5ed633b

Browse files
Luke Wanggregkh
authored andcommitted
mmc: sdhci: fix timing selection for 1-bit bus width
commit 5e3486e upstream. When 1-bit bus width is used with HS200/HS400 capabilities set, mmc_select_hs200() returns 0 without actually switching. This causes mmc_select_timing() to skip mmc_select_hs(), leaving eMMC in legacy mode (26MHz) instead of High Speed SDR (52MHz). Per JEDEC eMMC spec section 5.3.2, 1-bit mode supports High Speed SDR. Drop incompatible HS200/HS400/UHS/DDR caps early so timing selection falls through to mmc_select_hs() correctly. Fixes: f2119df ("mmc: sd: add support for signal voltage switch procedure") Signed-off-by: Luke Wang <ziniu.wang_1@nxp.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Cc: stable@vger.kernel.org Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent c8d5757 commit 5ed633b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

drivers/mmc/host/sdhci.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4532,8 +4532,15 @@ int sdhci_setup_host(struct sdhci_host *host)
45324532
* their platform code before calling sdhci_add_host(), and we
45334533
* won't assume 8-bit width for hosts without that CAP.
45344534
*/
4535-
if (!(host->quirks & SDHCI_QUIRK_FORCE_1_BIT_DATA))
4535+
if (host->quirks & SDHCI_QUIRK_FORCE_1_BIT_DATA) {
4536+
host->caps1 &= ~(SDHCI_SUPPORT_SDR104 | SDHCI_SUPPORT_SDR50 | SDHCI_SUPPORT_DDR50);
4537+
if (host->quirks2 & SDHCI_QUIRK2_CAPS_BIT63_FOR_HS400)
4538+
host->caps1 &= ~SDHCI_SUPPORT_HS400;
4539+
mmc->caps2 &= ~(MMC_CAP2_HS200 | MMC_CAP2_HS400 | MMC_CAP2_HS400_ES);
4540+
mmc->caps &= ~(MMC_CAP_DDR | MMC_CAP_UHS);
4541+
} else {
45364542
mmc->caps |= MMC_CAP_4_BIT_DATA;
4543+
}
45374544

45384545
if (host->quirks2 & SDHCI_QUIRK2_HOST_NO_CMD23)
45394546
mmc->caps &= ~MMC_CAP_CMD23;

0 commit comments

Comments
 (0)