mmc: sdhci: Fix warning message when accessing RPMB in HS400 mode
authorAl Cooper <alcooperx@gmail.com>
Thu, 24 Jun 2021 16:30:45 +0000 (12:30 -0400)
committerUlf Hansson <ulf.hansson@linaro.org>
Fri, 2 Jul 2021 12:59:51 +0000 (14:59 +0200)
commitd0244847f9fc5e20df8b7483c8a4717fe0432d38
tree240f734f10c4cf98e28c03e3596ca37fb81eef6e
parent2fee14ac97dc74f6a8525e69640c6972a4f36899
mmc: sdhci: Fix warning message when accessing RPMB in HS400 mode

When an eMMC device is being run in HS400 mode, any access to the
RPMB device will cause the error message "mmc1: Invalid UHS-I mode
selected". This happens as a result of tuning being disabled before
RPMB access and then re-enabled after the RPMB access is complete.
When tuning is re-enabled, the system has to switch from HS400
to HS200 to do the tuning and then back to HS400. As part of
sequence to switch from HS400 to HS200 the system is temporarily
put into HS mode. When switching to HS mode, sdhci_get_preset_value()
is called and does not have support for HS mode and prints the warning
message and returns the preset for SDR12. The fix is to add support
for MMC and SD HS modes to sdhci_get_preset_value().

This can be reproduced on any system running eMMC in HS400 mode
(not HS400ES) by using the "mmc" utility to run the following
command: "mmc rpmb read-counter /dev/mmcblk0rpmb".

Signed-off-by: Al Cooper <alcooperx@gmail.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Fixes: 52983382c74f ("mmc: sdhci: enhance preset value function")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20210624163045.33651-1-alcooperx@gmail.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/sdhci.c
drivers/mmc/host/sdhci.h