mmc: sdhci: fix issue with auto cmd err detection
As per specification, auto cmd error status register is valid only
when auto cmd error bit is set in Error interrupt status register.
CRs-fixed: 515513
Change-Id: Id1013e1705d8efdba0171dcad14f783607d38ef3
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 0cb0491..758a79e 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -110,7 +110,7 @@
sdhci_readl(host, SDHCI_INT_ENABLE),
sdhci_readl(host, SDHCI_SIGNAL_ENABLE));
pr_info(DRIVER_NAME ": AC12 err: 0x%08x | Slot int: 0x%08x\n",
- sdhci_readw(host, SDHCI_AUTO_CMD_ERR),
+ host->auto_cmd_err_sts,
sdhci_readw(host, SDHCI_SLOT_INT_STATUS));
pr_info(DRIVER_NAME ": Caps: 0x%08x | Caps_1: 0x%08x\n",
sdhci_readl(host, SDHCI_CAPABILITIES),
@@ -2375,6 +2375,7 @@
host->mrq = NULL;
host->cmd = NULL;
host->data = NULL;
+ host->auto_cmd_err_sts = 0;
#ifndef SDHCI_USE_LEDS_CLASS
sdhci_deactivate_led(host);
@@ -2465,7 +2466,9 @@
host->cmd->error = -EILSEQ;
if (intmask & SDHCI_INT_AUTO_CMD_ERR) {
- auto_cmd_status = sdhci_readw(host, SDHCI_AUTO_CMD_ERR);
+ auto_cmd_status = host->auto_cmd_err_sts;
+ pr_err("%s: %s: AUTO CMD err sts 0x%08x\n",
+ mmc_hostname(host->mmc), __func__, auto_cmd_status);
if (auto_cmd_status & (SDHCI_AUTO_CMD12_NOT_EXEC |
SDHCI_AUTO_CMD_INDEX_ERR |
SDHCI_AUTO_CMD_ENDBIT_ERR))
@@ -2728,6 +2731,9 @@
}
if (intmask & SDHCI_INT_CMD_MASK) {
+ if (intmask & SDHCI_INT_AUTO_CMD_ERR)
+ host->auto_cmd_err_sts = sdhci_readw(host,
+ SDHCI_AUTO_CMD_ERR);
sdhci_writel(host, intmask & SDHCI_INT_CMD_MASK,
SDHCI_INT_STATUS);
if ((host->quirks2 & SDHCI_QUIRK2_SLOW_INT_CLR) &&