summaryrefslogtreecommitdiffstats
path: root/drivers/mci/mci-core.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2011-03-18 13:43:23 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2011-04-04 15:02:35 +0200
commitc8df17c05f38b94040ca0c607ef1d24f2b489c76 (patch)
treeb3bd0f424e1d842a7cae0b87a7a50c13442e84ff /drivers/mci/mci-core.c
parent0fed2e4d323ae2d1d40043d7aad49644f66e3501 (diff)
downloadbarebox-c8df17c05f38b94040ca0c607ef1d24f2b489c76.tar.gz
barebox-c8df17c05f38b94040ca0c607ef1d24f2b489c76.tar.xz
mmc: check correctness of the voltage mask in ocr
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@denx.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/mci/mci-core.c')
-rw-r--r--drivers/mci/mci-core.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 01371523d8..f3d975d638 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) {