Skip to contentSkip to conversation

mmc: dw_mmc: Add RCRC handling

PATCH In review Marek Vasut 2 participants 2 messages Nov 6, 2018 – Nov 10, 2018 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: dw_mmc: Add RCRC handling

This patch adds check for command response CRC failure. The driver is currently ignoring CRC check failure on command resposes which have CRC atteched to it, which can be potentially dangerous. Even more grueling problem happens when the command response is followed by data transfer though, as in that case, the dwmci_data_transfer() function will spin until it reaches the 240s timeout.

Cc Heiko Stuebner <[email protected]>
Cc Philipp Tomsich <[email protected]>
---
 drivers/mmc/dw_mmc.c | 4 ++++
 include/dwmmc.h      | 1 +
 2 files changed, 5 insertions(+)
drivers/mmc/dw_mmc.c +4 -0
index 3c702b3ed8..7544b84ab6 100644
@@ -317,6 +317,10 @@ static int dwmci_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
 	} else if (mask & DWMCI_INTMSK_RE) {
 		debug("%s: Response Error.\n", __func__);
 		return -EIO;
+	} else if ((cmd->resp_type & MMC_RSP_CRC) &&
+		   (mask & DWMCI_INTMSK_RCRC)) {
+		debug("%s: Response CRC Error.\n", __func__);
+		return -EIO;
 	}
 
 
include/dwmmc.h +1 -0
index 0f9d51b557..4ceda5e43c 100644
@@ -56,6 +56,7 @@
 #define DWMCI_INTMSK_DTO	(1 << 3)
 #define DWMCI_INTMSK_TXDR	(1 << 4)
 #define DWMCI_INTMSK_RXDR	(1 << 5)
+#define DWMCI_INTMSK_RCRC	(1 << 6)
 #define DWMCI_INTMSK_DCRC	(1 << 7)
 #define DWMCI_INTMSK_RTO	(1 << 8)
 #define DWMCI_INTMSK_DRTO	(1 << 9)
Signature · 1 line
2.18.0
#1 lore raw
Quoted 10 lines · Marek Vasut

This patch adds check for command response CRC failure. The driver is currently ignoring CRC check failure on command resposes which have CRC atteched to it, which can be potentially dangerous. Even more grueling problem happens when the command response is followed by data transfer though, as in that case, the dwmci_data_transfer() function will spin until it reaches the 240s timeout.

Cc Heiko Stuebner <[email protected]>
Cc Philipp Tomsich <[email protected]>

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181110/8000c7ac/attachment.sig>