From: Shaik Sajida Bhanu <quic_c_sbhanu@quicinc.com>
To: adrian.hunter@intel.com, ulf.hansson@linaro.org,
wsa+renesas@sang-engineering.com,
yoshihiro.shimoda.uh@renesas.com, linus.walleij@linaro.org,
digetx@gmail.com, briannorris@chromium.org,
quic_riteshh@quicinc.com
Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
quic_asutoshd@quicinc.com, quic_rampraka@quicinc.com,
quic_pragalla@quicinc.com, quic_sartgarg@quicinc.com,
quic_nitirawa@quicinc.com, quic_sayalil@quicinc.com,
Shaik Sajida Bhanu <quic_c_sbhanu@quicinc.com>,
Liangliang Lu <quic_luliang@quicinc.com>,
"Bao D . Nguyen" <quic_nguyenb@quicinc.com>
Subject: [PATCH V5 1/5] mmc: core: Capture eMMC and SD card errors
Date: Mon, 25 Apr 2022 21:30:39 +0530 [thread overview]
Message-ID: <1650902443-26357-2-git-send-email-quic_c_sbhanu@quicinc.com> (raw)
In-Reply-To: <1650902443-26357-1-git-send-email-quic_c_sbhanu@quicinc.com>
Add changes to capture eMMC and SD card errors.
This is useful for debug and testing.
Signed-off-by: Liangliang Lu <quic_luliang@quicinc.com>
Signed-off-by: Sayali Lokhande <quic_sayalil@quicinc.com>
Signed-off-by: Bao D. Nguyen <quic_nguyenb@quicinc.com>
Signed-off-by: Ram Prakash Gupta <quic_rampraka@quicinc.com>
Signed-off-by: Shaik Sajida Bhanu <quic_c_sbhanu@quicinc.com>
---
drivers/mmc/core/core.c | 6 ++++++
include/linux/mmc/host.h | 26 ++++++++++++++++++++++++++
2 files changed, 32 insertions(+)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 8cc2b74..6d086e9 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2247,6 +2247,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 c193c50..eb8bc5b 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
@@ -501,6 +520,7 @@ struct mmc_host {
/* Host Software Queue support */
bool hsq_enabled;
+ u32 err_stats[MMC_ERR_MAX];
unsigned long private[] ____cacheline_aligned;
};
@@ -635,6 +655,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);
int mmc_get_ext_csd(struct mmc_card *card, u8 **new_ext_csd);
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
next prev parent reply other threads:[~2022-04-25 16:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-25 16:00 [PATCH V5 0/5] mmc: add error statistics for eMMC and SD card Shaik Sajida Bhanu
2022-04-25 16:00 ` Shaik Sajida Bhanu [this message]
2022-04-25 16:00 ` [PATCH V5 2/5] mmc: sdhci: Capture eMMC and SD card errors Shaik Sajida Bhanu
2022-04-26 7:51 ` Adrian Hunter
2022-05-09 9:34 ` Sajida Bhanu (Temp)
2022-04-25 16:00 ` [PATCH V5 3/5] mmc: debugfs: Add debug fs entry for mmc driver Shaik Sajida Bhanu
2022-04-25 16:00 ` [PATCH V5 4/5] mmc: debugfs: Add debug fs error state " Shaik Sajida Bhanu
2022-04-26 7:54 ` Adrian Hunter
2022-04-26 7:58 ` Adrian Hunter
2022-05-09 9:44 ` Sajida Bhanu (Temp)
[not found] ` <5c2a9eae-3ab2-1fa4-c7df-ba7384e07b24@quicinc.com>
2022-05-09 10:03 ` Adrian Hunter
2022-05-09 10:32 ` Sajida Bhanu (Temp)
2022-04-25 16:00 ` [PATCH V5 5/5] mmc: cqhci: Capture eMMC and SD card errors Shaik Sajida Bhanu
2022-04-25 16:03 [PATCH V5 1/5] mmc: core: " Shaik Sajida Bhanu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1650902443-26357-2-git-send-email-quic_c_sbhanu@quicinc.com \
--to=quic_c_sbhanu@quicinc.com \
--cc=adrian.hunter@intel.com \
--cc=briannorris@chromium.org \
--cc=digetx@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=quic_asutoshd@quicinc.com \
--cc=quic_luliang@quicinc.com \
--cc=quic_nguyenb@quicinc.com \
--cc=quic_nitirawa@quicinc.com \
--cc=quic_pragalla@quicinc.com \
--cc=quic_rampraka@quicinc.com \
--cc=quic_riteshh@quicinc.com \
--cc=quic_sartgarg@quicinc.com \
--cc=quic_sayalil@quicinc.com \
--cc=ulf.hansson@linaro.org \
--cc=wsa+renesas@sang-engineering.com \
--cc=yoshihiro.shimoda.uh@renesas.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®