Skip to contentSkip to conversation

mmc: mmc_spi: Print verbose debug output when crc16 check fails

PATCH Superseded Bin Meng 2 participants 4 messages Jan 17, 2021 – Feb 1, 2021 MMC, SD and SDIO

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Bin Meng

author
#0 lore raw

PATCH v2 1/1 mmc: mmc_spi: Print verbose debug output when crc16 check fails

Add some verbose debug output when crc16 check fails.

---

Changes in v2:
- do the crc_ok assignment at the the same line where it's defined

 drivers/mmc/mmc_spi.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/mmc/mmc_spi.c +4 -2
index 46800bbed2..b1edb6ad7c 100644
@@ -181,8 +181,10 @@ 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 = 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;
 			}
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH v2 1/1 mmc: mmc_spi: Print verbose debug output when crc16 check fails

Quoted 6 lines · Bin Meng

Add some verbose debug output when crc16 check fails.

Quoted 8 lines

---

Changes in v2:
- do the crc_ok assignment at the the same line where it's defined

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

Ping?

author
#2 lore raw

PATCH v2 1/1 mmc: mmc_spi: Print verbose debug output when crc16 check fails

Quoted 10 lines · Bin Meng
Quoted 8 lines · Bin Meng

Add some verbose debug output when crc16 check fails.

---

Quoted 8 lines
Quoted 6 lines

Changes in v2:
- do the crc_ok assignment at the the same line where it's defined

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

Ping?

Peng, will you take this, or if this should go via another tree?

Regards,
Bin

#3 lore raw

PATCH v2 1/1 mmc: mmc_spi: Print verbose debug output when crc16 check fails

In reply to Bin Meng
Quoted 18 lines · Bin Meng

Add some verbose debug output when crc16 check fails.

---

Changes in v2:
- do the crc_ok assignment at the the same line where it's defined

  drivers/mmc/mmc_spi.c | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)
drivers/mmc/mmc_spi.c +0 -0
index 46800bbed2..b1edb6ad7c 100644

drivers/mmc/mmc_spi.c static int mmc_spi_readdata(struct udevice *dev, · line 186

Quoted 8 lines
drivers/mmc/mmc_spi.c +3 -2
@@ -181,8 +181,10 @@ 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 = be16_to_cpu(crc16_ccitt(0, buf, bsize));
+			if (crc_ok != crc) {
+				debug("%s: data crc error, expect %04x get %04x\n",

Nit: Perhaps use expected/got?

Otherwise looks good to me; I ended up creating a similar patch previously, but never got around to upstreaming it.

--Sean

Quoted 5 lines
drivers/mmc/mmc_spi.c +1 -0
+				      __func__, crc_ok, crc);
  				r1 = R1_SPI_COM_CRC;
  				break;
  			}