summaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorAndrew Gabbasov <andrew_gabbasov@mentor.com>2015-03-19 07:44:05 -0500
committerPantelis Antoniou <pantelis.antoniou@konsulko.com>2015-05-05 11:54:40 +0300
commitcc17c01f2d3b691ddadbd46727d5f22db0a90808 (patch)
treea4ea6b1ffdc8441b2d8fa23a7ecdd372edb40f8c /drivers/mmc
parent5289b5350ba5442cfcfbb18488b3a9d9e4f39ede (diff)
downloadblackbird-obmc-uboot-cc17c01f2d3b691ddadbd46727d5f22db0a90808.tar.gz
blackbird-obmc-uboot-cc17c01f2d3b691ddadbd46727d5f22db0a90808.zip
mmc: Continue polling MMC card for OCR only if it is still not ready
Some MMC cards come to ready state quite quickly, so that the respective flag appears to be set in mmc_send_op_cond already. In this case trying to continue polling the card with CMD1 in mmc_complete_op_cond is incorrect and may lead to unpredictable results. So check the flag before polling and skip it appropriately. Signed-off-by: Andrew Gabbasov <andrew_gabbasov@mentor.com>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/mmc.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index d073d7900c..42af47c4c2 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -403,15 +403,17 @@ static int mmc_complete_op_cond(struct mmc *mmc)
int err;
mmc->op_cond_pending = 0;
- start = get_timer(0);
- do {
- err = mmc_send_op_cond_iter(mmc, 1);
- if (err)
- return err;
- if (get_timer(start) > timeout)
- return UNUSABLE_ERR;
- udelay(100);
- } while (!(mmc->ocr & OCR_BUSY));
+ if (!(mmc->ocr & OCR_BUSY)) {
+ start = get_timer(0);
+ do {
+ err = mmc_send_op_cond_iter(mmc, 1);
+ if (err)
+ return err;
+ if (get_timer(start) > timeout)
+ return UNUSABLE_ERR;
+ udelay(100);
+ } while (!(mmc->ocr & OCR_BUSY));
+ }
if (mmc_host_is_spi(mmc)) { /* read OCR for spi */
cmd.cmdidx = MMC_CMD_SPI_READ_OCR;
OpenPOWER on IntegriCloud