summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMayuresh Kulkarni <mkulkarni@nvidia.com>2011-12-20 16:46:48 +0530
committerMarcel Ziswiler <marcel.ziswiler@toradex.com>2015-02-03 16:52:18 +0100
commit274dcdb2b06714f0b637ed074114b580e65b3633 (patch)
treeb8af9e4998eb8e33619d92bb95d5d0e2b2202944
parentb982e9d1023f86805dd9bfae7d35e02f36bd2a06 (diff)
mmc: core: Retry if data commands fail with error
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> (cherry picked from commit fd804ee58d3f9ce10cb2fe16aa76ae0407912d32)
-rw-r--r--drivers/mmc/card/block.c3
-rwxr-xr-xdrivers/mmc/core/core.c5
2 files changed, 8 insertions, 0 deletions
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index dcdc948fbddb..b24b9d2c85b3 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -65,6 +65,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);
/*
@@ -909,6 +911,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;
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index cd4f5ffc76ca..5cbeb1bbf267 100755
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -112,6 +112,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);