dmaengine: stm32-dma: rework irq handler to manage error before xfer events
authorAmelie Delaunay <amelie.delaunay@st.com>
Fri, 20 Nov 2020 14:33:17 +0000 (15:33 +0100)
committerVinod Koul <vkoul@kernel.org>
Fri, 11 Dec 2020 15:43:08 +0000 (21:13 +0530)
commita44d9d72453ea6b064380d4835e712e574e58d9b
tree50b81149865b21f72b5e184a6527038e0484b265
parent4421fe533296e070359573ab6d320d74f73c80b9
dmaengine: stm32-dma: rework irq handler to manage error before xfer events

To better understand error that can be detected by the DMA controller,
manage the error flags before the transfer flags.
This way, it is possible to know if the FIFO error flag is set for an
over/underrun condition or a FIFO level error.
When a FIFO over/underrun condition occurs, the data is not lost because
peripheral request is not acknowledged by the stream until the over/
underrun condition is cleared. If this acknowledge takes too much time,
the peripheral itself may detect an over/underrun condition of its internal
buffer and data might be lost.
That's why in case the FIFO error flag is set, we check if the channel is
disabled or not, and if a Transfer Complete flag is set, which means that
the channel is disabled because of the end of transfer.
Because channel is disabled by hardware either by a FIFO level error, or by
an end of transfer.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
Link: https://lore.kernel.org/r/20201120143320.30367-2-amelie.delaunay@st.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/stm32-dma.c