[PATCH 2/4] mci-core: spi fix op cond support
Jean-Christophe PLAGNIOL-VILLARD
plagnioj at jcrosoft.com
Tue Nov 13 15:07:19 EST 2012
so we can detect sd card version 2.0 on spi
as we need to the OCR_HCS on version 2.0 regardless if it's a SPI or not
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
---
drivers/mci/mci-core.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 216a8a5..d006869 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -222,6 +222,7 @@ static int sd_send_op_cond(struct mci *mci)
int err;
unsigned voltages;
unsigned busy;
+ unsigned arg;
/*
* Most cards do not answer if some reserved bits
@@ -240,9 +241,12 @@ static int sd_send_op_cond(struct mci *mci)
return err;
}
- mci_setup_cmd(&cmd, SD_CMD_APP_SEND_OP_COND,
- mmc_host_is_spi(host) ? 0 : (voltages | (mci->version == SD_VERSION_2 ? OCR_HCS : 0)),
- MMC_RSP_R3);
+ arg = mmc_host_is_spi(host) ? 0 : voltages;
+
+ if (mci->version == SD_VERSION_2)
+ arg |= OCR_HCS;
+
+ mci_setup_cmd(&cmd, SD_CMD_APP_SEND_OP_COND, arg, MMC_RSP_R3);
err = mci_send_cmd(mci, &cmd, NULL);
if (err) {
dev_dbg(mci->mci_dev, "SD operation condition set failed: %d\n", err);
--
1.7.10.4
More information about the barebox
mailing list