Commit b8360a49 authored by Adrian Hunter's avatar Adrian Hunter Committed by Ulf Hansson

mmc: block: Retry errored data requests when re-tuning is needed

Retry errored data requests when re-tuning is needed and
add a flag to struct mmc_blk_request so that the retry
is only done once.
Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 6f398ad2
...@@ -1207,6 +1207,7 @@ static int mmc_blk_err_check(struct mmc_card *card, ...@@ -1207,6 +1207,7 @@ static int mmc_blk_err_check(struct mmc_card *card,
mmc_active); mmc_active);
struct mmc_blk_request *brq = &mq_mrq->brq; struct mmc_blk_request *brq = &mq_mrq->brq;
struct request *req = mq_mrq->req; struct request *req = mq_mrq->req;
int need_retune = card->host->need_retune;
int ecc_err = 0, gen_err = 0; int ecc_err = 0, gen_err = 0;
/* /*
...@@ -1274,6 +1275,12 @@ static int mmc_blk_err_check(struct mmc_card *card, ...@@ -1274,6 +1275,12 @@ static int mmc_blk_err_check(struct mmc_card *card,
} }
if (brq->data.error) { if (brq->data.error) {
if (need_retune && !brq->retune_retry_done) {
pr_info("%s: retrying because a re-tune was needed\n",
req->rq_disk->disk_name);
brq->retune_retry_done = 1;
return MMC_BLK_RETRY;
}
pr_err("%s: error %d transferring data, sector %u, nr %u, cmd response %#x, card status %#x\n", pr_err("%s: error %d transferring data, sector %u, nr %u, cmd response %#x, card status %#x\n",
req->rq_disk->disk_name, brq->data.error, req->rq_disk->disk_name, brq->data.error,
(unsigned)blk_rq_pos(req), (unsigned)blk_rq_pos(req),
...@@ -1833,7 +1840,7 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc) ...@@ -1833,7 +1840,7 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc)
struct mmc_blk_data *md = mq->data; struct mmc_blk_data *md = mq->data;
struct mmc_card *card = md->queue.card; struct mmc_card *card = md->queue.card;
struct mmc_blk_request *brq = &mq->mqrq_cur->brq; struct mmc_blk_request *brq = &mq->mqrq_cur->brq;
int ret = 1, disable_multi = 0, retry = 0, type; int ret = 1, disable_multi = 0, retry = 0, type, retune_retry_done = 0;
enum mmc_blk_status status; enum mmc_blk_status status;
struct mmc_queue_req *mq_rq; struct mmc_queue_req *mq_rq;
struct request *req = rqc; struct request *req = rqc;
...@@ -1917,6 +1924,7 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc) ...@@ -1917,6 +1924,7 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc)
break; break;
goto cmd_abort; goto cmd_abort;
case MMC_BLK_RETRY: case MMC_BLK_RETRY:
retune_retry_done = brq->retune_retry_done;
if (retry++ < 5) if (retry++ < 5)
break; break;
/* Fall through */ /* Fall through */
...@@ -1979,6 +1987,7 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc) ...@@ -1979,6 +1987,7 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc)
mmc_start_req(card->host, mmc_start_req(card->host,
&mq_rq->mmc_active, NULL); &mq_rq->mmc_active, NULL);
} }
mq_rq->brq.retune_retry_done = retune_retry_done;
} }
} while (ret); } while (ret);
......
...@@ -12,6 +12,7 @@ struct mmc_blk_request { ...@@ -12,6 +12,7 @@ struct mmc_blk_request {
struct mmc_command cmd; struct mmc_command cmd;
struct mmc_command stop; struct mmc_command stop;
struct mmc_data data; struct mmc_data data;
int retune_retry_done;
}; };
enum mmc_packed_type { enum mmc_packed_type {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment