]> git.baikalelectronics.ru Git - kernel.git/commit
mmc: sdhci-brcmstb: Fix incorrect switch to HS mode
authorAl Cooper <alcooperx@gmail.com>
Mon, 13 Jan 2020 21:07:06 +0000 (16:07 -0500)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 20 Jan 2020 11:01:19 +0000 (12:01 +0100)
commita77d59317293b3ae62ea0913d2284a4c84d8acea
treeeaaa03a2012d089105b59607b0a717599fc6032b
parent645c5bf10101e003abb6d8914bcd341902fb50ed
mmc: sdhci-brcmstb: Fix incorrect switch to HS mode

When switching from any MMC speed mode that requires 1.8v
(HS200, HS400 and HS400ES) to High Speed (HS) mode, the system
ends up configured for SDR12 with a 50MHz clock which is an illegal
mode.

This happens because the SDHCI_CTRL_VDD_180 bit in the
SDHCI_HOST_CONTROL2 register is left set and when this bit is
set, the speed mode is controlled by the SDHCI_CTRL_UHS field
in the SDHCI_HOST_CONTROL2 register. The SDHCI_CTRL_UHS field
will end up being set to 0 (SDR12) by sdhci_set_uhs_signaling()
because there is no UHS mode being set.

The fix is to change sdhci_set_uhs_signaling() to set the
SDHCI_CTRL_UHS field to SDR25 (which is the same as HS) for
any switch to HS mode.

This was found on a new eMMC controller that does strict checking
of the speed mode and the corresponding clock rate. It caused the
switch to HS400 mode to fail because part of the sequence to switch
to HS400 requires a switch from HS200 to HS before going to HS400.

This issue was previously fixed by commit 8486ae4c9a4c8 ("mmc: sdhci:
Fix incorrect switch to HS mode") and later removed by commit
b4b7668a3e87 ("Revert \"mmc: sdhci: Fix incorrect switch to HS mode\"")
because it caused failures with some SD cards on AM65X systems. The
fix will now be done in a platform specific callback instead of
common sdhci code.

Signed-off-by: Al Cooper <alcooperx@gmail.com>
Suggested-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20200113210706.11972-7-alcooperx@gmail.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/sdhci-brcmstb.c