]> git.baikalelectronics.ru Git - kernel.git/commit
can: hi311x: Work around TX complete interrupt erratum
authorLukas Wunner <lukas@wunner.de>
Wed, 9 May 2018 12:43:43 +0000 (14:43 +0200)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Thu, 10 May 2018 16:25:30 +0000 (18:25 +0200)
commita334bcdc33f5380f6e10855782797f210d29dd25
tree30093cd3843728a93f710d05ae663f8bf7bbea2d
parent6ad3f32a3eba5398252d3bd2b6ea70e16d2b7a84
can: hi311x: Work around TX complete interrupt erratum

When sending packets as fast as possible using "cangen -g 0 -i -x", the
HI-3110 occasionally latches the interrupt pin high on completion of a
packet, but doesn't set the TXCPLT bit in the INTF register.  The INTF
register contains 0x00 as if no interrupt has occurred.  Even waiting
for a few milliseconds after the interrupt doesn't help.

Work around this apparent erratum by instead checking the TXMTY bit in
the STATF register ("TX FIFO empty").  We know that we've queued up a
packet for transmission if priv->tx_len is nonzero.  If the TX FIFO is
empty, transmission of that packet must have completed.

Note that this is congruent with our handling of received packets, which
likewise gleans from the STATF register whether a packet is waiting in
the RX FIFO, instead of looking at the INTF register.

Cc: Mathias Duckeck <m.duckeck@kunbus.de>
Cc: Akshay Bhat <akshay.bhat@timesys.com>
Cc: Casey Fitzpatrick <casey.fitzpatrick@timesys.com>
Cc: stable@vger.kernel.org # v4.12+
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Acked-by: Akshay Bhat <akshay.bhat@timesys.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/spi/hi311x.c