Skip to content

Commit 9374ae9

Browse files
Mengqi ZhangUlf Hansson
authored andcommitted
mmc: mtk-sd: receive cmd8 data when hs400 tuning fail
When we use cmd8 as the tuning command in hs400 mode, the command response sent back by some eMMC devices cannot be correctly sampled by MTK eMMC controller at some weak sample timing. In this case, command timeout error may occur. So we must receive the following data to make sure the next cmd8 send correctly. Signed-off-by: Mengqi Zhang <mengqi.zhang@mediatek.com> Fixes: c4ac38c ("mmc: mtk-sd: Add HS400 online tuning support") Cc: stable@vger.stable.com Link: https://lore.kernel.org/r/20240716013704.10578-1-mengqi.zhang@mediatek.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 8400291 commit 9374ae9

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

drivers/mmc/host/mtk-sd.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,7 +1230,7 @@ static bool msdc_cmd_done(struct msdc_host *host, int events,
12301230
}
12311231

12321232
if (!sbc_error && !(events & MSDC_INT_CMDRDY)) {
1233-
if (events & MSDC_INT_CMDTMO ||
1233+
if ((events & MSDC_INT_CMDTMO && !host->hs400_tuning) ||
12341234
(!mmc_op_tuning(cmd->opcode) && !host->hs400_tuning))
12351235
/*
12361236
* should not clear fifo/interrupt as the tune data
@@ -1323,9 +1323,9 @@ static void msdc_start_command(struct msdc_host *host,
13231323
static void msdc_cmd_next(struct msdc_host *host,
13241324
struct mmc_request *mrq, struct mmc_command *cmd)
13251325
{
1326-
if ((cmd->error &&
1327-
!(cmd->error == -EILSEQ &&
1328-
(mmc_op_tuning(cmd->opcode) || host->hs400_tuning))) ||
1326+
if ((cmd->error && !host->hs400_tuning &&
1327+
!(cmd->error == -EILSEQ &&
1328+
mmc_op_tuning(cmd->opcode))) ||
13291329
(mrq->sbc && mrq->sbc->error))
13301330
msdc_request_done(host, mrq);
13311331
else if (cmd == mrq->sbc)

0 commit comments

Comments
 (0)