Skip to content

Commit 8080876

Browse files
Jon Linbroonie
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 9382df0 commit 8080876

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/spi/spi-rockchip.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,12 @@ static int rockchip_spi_slave_abort(struct spi_controller *ctlr)
585585
{
586586
struct rockchip_spi *rs = spi_controller_get_devdata(ctlr);
587587

588+
if (atomic_read(&rs->state) & RXDMA)
589+
dmaengine_terminate_sync(ctlr->dma_rx);
590+
if (atomic_read(&rs->state) & TXDMA)
591+
dmaengine_terminate_sync(ctlr->dma_tx);
592+
atomic_set(&rs->state, 0);
593+
spi_enable_chip(rs, false);
588594
rs->slave_abort = true;
589595
spi_finalize_current_transfer(ctlr);
590596

0 commit comments

Comments
 (0)