aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChaotian Jing <chaotian.jing@mediatek.com>2016-06-29 22:01:00 -0400
committerUlf Hansson <ulf.hansson@linaro.org>2016-07-25 04:34:32 -0400
commitddc713878f445b68626d10aa190139908426eb91 (patch)
treed4423bed6da42e85441eaafeda806d94c7632e1e
parent86beac370481882550e1f3904a5af44a5f9ea395 (diff)
mmc: mediatek: fix CMD21/CMD19 timeout issue
we did not deal with the read data of CMD21/CMD19 if there is response CRC error of CMD21/CMD19, in this case, eMMC/SD may still in send-data state. therefore, all of next commands cannot get response as device is not in transfer state. for resolving this issue, still need deal with the data receive to make device back to transfer state. Signed-off-by: Chaotian Jing <chaotian.jing@mediatek.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-rw-r--r--drivers/mmc/host/mtk-sd.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
index 4b175a634e36..91277b99f035 100644
--- a/drivers/mmc/host/mtk-sd.c
+++ b/drivers/mmc/host/mtk-sd.c
@@ -801,7 +801,13 @@ static bool msdc_cmd_done(struct msdc_host *host, int events,
801 } 801 }
802 802
803 if (!sbc_error && !(events & MSDC_INT_CMDRDY)) { 803 if (!sbc_error && !(events & MSDC_INT_CMDRDY)) {
804 msdc_reset_hw(host); 804 if (cmd->opcode != MMC_SEND_TUNING_BLOCK &&
805 cmd->opcode != MMC_SEND_TUNING_BLOCK_HS200)
806 /*
807 * should not clear fifo/interrupt as the tune data
808 * may have alreay come.
809 */
810 msdc_reset_hw(host);
805 if (events & MSDC_INT_RSPCRCERR) { 811 if (events & MSDC_INT_RSPCRCERR) {
806 cmd->error = -EILSEQ; 812 cmd->error = -EILSEQ;
807 host->error |= REQ_CMD_EIO; 813 host->error |= REQ_CMD_EIO;
@@ -885,7 +891,11 @@ static void msdc_start_command(struct msdc_host *host,
885static void msdc_cmd_next(struct msdc_host *host, 891static void msdc_cmd_next(struct msdc_host *host,
886 struct mmc_request *mrq, struct mmc_command *cmd) 892 struct mmc_request *mrq, struct mmc_command *cmd)
887{ 893{
888 if (cmd->error || (mrq->sbc && mrq->sbc->error)) 894 if ((cmd->error &&
895 !(cmd->error == -EILSEQ &&
896 (cmd->opcode == MMC_SEND_TUNING_BLOCK ||
897 cmd->opcode == MMC_SEND_TUNING_BLOCK_HS200))) ||
898 (mrq->sbc && mrq->sbc->error))
889 msdc_request_done(host, mrq); 899 msdc_request_done(host, mrq);
890 else if (cmd == mrq->sbc) 900 else if (cmd == mrq->sbc)
891 msdc_start_command(host, mrq, mrq->cmd); 901 msdc_start_command(host, mrq, mrq->cmd);