This Linux kernel change "mmc: core: Fix init of SD cards reporting an invalid VDD range" is included in the Linux 4.19.70 release. This change is authored by Ulf Hansson <ulf.hansson [at] linaro.org> on Tue Aug 27 10:10:43 2019 +0200. The commit for this change in Linux stable tree is abc4234 (patch) which is from upstream commit 7274108. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream 7274108.
mmc: core: Fix init of SD cards reporting an invalid VDD range commit 72741084d903e65e121c27bd29494d941729d4a1 upstream. The OCR register defines the supported range of VDD voltages for SD cards. However, it has turned out that some SD cards reports an invalid voltage range, for example having bit7 set. When a host supports MMC_CAP2_FULL_PWR_CYCLE and some of the voltages from the invalid VDD range, this triggers the core to run a power cycle of the card to try to initialize it at the lowest common supported voltage. Obviously this fails, since the card can't support it. Let's fix this problem, by clearing invalid bits from the read OCR register for SD cards, before proceeding with the VDD voltage negotiation. Cc: firstname.lastname@example.org Reported-by: Philip Langdale <email@example.com> Signed-off-by: Ulf Hansson <firstname.lastname@example.org> Reviewed-by: Philip Langdale <email@example.com> Tested-by: Philip Langdale <firstname.lastname@example.org> Tested-by: Manuel Presnitz <email@example.com> Signed-off-by: Greg Kroah-Hartman <firstname.lastname@example.org>
There are 6 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.
drivers/mmc/core/sd.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index cfb8ee2..0473835 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -1277,6 +1277,12 @@ int mmc_attach_sd(struct mmc_host *host) goto err; } + /* + * Some SD cards claims an out of spec VDD voltage range. Let's treat + * these bits as being in-valid and especially also bit7. + */ + ocr &= ~0x7FFF; + rocr = mmc_select_voltage(host, ocr); /*