summaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorJon Lin <jon.lin@rock-chips.com>2022-02-16 09:40:24 +0800
committerMark Brown <broonie@kernel.org>2022-02-17 15:33:18 +0000
commit80808768e41324d2e23de89972b5406c1020e6e4 (patch)
tree46f3ccdaf55871127bd376ca61e77fdc3adea4d3 /drivers/spi
parent9382df0a98aad5bbcd4d634790305a1d786ad224 (diff)
downloadlinux-80808768e41324d2e23de89972b5406c1020e6e4.tar.gz
linux-80808768e41324d2e23de89972b5406c1020e6e4.tar.bz2
linux-80808768e41324d2e23de89972b5406c1020e6e4.zip
spi: rockchip: terminate dma transmission when slave abort
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>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi-rockchip.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c
index 4f65ba3dd19c..c6a1bb09be05 100644
--- a/drivers/spi/spi-rockchip.c
+++ b/drivers/spi/spi-rockchip.c
@@ -585,6 +585,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;
spi_finalize_current_transfer(ctlr);