• Serge Semin's avatar
    spi: dw-dma: Move DMAC register cleanup to DMA transfer method · 945b5b60
    Serge Semin authored
    DW APB SSI DMA driver doesn't use the native SPI core wait API since
    commit bdbdf0f0 ("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: default avatarSerge Semin <Sergey.Semin@baikalelectronics.ru>
    Link: https://lore.kernel.org/r/20200920112322.24585-10-Sergey.Semin@baikalelectronics.ruSigned-off-by: default avatarMark Brown <broonie@kernel.org>
    945b5b60
spi-dw-dma.c 12.2 KB