]> www.infradead.org Git - users/dwmw2/linux.git/commit
can: rockchip_canfd: rkcanfd_handle_rx_int_one(): implement workaround for erratum...
authorMarc Kleine-Budde <mkl@pengutronix.de>
Thu, 4 Jan 2024 09:45:38 +0000 (10:45 +0100)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Wed, 4 Sep 2024 12:41:52 +0000 (14:41 +0200)
commit6571354269f87ddbe0d0b8c890119326145b08d0
tree07ae5b5da509bf954e401c3020fbac43a7ced51e
parentfb999a5f990605fa4876525c9f73fc0a37844a2d
can: rockchip_canfd: rkcanfd_handle_rx_int_one(): implement workaround for erratum 5: check for empty FIFO

The rk3568 CAN-FD errata sheet as of Tue 07 Nov 2023 11:25:31 +08:00
says:

| Erratum 5: Counters related to the TXFIFO and RXFIFO exhibit
| abnormal counting behavior.
|
| Due to a bug in the cross-asynchronous logic of the enable signals
| for rx_fifo_cnt and txe_fifo_frame_cnt counters, the counts of these
| two counters become inaccurate. This issue has resulted in the
| inability to use the TXFIFO and RXFIFO functions.

The errata sheet mentioned above states that only the rk3568v2 is
affected by this erratum, but tests with the rk3568v2 and rk3568v3
show that the RX_FIFO_CNT is sometimes too high. This leads to CAN
frames being read from the FIFO, which is then already empty.

Further tests on the rk3568v2 and rk3568v3 show that in this
situation (i.e. empty FIFO) all elements of the FIFO
header (frameinfo, id, ts) contain the same data.

On the rk3568v2 and rk3568v3, this problem only occurs extremely
rarely with the standard clock of 300 MHz, but almost immediately at
80 MHz.

To workaround this problem, check for empty FIFO with
rkcanfd_fifo_header_empty() in rkcanfd_handle_rx_int_one() and exit
early.

Tested-by: Alibek Omarov <a1ba.omarov@gmail.com>
Acked-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patch.msgid.link/20240904-rockchip-canfd-v5-9-8ae22bcb27cc@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/rockchip/rockchip_canfd-rx.c
drivers/net/can/rockchip/rockchip_canfd.h