]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
can: mcp251xfd: tef: update workaround for erratum DS80000789E 6 of mcp2518fd
authorMarc Kleine-Budde <mkl@pengutronix.de>
Sun, 22 Jan 2023 21:35:03 +0000 (22:35 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Aug 2024 13:34:10 +0000 (15:34 +0200)
commit2406fa2adfc7b278138ec90c16d3244150157ad1
treebb119df876d77d17f2bb1a6b569b39d98ca505e6
parent7bb632e8f820fe13e68c810a478c855483d2ce06
can: mcp251xfd: tef: update workaround for erratum DS80000789E 6 of mcp2518fd

[ Upstream commit 3a0a88fcbaf9e027ecca3fe8775be9700b4d6460 ]

This patch updates the workaround for a problem similar to erratum
DS80000789E 6 of the mcp2518fd, the other variants of the chip
family (mcp2517fd and mcp251863) are probably also affected.

Erratum DS80000789E 6 says "reading of the FIFOCI bits in the FIFOSTA
register for an RX FIFO may be corrupted". However observation shows
that this problem is not limited to RX FIFOs but also effects the TEF
FIFO.

In the bad case, the driver reads a too large head index. As the FIFO
is implemented as a ring buffer, this results in re-handling old CAN
transmit complete events.

Every transmit complete event contains with a sequence number that
equals to the sequence number of the corresponding TX request. This
way old TX complete events can be detected.

If the original driver detects a non matching sequence number, it
prints an info message and tries again later. As wrong sequence
numbers can be explained by the erratum DS80000789E 6, demote the info
message to debug level, streamline the code and update the comments.

Keep the behavior: If an old CAN TX complete event is detected, abort
the iteration and mark the number of valid CAN TX complete events as
processed in the chip by incrementing the FIFO's tail index.

Cc: Stefan Althöfer <Stefan.Althoefer@janztec.com>
Cc: Thomas Kopp <thomas.kopp@microchip.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/can/spi/mcp251xfd/mcp251xfd-tef.c