summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@linaro.org>2019-08-27 10:10:43 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-09-06 10:23:42 +0200
commita94076eed72e2c97e9ee1e9c753d5dd6a6835b4c (patch)
treef4ec30419ae812bc64e9167723e332061967ed57
parentb8dd05ea2e74de3483d7725493ec76ced513f467 (diff)
downloadlinux-stable-a94076eed72e2c97e9ee1e9c753d5dd6a6835b4c.tar.gz
linux-stable-a94076eed72e2c97e9ee1e9c753d5dd6a6835b4c.tar.bz2
linux-stable-a94076eed72e2c97e9ee1e9c753d5dd6a6835b4c.zip
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: stable@vger.kernel.org Reported-by: Philip Langdale <philipl@overt.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Reviewed-by: Philip Langdale <philipl@overt.org> Tested-by: Philip Langdale <philipl@overt.org> Tested-by: Manuel Presnitz <mail@mpy.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/mmc/core/sd.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index d681e8aaca83..fe914ff5f5d6 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -1292,6 +1292,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);
/*