Skip to content

Commit

Permalink
spi: rockchip: terminate dma transmission when slave abort
Browse files Browse the repository at this point in the history
[ Upstream commit 8080876 ]

After slave abort, all DMA should be stopped, or it will affect the
next transmission and maybe abort again.

Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
Link: https://lore.kernel.org/r/20220216014028.8123-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 Mar 16, 2022
1 parent 889254f commit 8c023c3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/spi/spi-rockchip.c
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,12 @@ static int rockchip_spi_slave_abort(struct spi_controller *ctlr)
{
struct rockchip_spi *rs = spi_controller_get_devdata(ctlr);

if (atomic_read(&rs->state) & RXDMA)
dmaengine_terminate_sync(ctlr->dma_rx);
if (atomic_read(&rs->state) & TXDMA)
dmaengine_terminate_sync(ctlr->dma_tx);
atomic_set(&rs->state, 0);
spi_enable_chip(rs, false);
rs->slave_abort = true;
complete(&ctlr->xfer_completion);

Expand Down

0 comments on commit 8c023c3

Please sign in to comment.