net: can: rockchip: fix rx stuck and timeout

In some special applications, tx has read data from the fifo, rx to read
the fifo is 0 when there is no need to do timeout waiting.

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
Change-Id: I7f4bc88ace026088228396da96d628bebb9e4b94
This commit is contained in:
Elaine Zhang
2023-11-06 09:50:18 +08:00
committed by Tao Huang
parent e903c65661
commit 9038fae6bd

View File

@@ -852,7 +852,10 @@ static irqreturn_t rockchip_canfd_interrupt(int irq, void *dev_id)
rockchip_canfd_write(rcan, CAN_INT_MASK, 0x1);
napi_schedule(&rcan->napi);
} else {
quota = rockchip_canfd_get_rx_fifo_cnt(ndev);
work_done = 0;
quota = (rockchip_canfd_read(rcan, CAN_RXFC) &
rcan->rx_fifo_mask) >>
rcan->rx_fifo_shift;
if (quota) {
while (work_done < quota)
work_done += rockchip_canfd_rx(ndev);