9
0
Fork 0

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>
This commit is contained in:
Sascha Hauer 2011-03-18 13:43:23 +01:00
parent 0fed2e4d32
commit c8df17c05f
1 changed files with 11 additions and 1 deletions

View File

@ -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) {