mmc: core: Retry if data commands fail with error
Mayuresh Kulkarni [Tue, 20 Dec 2011 11:16:48 +0000 (16:16 +0530)]
If the data commands fail due to some error, retry the transfer.
Add 3 retries for data commands.

for bug 914934

Change-Id: I53245ddd159abdbade09f841d9490d2f106e7c88
Signed-off-by: Mayuresh Kulkarni <mkulkarni@nvidia.com>
Signed-off-by: Pavan Kunapuli <pkunapuli@nvidia.com>
Reviewed-on: http://git-master/r/71181
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Varun Wadekar <vwadekar@nvidia.com>

drivers/mmc/card/block.c
drivers/mmc/core/core.c

index 63bd30b..5367900 100644 (file)
@@ -59,6 +59,8 @@ MODULE_ALIAS("mmc:block");
 #define INAND_CMD38_ARG_SECTRIM1 0x81
 #define INAND_CMD38_ARG_SECTRIM2 0x88
 
+#define MMC_CMD_RETRIES        3
+
 static DEFINE_MUTEX(block_mutex);
 
 /*
@@ -943,6 +945,7 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,
        if (!mmc_card_blockaddr(card))
                brq->cmd.arg <<= 9;
        brq->cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC;
+       brq->cmd.retries = MMC_CMD_RETRIES;
        brq->data.blksz = 512;
        brq->stop.opcode = MMC_STOP_TRANSMISSION;
        brq->stop.arg = 0;
index 279b876..344d241 100644 (file)
@@ -108,6 +108,11 @@ void mmc_request_done(struct mmc_host *host, struct mmc_request *mrq)
 
                cmd->retries--;
                cmd->error = 0;
+               if (mrq->data) {
+                       mrq->data->error = 0;
+                       if (mrq->stop)
+                               mrq->stop->error = 0;
+               }
                host->ops->request(host, mrq);
        } else {
                led_trigger_event(host->led, LED_OFF);