[DO NOT MERGE] mmc: host: bcm2835: Capture MMC errors
The commit 91f059c95c6a ("mmc: core: Capture eMMC and SD card errors") introduced MMC error stats, which are accessible via debugfs. I thought it would be helpful to implement this for the BCM2835 SDHOST driver. Unfortunately i'm not sure which error should increment what counter. So the commit is currently intended for review and not for merging.
Here is the error mapping: [MMC_ERR_CMD_TIMEOUT] = "Command Timeout Occurred", [MMC_ERR_CMD_CRC] = "Command CRC Errors Occurred", [MMC_ERR_DAT_TIMEOUT] = "Data Timeout Occurred", [MMC_ERR_DAT_CRC] = "Data CRC Errors Occurred", [MMC_ERR_AUTO_CMD] = "Auto-Cmd Error Occurred", [MMC_ERR_ADMA] = "ADMA Error Occurred", [MMC_ERR_TUNING] = "Tuning Error Occurred", [MMC_ERR_CMDQ_RED] = "CMDQ RED Errors", [MMC_ERR_CMDQ_GCE] = "CMDQ GCE Errors", [MMC_ERR_CMDQ_ICCE] = "CMDQ ICCE Errors", [MMC_ERR_REQ_TIMEOUT] = "Request Timedout", [MMC_ERR_CMDQ_REQ_TIMEOUT] = "CMDQ Request Timedout", [MMC_ERR_ICE_CFG] = "ICE Config Errors", [MMC_ERR_CTRL_TIMEOUT] = "Controller Timedout errors", [MMC_ERR_UNEXPECTED_IRQ] = "Unexpected IRQ errors",
This seems reasonable to me. From my reading of the interrupt status bit descriptions, the stats assignments more or less correspond to the intended MMC error bucket.
However the IRQ routine could call bcm2835_check_data_error() more than once for a single transfer potentially incrementing an error count twice, but a number greater than zero is going to be bad news anyway.