FROMGIT: mmc: debugfs: Add debug fs error state entry for mmc driver
Add debug fs entry error state to query eMMC and SD card errors statistics. If any errors occurred in eMMC and SD card driver level then err_state value will be set to 1. (cherry picked from commit 6ecf831d2cea999c2cc881b39b147cf8ee9e43ae https://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc.git devel) Bug: 233007144 Link: https://lore.kernel.org/lkml/1652857340-6040-5-git-send-email-quic_c_sbhanu@quicinc.com/ 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: Shaik Sajida Bhanu <quic_c_sbhanu@quicinc.com> Change-Id: Ie4cf876dc02fb719d91a7d37c8c5ec3aa2df54ab
This commit is contained in:
committed by
Carlos Llamas
parent
a70d301048
commit
232df716fb
@@ -223,6 +223,24 @@ static int mmc_clock_opt_set(void *data, u64 val)
|
||||
DEFINE_DEBUGFS_ATTRIBUTE(mmc_clock_fops, mmc_clock_opt_get, mmc_clock_opt_set,
|
||||
"%llu\n");
|
||||
|
||||
static int mmc_err_state_get(void *data, u64 *val)
|
||||
{
|
||||
struct mmc_host *host = data;
|
||||
int i;
|
||||
|
||||
*val = 0;
|
||||
for (i = 0; i < ARRAY_SIZE(host->err_stats); i++) {
|
||||
if (host->err_stats[i]) {
|
||||
*val = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_DEBUGFS_ATTRIBUTE(mmc_err_state, mmc_err_state_get, NULL, "%llu\n");
|
||||
|
||||
static int mmc_err_stats_show(struct seq_file *file, void *data)
|
||||
{
|
||||
struct mmc_host *host = (struct mmc_host *)file->private;
|
||||
@@ -289,6 +307,8 @@ void mmc_add_host_debugfs(struct mmc_host *host)
|
||||
debugfs_create_file_unsafe("clock", S_IRUSR | S_IWUSR, root, host,
|
||||
&mmc_clock_fops);
|
||||
|
||||
debugfs_create_file("err_state", 0600, root, host,
|
||||
&mmc_err_state);
|
||||
debugfs_create_file("err_stats", 0600, root, host,
|
||||
&mmc_err_stats_fops);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user