[PATCH 4/7] mmc: check correctness of the voltage mask in ocr

Sascha Hauer s.hauer at pengutronix.de
Mon Apr 4 09:09:42 EDT 2011


Most cards do not answer if some reserved bits
in the ocr are set. However, some controllers
can set bit 7 (reserved for low voltages), but
how to manage low voltages SD card is not yet
specified.

based on the original U-Boot patch from
Stefano Babic <sbabic at denx.de>

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/mci/mci-core.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 0137152..f3d975d 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -215,6 +215,16 @@ static int sd_send_op_cond(struct device_d *mci_dev)
 	struct mci_cmd cmd;
 	int timeout = 1000;
 	int err;
+	unsigned voltages;
+
+	/*
+	 * Most cards do not answer if some reserved bits
+	 * in the ocr are set. However, Some controller
+	 * can set bit 7 (reserved for low voltages), but
+	 * how to manage low voltages SD card is not yet
+	 * specified.
+	 */
+	voltages = host->voltages & 0xff8000;
 
 	do {
 		mci_setup_cmd(&cmd, MMC_CMD_APP_CMD, 0, MMC_RSP_R1);
@@ -225,7 +235,7 @@ static int sd_send_op_cond(struct device_d *mci_dev)
 		}
 
 		mci_setup_cmd(&cmd, SD_CMD_APP_SEND_OP_COND,
-			host->voltages | (mci->version == SD_VERSION_2 ? OCR_HCS : 0),
+			voltages | (mci->version == SD_VERSION_2 ? OCR_HCS : 0),
 			MMC_RSP_R3);
 		err = mci_send_cmd(mci_dev, &cmd, NULL);
 		if (err) {
-- 
1.7.2.3




More information about the barebox mailing list