]> git.baikalelectronics.ru Git - kernel.git/commit
spi: dw-dma: Move DMAC register cleanup to DMA transfer method
authorBaikal Electronics <support@baikalelectronics.ru>
Sun, 20 Sep 2020 11:23:20 +0000 (14:23 +0300)
committerMark Brown <broonie@kernel.org>
Tue, 29 Sep 2020 15:37:13 +0000 (16:37 +0100)
commit4c82b1812170d08a7740f6be763e6790df8134ab
tree3d0b8450baf82904f041285d130c127076d92be4
parentb15be2fe94959cf469886bd972eae7a754996467
spi: dw-dma: Move DMAC register cleanup to DMA transfer method

DW APB SSI DMA driver doesn't use the native SPI core wait API since
commit 38f8e630548b ("spi: dw: Locally wait for the DMA transfers
completion"). Due to that the driver can now clear the DMAC register
in a single place synchronously with the DMA transactions completion
or failure. After that all the possible code paths are still covered:
1) DMA completion callbacks are executed in case if the corresponding DMA
transactions are finished. When they are, one of them will eventually wake
the SPI messages pump kernel thread and dw_spi_dma_transfer_all() method
will clean the DMAC register as implied by this patch.
2) dma_stop is called when the SPI core detects an error either returned
from the transfer_one() callback or set in the SPI message status field.
Both types of errors will be noticed by the dw_spi_dma_transfer_all()
method.
3) dma_exit is called when either SPI controller driver or the
corresponding device is removed. In any case the SPI core will first
flush the SPI messages pump kernel thread, so any pending or in-fly
SPI transfers will be finished before that.

Due to all of that let's simplify the DW APB SSI DMA driver a bit and
move the DMAC register cleanup to a single place in the
dw_spi_dma_transfer_all() method.

Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Link: https://lore.kernel.org/r/20200920112322.24585-10-Sergey.Semin@baikalelectronics.ru
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-dw-dma.c