mmc: block: send CMD13 when a response error detected in CQ mode
When CQE detects a RED error (response error) from the device,
it triggers a RED interrupt. The SW driver as part of the RED
IRQ handling, puts the CQ in either halt or disabled state
before scheduling the error work. Hence, send the status CMD13
in legacy mode to decode the RED error for further debugging.
Change-Id: I90d17cbc73783b88bbafbdf7048c8a26eb8434bc
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
Signed-off-by: Sayali Lokhande <sayalil@codeaurora.org>
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 103feee..6d79cde 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -3480,7 +3480,8 @@
struct mmc_request *mrq = host->err_mrq;
struct mmc_cmdq_context_info *ctx_info = &host->cmdq_ctx;
struct request_queue *q;
- int err;
+ int err, ret;
+ u32 status = 0;
mmc_host_clk_hold(host);
host->cmdq_ops->dumpstate(host);
@@ -3499,8 +3500,14 @@
/* RED error - Fatal: requires reset */
if (mrq->cmdq_req->resp_err) {
err = mrq->cmdq_req->resp_err;
- pr_crit("%s: Response error detected: Device in bad state\n",
- mmc_hostname(host));
+ if (mmc_host_halt(host) || mmc_host_cq_disable(host)) {
+ ret = get_card_status(host->card, &status, 0);
+ if (ret)
+ pr_err("%s: CMD13 failed with err %d\n",
+ mmc_hostname(host), ret);
+ }
+ pr_err("%s: Response error detected with device status 0x%08x\n",
+ mmc_hostname(host), status);
goto reset;
}