can: mcp251xfd: mcp251xfd_regmap_crc_read(): ignore CRC error only if solely OSC...
authorMarc Kleine-Budde <mkl@pengutronix.de>
Thu, 29 Oct 2020 09:46:51 +0000 (10:46 +0100)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Thu, 24 Feb 2022 07:26:04 +0000 (08:26 +0100)
commit25386c9a010069af63df887379ed29dd963f76a1
tree32a02ee5237e519ff49c37d3b7219e64a5522dea
parent3f5c91b4ce8f85cb807cafab126c5cd4c173d745
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.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/spi/mcp251xfd/mcp251xfd-regmap.c