summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorRaffaele Recalcati <raffaele.recalcati@bticino.it>2011-03-11 02:01:13 +0000
committerAndy Fleming <afleming@freescale.com>2011-04-13 07:09:04 -0500
commit31cacbabf07ce00f5250b9826d5e48d4bbee1f94 (patch)
tree6a74675a8854534415fda66327ffd944299a6972 /drivers
parent5d4fc8d907ed12844b9c9190601fef2919f3ec25 (diff)
downloadu-boot-imx-31cacbabf07ce00f5250b9826d5e48d4bbee1f94.zip
u-boot-imx-31cacbabf07ce00f5250b9826d5e48d4bbee1f94.tar.gz
u-boot-imx-31cacbabf07ce00f5250b9826d5e48d4bbee1f94.tar.bz2
mmc: SEND_OP_COND considers card capabilities (voltage)
The first SEND_OP_COND (CMD1) command added is used to ask card capabilities. After it an AND operation is done between card capabilities and host capabilities (at the moment only for the voltage field). Finally the correct value is sent to the MMC, waiting that the card exits from busy state. Signed-off-by: Raffaele Recalcati <raffaele.recalcati@bticino.it> Signed-off-by: Andy Fleming <afleming@freescale.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mmc/mmc.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 3d445c0..64c8d56 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -367,18 +367,33 @@ sd_send_op_cond(struct mmc *mmc)
int mmc_send_op_cond(struct mmc *mmc)
{
- int timeout = 1000;
+ int timeout = 10000;
struct mmc_cmd cmd;
int err;
/* Some cards seem to need this */
mmc_go_idle(mmc);
+ /* Asking to the card its capabilities */
+ cmd.cmdidx = MMC_CMD_SEND_OP_COND;
+ cmd.resp_type = MMC_RSP_R3;
+ cmd.cmdarg = 0;
+ cmd.flags = 0;
+
+ err = mmc_send_cmd(mmc, &cmd, NULL);
+
+ if (err)
+ return err;
+
+ udelay(1000);
+
do {
cmd.cmdidx = MMC_CMD_SEND_OP_COND;
cmd.resp_type = MMC_RSP_R3;
- cmd.cmdarg = OCR_HCS | (mmc_host_is_spi(mmc) ? 0 :
- mmc->voltages);
+ cmd.cmdarg = (mmc_host_is_spi(mmc) ? 0 :
+ (mmc->voltages &
+ (cmd.response[0] & OCR_VOLTAGE_MASK)) |
+ (cmd.response[0] & OCR_ACCESS_MODE));
cmd.flags = 0;
err = mmc_send_cmd(mmc, &cmd, NULL);