Skip to content

Commit

Permalink
spi: rockchip: Fix error in SPI slave pio read
Browse files Browse the repository at this point in the history
[ Upstream commit 4294e4a ]

The RXFLR is possible larger than rx_left in Rockchip SPI, fix it.

Fixes: 01b59ce ("spi: rockchip: use irq rather than polling")
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
Tested-by: Emil Renner Berthing <kernel@esmil.dk>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Emil Renner Berthing <kernel@esmil.dk>
Link: https://lore.kernel.org/r/20200723004356.6390-3-jon.lin@rock-chips.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Jon Lin authored and gregkh committed Aug 19, 2020
1 parent 0b17996 commit 9600bdd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/spi/spi-rockchip.c
Expand Up @@ -286,7 +286,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
Expand Down

0 comments on commit 9600bdd

Please sign in to comment.