• Marc Kleine-Budde's avatar
    can: mcp251xfd: tef: update workaround for erratum DS80000789E 6 of mcp2518fd · 3a0a88fc
    Marc Kleine-Budde authored
    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: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
    3a0a88fc
mcp251xfd-tef.c 6.85 KB