Commit 25386c9a authored by Marc Kleine-Budde's avatar Marc Kleine-Budde

can: mcp251xfd: mcp251xfd_regmap_crc_read(): ignore CRC error only if solely OSC register is read

MCP251XFD_REG_OSC is the first register the driver reads from. The
chip may be in deep sleep and the SPI transfer (i.e. the assertion of
the CS) will wake the chip up. This takes about 3ms. The CRC of this
transfer is wrong, or there isn't any chip at all, in this case the
CRC will be wrong, too. The driver ignores the CRC error and returns
the read data to the caller.

To avoid any confusion, this patch changes the
mcp251xfd_regmap_crc_read() function to only ignore the CRC error if
solely the OSC register is read. So when reading more than the OSC
registers at once, CRC errors are not ignored.

Link: https://lore.kernel.org/all/20220207131047.282110-3-mkl@pengutronix.deSigned-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent 3f5c91b4
...@@ -368,7 +368,7 @@ mcp251xfd_regmap_crc_read(void *context, ...@@ -368,7 +368,7 @@ mcp251xfd_regmap_crc_read(void *context,
* to the caller. It will take care of both cases. * to the caller. It will take care of both cases.
* *
*/ */
if (reg == MCP251XFD_REG_OSC) { if (reg == MCP251XFD_REG_OSC && val_len == sizeof(__le32)) {
err = 0; err = 0;
goto out; goto out;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment