mmc: Continue polling MMC card for OCR only if it is still not ready
PATCH 4/6 mmc: Continue polling MMC card for OCR only if it is still not ready
Hi Peng,
Quoted 4 lines
From: Peng.Fan at freescale.com [Peng.Fan at freescale.com]
Sent: Friday, March 20, 2015 03:51
To: Gabbasov, Andrew; u-boot at lists.denx.de
Subject: RE: [U-Boot] [PATCH 4/6] mmc: Continue polling MMC card for OCR
only if it is still not ready
Quoted 8 lines
Hi, Andrew
There is already a patch to fix this issue.
Patchwork: https://patchwork.ozlabs.org/patch/451775/Regards,
Peng.
Yes, I noticed it just after I sent this series. ;-) Unfortunately, the patch, that you mention, has some drawback that I described
in a separate message (in response to the patch). Basically, it leaves the code
in some not quite correct state.
This series hopefully does not have this drawback and besides fixing the issue
has some more useful changes in a single complex.
Thanks.
Best regards,
Andrew
-----Original Message-----
From: U-Boot [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Andrew Gabbasov
Sent: Thursday, March 19, 2015 8:44 PM
To: u-boot at lists.denx.de
Subject: [U-Boot] [PATCH 4/6] 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.
--- drivers/mmc/mmc.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
drivers/mmc/mmc.c index d073d79..42af47c renamed from drivers/mmc/mmc.c +0 -0
100644
drivers/mmc/mmc.c +11 -9
@@ -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 ;
--
2.1.0
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot