Skip to content

Commit 8155d1f

Browse files
ahunter6Ulf Hansson
authored andcommitted
mmc: block: Retry commands in CQE error recovery
It is important that MMC_CMDQ_TASK_MGMT command to discard the queue is successful because otherwise a subsequent reset might fail to flush the cache first. Retry it and the previous STOP command. Fixes: 72a5af5 ("mmc: core: Add support for handling CQE requests") Cc: stable@vger.kernel.org Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Reviewed-by: Avri Altman <avri.altman@wdc.com> Link: https://lore.kernel.org/r/20231103084720.6886-5-adrian.hunter@intel.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent c616696 commit 8155d1f

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

drivers/mmc/core/core.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ int mmc_cqe_recovery(struct mmc_host *host)
551551
cmd.flags = MMC_RSP_R1B | MMC_CMD_AC;
552552
cmd.flags &= ~MMC_RSP_CRC; /* Ignore CRC */
553553
cmd.busy_timeout = MMC_CQE_RECOVERY_TIMEOUT;
554-
mmc_wait_for_cmd(host, &cmd, 0);
554+
mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES);
555555

556556
mmc_poll_for_busy(host->card, MMC_CQE_RECOVERY_TIMEOUT, true, MMC_BUSY_IO);
557557

@@ -561,10 +561,13 @@ int mmc_cqe_recovery(struct mmc_host *host)
561561
cmd.flags = MMC_RSP_R1B | MMC_CMD_AC;
562562
cmd.flags &= ~MMC_RSP_CRC; /* Ignore CRC */
563563
cmd.busy_timeout = MMC_CQE_RECOVERY_TIMEOUT;
564-
err = mmc_wait_for_cmd(host, &cmd, 0);
564+
err = mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES);
565565

566566
host->cqe_ops->cqe_recovery_finish(host);
567567

568+
if (err)
569+
err = mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES);
570+
568571
mmc_retune_release(host);
569572

570573
return err;

0 commit comments

Comments
 (0)