mmc: fsl_esdhc: increase data transaction timeout to 500ms
authorYangbo Lu <yangbo.lu@nxp.com>
Wed, 30 Dec 2015 06:19:30 +0000 (14:19 +0800)
committerYork Sun <york.sun@nxp.com>
Wed, 27 Jan 2016 16:13:12 +0000 (08:13 -0800)
The MMC spec says "It is strongly recommended for hosts to implement
more than 500ms timeout value even if the card indicates the 250ms
maximum busy length."  Even the previous value of 300ms is known to
be insufficient for some cards. So, increase the timeout to 500ms.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
drivers/mmc/fsl_esdhc.c

index 1ccc576c347c6f0f669ab35e247641df252ba1eb..6827ffb431da36a9681160878055c8511b4c9c5b 100644 (file)
@@ -252,8 +252,15 @@ static int esdhc_setup_data(struct mmc *mmc, struct mmc_data *data)
         * Rounding up to next power of 2
         * => timeout + 13 = log2(mmc->clock/4) + 1
         * => timeout + 13 = fls(mmc->clock/4)
+        *
+        * However, the MMC spec "It is strongly recommended for hosts to
+        * implement more than 500ms timeout value even if the card
+        * indicates the 250ms maximum busy length."  Even the previous
+        * value of 300ms is known to be insufficient for some cards.
+        * So, we use
+        * => timeout + 13 = fls(mmc->clock/2)
         */
-       timeout = fls(mmc->clock/4);
+       timeout = fls(mmc->clock/2);
        timeout -= 13;
 
        if (timeout > 14)