Commit ddc71387 authored by Chaotian Jing's avatar Chaotian Jing Committed by Ulf Hansson

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: default avatarChaotian Jing <chaotian.jing@mediatek.com>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 86beac37
...@@ -801,6 +801,12 @@ static bool msdc_cmd_done(struct msdc_host *host, int events, ...@@ -801,6 +801,12 @@ static bool msdc_cmd_done(struct msdc_host *host, int events,
} }
if (!sbc_error && !(events & MSDC_INT_CMDRDY)) { if (!sbc_error && !(events & MSDC_INT_CMDRDY)) {
if (cmd->opcode != MMC_SEND_TUNING_BLOCK &&
cmd->opcode != MMC_SEND_TUNING_BLOCK_HS200)
/*
* should not clear fifo/interrupt as the tune data
* may have alreay come.
*/
msdc_reset_hw(host); msdc_reset_hw(host);
if (events & MSDC_INT_RSPCRCERR) { if (events & MSDC_INT_RSPCRCERR) {
cmd->error = -EILSEQ; cmd->error = -EILSEQ;
...@@ -885,7 +891,11 @@ static void msdc_start_command(struct msdc_host *host, ...@@ -885,7 +891,11 @@ static void msdc_start_command(struct msdc_host *host,
static void msdc_cmd_next(struct msdc_host *host, static void msdc_cmd_next(struct msdc_host *host,
struct mmc_request *mrq, struct mmc_command *cmd) struct mmc_request *mrq, struct mmc_command *cmd)
{ {
if (cmd->error || (mrq->sbc && mrq->sbc->error)) if ((cmd->error &&
!(cmd->error == -EILSEQ &&
(cmd->opcode == MMC_SEND_TUNING_BLOCK ||
cmd->opcode == MMC_SEND_TUNING_BLOCK_HS200))) ||
(mrq->sbc && mrq->sbc->error))
msdc_request_done(host, mrq); msdc_request_done(host, mrq);
else if (cmd == mrq->sbc) else if (cmd == mrq->sbc)
msdc_start_command(host, mrq, mrq->cmd); msdc_start_command(host, mrq, mrq->cmd);
......
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