Suggested-by: Pantelis Antoniou <[email protected]>
Signed-off-by: Ian Campbell <[email protected]>
---
 drivers/mmc/sunxi_mmc.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c
index 564d55c..141c436 100644
--- a/drivers/mmc/sunxi_mmc.c
+++ b/drivers/mmc/sunxi_mmc.c
@@ -313,14 +313,15 @@ static int mmc_trans_data_by_cpu(struct mmc *mmc, struct 
mmc_data *data)
                                              SUNXI_MMC_STATUS_FIFO_FULL;
        unsigned i;
        unsigned byte_cnt = data->blocksize * data->blocks;
-       unsigned timeout = 0xfffff;
+       unsigned timeout_msecs = 2000;
        unsigned *buff = (unsigned int *)(reading ? data->dest : data->src);
 
        for (i = 0; i < (byte_cnt >> 2); i++) {
-               while (--timeout && (readl(&mmchost->reg->status) & status_bit))
-                       ;
-               if (timeout <= 0)
-                       return -1;
+               while (readl(&mmchost->reg->status) & status_bit) {
+                       if (!timeout_msecs--)
+                               return -1;
+                       udelay(1000);
+               }
 
                if (reading)
                        buff[i] = readl(mmchost->database);
-- 
1.9.0

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to