[PATCH V4 5/7] mmc: core: Set error state for mmc driver

From: Shaik Sajida Bhanu
Date: Wed Mar 02 2022 - 08:04:31 EST


If any errors observed in eMMC and SD card set error state.

User can read error state value and confirm any errors observed or not,
error state set means error obeserved and vice versa.

Signed-off-by: Liangliang Lu <quic_luliang@xxxxxxxxxxx>
Signed-off-by: Sayali Lokhande <quic_sayalil@xxxxxxxxxxx>
Signed-off-by: Bao D. Nguyen <quic_nguyenb@xxxxxxxxxxx>
Signed-off-by: Ram Prakash Gupta <quic_rampraka@xxxxxxxxxxx>
Signed-off-by: Shaik Sajida Bhanu <quic_c_sbhanu@xxxxxxxxxxx>
---
include/linux/mmc/host.h | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 3b7f1e5..28baa07 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -518,6 +518,7 @@ struct mmc_host {
/* Host Software Queue support */
bool hsq_enabled;
u32 err_stats[MMC_ERR_MAX];
+ bool err_state;

unsigned long private[] ____cacheline_aligned;
};
@@ -653,6 +654,11 @@ 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_enable(struct mmc_host *host)
+{
+ host->err_state = true;
+}
+
static inline void mmc_debugfs_err_stats_inc(struct mmc_host *host,
enum mmc_err_stat stat) {
host->err_stats[stat] += 1;
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation