[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1652857340-6040-2-git-send-email-quic_c_sbhanu@quicinc.com>
Date: Wed, 18 May 2022 12:32:16 +0530
From: Shaik Sajida Bhanu <quic_c_sbhanu@...cinc.com>
To: adrian.hunter@...el.com, ulf.hansson@...aro.org,
wsa+renesas@...g-engineering.com, shawn.lin@...k-chips.com,
yoshihiro.shimoda.uh@...esas.com, digetx@...il.com,
quic_asutoshd@...cinc.com
Cc: linux-arm-msm@...r.kernel.org, linux-mmc@...r.kernel.org,
linux-kernel@...r.kernel.org, quic_rampraka@...cinc.com,
quic_pragalla@...cinc.com, quic_sartgarg@...cinc.com,
quic_nitirawa@...cinc.com, quic_sayalil@...cinc.com,
Shaik Sajida Bhanu <quic_c_sbhanu@...cinc.com>,
Liangliang Lu <quic_luliang@...cinc.com>,
"Bao D . Nguyen" <quic_nguyenb@...cinc.com>
Subject: [PATCH V6 1/5] mmc: core: Capture eMMC and SD card errors
Add changes to capture eMMC and SD card errors.
This is useful for debug and testing.
Signed-off-by: Liangliang Lu <quic_luliang@...cinc.com>
Signed-off-by: Sayali Lokhande <quic_sayalil@...cinc.com>
Signed-off-by: Bao D. Nguyen <quic_nguyenb@...cinc.com>
Signed-off-by: Ram Prakash Gupta <quic_rampraka@...cinc.com>
Signed-off-by: Shaik Sajida Bhanu <quic_c_sbhanu@...cinc.com>
---
drivers/mmc/core/core.c | 10 +++++++++-
include/linux/mmc/host.h | 26 ++++++++++++++++++++++++++
2 files changed, 35 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 368f104..5db5adf 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -943,9 +943,11 @@ int mmc_execute_tuning(struct mmc_card *card)
}
/* Only print error when we don't check for card removal */
- if (!host->detect_change)
+ if (!host->detect_change) {
pr_err("%s: tuning execution failed: %d\n",
mmc_hostname(host), err);
+ mmc_debugfs_err_stats_inc(host, MMC_ERR_TUNING);
+ }
return err;
}
@@ -2242,6 +2244,12 @@ void mmc_rescan(struct work_struct *work)
if (freqs[i] <= host->f_min)
break;
}
+
+ /*
+ * Ignore the command timeout errors observed during
+ * the card init as those are excepted.
+ */
+ host->err_stats[MMC_ERR_CMD_TIMEOUT] = 0;
mmc_release_host(host);
out:
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 0c0c9a0..0d7c0f7 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -93,6 +93,25 @@ struct mmc_clk_phase_map {
struct mmc_host;
+enum mmc_err_stat {
+ MMC_ERR_CMD_TIMEOUT,
+ MMC_ERR_CMD_CRC,
+ MMC_ERR_DAT_TIMEOUT,
+ MMC_ERR_DAT_CRC,
+ MMC_ERR_AUTO_CMD,
+ MMC_ERR_ADMA,
+ MMC_ERR_TUNING,
+ MMC_ERR_CMDQ_RED,
+ MMC_ERR_CMDQ_GCE,
+ MMC_ERR_CMDQ_ICCE,
+ MMC_ERR_REQ_TIMEOUT,
+ MMC_ERR_CMDQ_REQ_TIMEOUT,
+ MMC_ERR_ICE_CFG,
+ MMC_ERR_CTRL_TIMEOUT,
+ MMC_ERR_UNEXPECTED_IRQ,
+ MMC_ERR_MAX,
+};
+
struct mmc_host_ops {
/*
* It is optional for the host to implement pre_req and post_req in
@@ -498,6 +517,7 @@ struct mmc_host {
/* Host Software Queue support */
bool hsq_enabled;
+ u32 err_stats[MMC_ERR_MAX];
unsigned long private[] ____cacheline_aligned;
};
@@ -632,6 +652,12 @@ static inline enum dma_data_direction mmc_get_dma_dir(struct mmc_data *data)
return data->flags & MMC_DATA_WRITE ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
}
+static inline void mmc_debugfs_err_stats_inc(struct mmc_host *host,
+ enum mmc_err_stat stat)
+{
+ host->err_stats[stat] += 1;
+}
+
int mmc_send_tuning(struct mmc_host *host, u32 opcode, int *cmd_error);
int mmc_send_abort_tuning(struct mmc_host *host, u32 opcode);
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
Powered by blists - more mailing lists