Message ID | 20200723004356.6390-3-jon.lin@rock-chips.com (mailing list archive) |
---|---|
State | Mainlined |
Commit | 4294e4accf8d695ea5605f6b189008b692e3e82c |
Headers | show |
Series | [v3,1/3] spi: rockchip: Config spi rx dma burst size depend on xfer length | expand |
diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index a451dacab5cf..75a8a9428ff8 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -291,7 +291,7 @@ static void rockchip_spi_pio_writer(struct rockchip_spi *rs) static void rockchip_spi_pio_reader(struct rockchip_spi *rs) { u32 words = readl_relaxed(rs->regs + ROCKCHIP_SPI_RXFLR); - u32 rx_left = rs->rx_left - words; + u32 rx_left = (rs->rx_left > words) ? rs->rx_left - words : 0; /* the hardware doesn't allow us to change fifo threshold * level while spi is enabled, so instead make sure to leave