File tree Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -943,9 +943,11 @@ int mmc_execute_tuning(struct mmc_card *card)
943943 }
944944
945945 /* Only print error when we don't check for card removal */
946- if (!host -> detect_change )
946+ if (!host -> detect_change ) {
947947 pr_err ("%s: tuning execution failed: %d\n" ,
948948 mmc_hostname (host ), err );
949+ mmc_debugfs_err_stats_inc (host , MMC_ERR_TUNING );
950+ }
949951
950952 return err ;
951953}
@@ -2244,6 +2246,12 @@ void mmc_rescan(struct work_struct *work)
22442246 if (freqs [i ] <= host -> f_min )
22452247 break ;
22462248 }
2249+
2250+ /*
2251+ * Ignore the command timeout errors observed during
2252+ * the card init as those are excepted.
2253+ */
2254+ host -> err_stats [MMC_ERR_CMD_TIMEOUT ] = 0 ;
22472255 mmc_release_host (host );
22482256
22492257 out :
Original file line number Diff line number Diff line change @@ -93,6 +93,25 @@ struct mmc_clk_phase_map {
9393
9494struct mmc_host ;
9595
96+ enum mmc_err_stat {
97+ MMC_ERR_CMD_TIMEOUT ,
98+ MMC_ERR_CMD_CRC ,
99+ MMC_ERR_DAT_TIMEOUT ,
100+ MMC_ERR_DAT_CRC ,
101+ MMC_ERR_AUTO_CMD ,
102+ MMC_ERR_ADMA ,
103+ MMC_ERR_TUNING ,
104+ MMC_ERR_CMDQ_RED ,
105+ MMC_ERR_CMDQ_GCE ,
106+ MMC_ERR_CMDQ_ICCE ,
107+ MMC_ERR_REQ_TIMEOUT ,
108+ MMC_ERR_CMDQ_REQ_TIMEOUT ,
109+ MMC_ERR_ICE_CFG ,
110+ MMC_ERR_CTRL_TIMEOUT ,
111+ MMC_ERR_UNEXPECTED_IRQ ,
112+ MMC_ERR_MAX ,
113+ };
114+
96115struct mmc_host_ops {
97116 /*
98117 * It is optional for the host to implement pre_req and post_req in
@@ -501,6 +520,7 @@ struct mmc_host {
501520 /* Host Software Queue support */
502521 bool hsq_enabled ;
503522
523+ u32 err_stats [MMC_ERR_MAX ];
504524 unsigned long private [] ____cacheline_aligned ;
505525};
506526
@@ -635,6 +655,12 @@ static inline enum dma_data_direction mmc_get_dma_dir(struct mmc_data *data)
635655 return data -> flags & MMC_DATA_WRITE ? DMA_TO_DEVICE : DMA_FROM_DEVICE ;
636656}
637657
658+ static inline void mmc_debugfs_err_stats_inc (struct mmc_host * host ,
659+ enum mmc_err_stat stat )
660+ {
661+ host -> err_stats [stat ] += 1 ;
662+ }
663+
638664int mmc_send_tuning (struct mmc_host * host , u32 opcode , int * cmd_error );
639665int mmc_send_abort_tuning (struct mmc_host * host , u32 opcode );
640666int mmc_get_ext_csd (struct mmc_card * card , u8 * * new_ext_csd );
You can’t perform that action at this time.
0 commit comments