summaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core
diff options
context:
space:
mode:
authorPhilip Langdale <philipl@overt.org>2007-03-16 19:39:00 -0700
committerPierre Ossman <drzeus@drzeus.cx>2007-05-01 14:14:50 +0200
commit55556da01284af8c2174b786b3eca8e11301b656 (patch)
tree579e0dbd68021daee1ff0c5b400d9cdf71c6faf8 /drivers/mmc/core
parent4be34c99a2f3aa90fa42e62c0918f07afb8a645b (diff)
MMC: Fix handling of low-voltage cards
Fix handling of low voltage MMC cards. The latest MMC and SD specs both agree that support for low-voltage operations is indicated by bit 7 in the OCR. The MMC spec states that the low voltage range is 1.65-1.95V while the SD spec leaves the actual voltage range undefined - meaning that there is still no such thing as a low voltage SD card. However, an old Sandisk spec implied that bits 7.0 represented voltages below 2.0V in 1V or 0.5V increments, and the code was accordingly written with that expectation. This confusion meant that host drivers attempting to support the typical low voltage (1.8V) would set the wrong bits in the host OCR mask (usually bits 5 and/or 6) resulting in the the low voltage mode never being used. This change corrects the low voltage range and adds sanity checks on the reserved bits (0-6) and for SD cards that claim to support low-voltage operations. Signed-off-by: Philip Langdale <philipl@overt.org> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/mmc/core')
-rw-r--r--drivers/mmc/core/mmc.c11
-rw-r--r--drivers/mmc/core/sd.c18
2 files changed, 29 insertions, 0 deletions
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index c528017d612..c2e120b11be 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -323,6 +323,17 @@ int mmc_attach_mmc(struct mmc_host *host, u32 ocr)
mmc_attach_bus(host, &mmc_ops);
+ /*
+ * Sanity check the voltages that the card claims to
+ * support.
+ */
+ if (ocr & 0x7F) {
+ printk(KERN_WARNING "%s: card claims to support voltages "
+ "below the defined range. These will be ignored.\n",
+ mmc_hostname(host));
+ ocr &= ~0x7F;
+ }
+
host->ocr = mmc_select_voltage(host, ocr);
/*
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 6c6beb48f3a..fb18b301502 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -297,6 +297,24 @@ int mmc_attach_sd(struct mmc_host *host, u32 ocr)
mmc_attach_bus(host, &mmc_sd_ops);
+ /*
+ * Sanity check the voltages that the card claims to
+ * support.
+ */
+ if (ocr & 0x7F) {
+ printk(KERN_WARNING "%s: card claims to support voltages "
+ "below the defined range. These will be ignored.\n",
+ mmc_hostname(host));
+ ocr &= ~0x7F;
+ }
+
+ if (ocr & MMC_VDD_165_195) {
+ printk(KERN_WARNING "%s: SD card claims to support the "
+ "incompletely defined 'low voltage range'. This "
+ "will be ignored.\n", mmc_hostname(host));
+ ocr &= ~MMC_VDD_165_195;
+ }
+
host->ocr = mmc_select_voltage(host, ocr);
/*