[PATCH] mmc: mmc_spi: Print verbose debug output when crc16 check fails

Bin Meng bmeng.cn at gmail.com
Wed Jan 6 13:47:17 CET 2021


Add some verbose debug output when crc16 check fails.

Signed-off-by: Bin Meng <bmeng.cn at gmail.com>
---

 drivers/mmc/mmc_spi.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/mmc_spi.c b/drivers/mmc/mmc_spi.c
index 50fcd32674..87d7edffd5 100644
--- a/drivers/mmc/mmc_spi.c
+++ b/drivers/mmc/mmc_spi.c
@@ -181,8 +181,11 @@ static int mmc_spi_readdata(struct udevice *dev,
 			if (ret)
 				return ret;
 #ifdef CONFIG_MMC_SPI_CRC_ON
-			if (be16_to_cpu(crc16_ccitt(0, buf, bsize)) != crc) {
-				debug("%s: data crc error\n", __func__);
+			u16 crc_ok;
+			crc_ok = be16_to_cpu(crc16_ccitt(0, buf, bsize));
+			if (crc_ok != crc) {
+				debug("%s: data crc error, expect %04x get %04x\n",
+				      __func__, crc_ok, crc);
 				r1 = R1_SPI_COM_CRC;
 				break;
 			}
-- 
2.25.1



More information about the U-Boot mailing list