From 26cc40d8c4aaa8bd69055fb00d0737332661a879 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Tue, 6 Nov 2018 23:42:11 +0100 Subject: 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. Signed-off-by: Marek Vasut Cc: Heiko Stuebner Cc: Philipp Tomsich --- drivers/mmc/dw_mmc.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'drivers/mmc/dw_mmc.c') diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c index 3c702b3ed8..7544b84ab6 100644 --- a/drivers/mmc/dw_mmc.c +++ b/drivers/mmc/dw_mmc.c @@ -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; } -- cgit v1.2.3