netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/9] can: mcp251xfd: workaround for erratum DS80000789E 6 of mcp2518fd
@ 2024-06-24 14:45 Marc Kleine-Budde
  2024-06-24 14:45 ` [PATCH v3 1/9] can: mcp251xfd: properly indent labels Marc Kleine-Budde
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Marc Kleine-Budde @ 2024-06-24 14:45 UTC (permalink / raw)
  To: Manivannan Sadhasivam, Vincent Mailhol, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Manivannan Sadhasivam, Thomas Kopp, Stefan Althöfer, kernel,
	linux-can, netdev, linux-kernel, Marc Kleine-Budde

Hello,

This patch series tries to work around erratum DS80000789E 6 of the
mcp2518fd, found by Stefan Althöfer, 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. In the
original code, the driver always trusted the read value.

For the RX FIDO this caused old, already processed CAN frames or new,
incompletely written CAN frames to be (re-)processed.

To work around this issue, keep a per FIFO timestamp of the last valid
received CAN frame and compare against the timestamp of every received
CAN frame.

Further tests showed that this workaround can recognize old CAN
frames, but a small time window remains in which partially written CAN
frames are not recognized but then processed. These CAN frames have
the correct data and time stamps, but the DLC has not yet been
updated.

For the TEF FIFO the original driver already detects the error, update
the error handling with the knowledge that it is causes by this erratum.

The series applies against current net/main or net-next/main +
d8fb63e46c88 ("can: mcp251xfd: fix infinite loop when xmit fails")

regards,
Marc

Changes since v2: https://lore.kernel.org/all/20230119112842.500709-1-mkl@pengutronix.de
1/9: can: mcp251xfd: properly indent labels:
  - new
2/9: can: mcp251xfd: update errata references:
 - new
3/9: can: mcp251xfd: move mcp251xfd_timestamp_start()/stop() into mcp251xfd_chip_start/stop()
 - split mcp251xfd_timestamp_init() into mcp251xfd_timestamp_init()
   and mcp251xfd_timestamp_start()
 - update patch description
6/9: can: mcp251xfd: rx: prepare to workaround broken RX FIFO head index erratum
 - update comments  
 - update patch description
7/9: can: mcp251xfd: rx: add workaround for erratum DS80000789E 6 of mcp2518fd
 - update comments  
 - update patch description
8/9: new
 - import 1/2 from https://lore.kernel.org/all/20230124152729.814840-1-mkl@pengutronix.de
9/9: new
 - import 2/2 from https://lore.kernel.org/all/20230124152729.814840-1-mkl@pengutronix.de

Changes since v1: https://lore.kernel.org/all/20230111222042.1139027-1-mkl@pengutronix.de
all:
  - add proper patch description
  - added Tested-by
2/5 can: mcp251xfd: clarify the meaning of timestamp:
  - revisited new naming of variables and functions
    now we use ts_raw instead of tbc
4/5 can: mcp251xfd: rx: prepare to workaround broken RX:
  - precalculate shift width needed for full u8 instead of calculating
    it every time
5/5 can: mcp251xfd: rx: workaround broken RX FIFO head:
  - remove dumping of old CAN frame in error case
  - add erratum comments

Closes: https://lore.kernel.org/all/FR0P281MB1966273C216630B120ABB6E197E89@FR0P281MB1966.DEUP281.PROD.OUTLOOK.COM
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
Marc Kleine-Budde (9):
      can: mcp251xfd: properly indent labels
      can: mcp251xfd: update errata references
      can: mcp251xfd: move mcp251xfd_timestamp_start()/stop() into mcp251xfd_chip_start/stop()
      can: mcp251xfd: clarify the meaning of timestamp
      can: mcp251xfd: mcp251xfd_handle_rxif_ring_uinc(): factor out in separate function
      can: mcp251xfd: rx: prepare to workaround broken RX FIFO head index erratum
      can: mcp251xfd: rx: add workaround for erratum DS80000789E 6 of mcp2518fd
      can: mcp251xfd: tef: prepare to workaround broken TEF FIFO tail index erratum
      can: mcp251xfd: tef: update workaround for erratum DS80000789E 6 of mcp2518fd

 drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c     |  82 ++++++-----
 drivers/net/can/spi/mcp251xfd/mcp251xfd-dump.c     |   2 +-
 drivers/net/can/spi/mcp251xfd/mcp251xfd-regmap.c   |   2 +-
 drivers/net/can/spi/mcp251xfd/mcp251xfd-ring.c     |   3 +
 drivers/net/can/spi/mcp251xfd/mcp251xfd-rx.c       | 163 ++++++++++++++-------
 drivers/net/can/spi/mcp251xfd/mcp251xfd-tef.c      | 127 ++++++++--------
 .../net/can/spi/mcp251xfd/mcp251xfd-timestamp.c    |  29 ++--
 drivers/net/can/spi/mcp251xfd/mcp251xfd.h          |  56 +++----
 8 files changed, 261 insertions(+), 203 deletions(-)
---
base-commit: 568ebdaba6370c03360860f1524f646ddd5ca523
change-id: 20240505-mcp251xfd-workaround-erratum-6-2e82c4c62fd3
prerequisite-patch-id: d8fb63e46c884c898a38f061c2330f7729e75510

Best regards,
-- 
Marc Kleine-Budde <mkl@pengutronix.de>



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-06-24 14:45 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-24 14:45 [PATCH v3 0/9] can: mcp251xfd: workaround for erratum DS80000789E 6 of mcp2518fd Marc Kleine-Budde
2024-06-24 14:45 ` [PATCH v3 1/9] can: mcp251xfd: properly indent labels Marc Kleine-Budde
2024-06-24 14:45 ` [PATCH v3 2/9] can: mcp251xfd: update errata references Marc Kleine-Budde
2024-06-24 14:45 ` [PATCH v3 3/9] can: mcp251xfd: move mcp251xfd_timestamp_start()/stop() into mcp251xfd_chip_start/stop() Marc Kleine-Budde
2024-06-24 14:45 ` [PATCH v3 4/9] can: mcp251xfd: clarify the meaning of timestamp Marc Kleine-Budde
2024-06-24 14:45 ` [PATCH v3 5/9] can: mcp251xfd: mcp251xfd_handle_rxif_ring_uinc(): factor out in separate function Marc Kleine-Budde
2024-06-24 14:45 ` [PATCH v3 6/9] can: mcp251xfd: rx: prepare to workaround broken RX FIFO head index erratum Marc Kleine-Budde
2024-06-24 14:45 ` [PATCH v3 7/9] can: mcp251xfd: rx: add workaround for erratum DS80000789E 6 of mcp2518fd Marc Kleine-Budde
2024-06-24 14:45 ` [PATCH v3 8/9] can: mcp251xfd: tef: prepare to workaround broken TEF FIFO tail index erratum Marc Kleine-Budde
2024-06-24 14:45 ` [PATCH v3 9/9] can: mcp251xfd: tef: update workaround for erratum DS80000789E 6 of mcp2518fd Marc Kleine-Budde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).