dmaengine: stm32-dma: introduce 3 helpers to address channel flags
authorAmelie Delaunay <amelie.delaunay@foss.st.com>
Mon, 29 Aug 2022 15:46:41 +0000 (17:46 +0200)
committerVinod Koul <vkoul@kernel.org>
Sun, 4 Sep 2022 17:18:02 +0000 (22:48 +0530)
commit4dc36a53b8b9135eed90766df49c0ec48d1550dd
tree4835880ef2ea5c630b9e19e1a6a832aa558ecc8c
parent9e08d2138f132257322b04bf7a8274c59be334e8
dmaengine: stm32-dma: introduce 3 helpers to address channel flags

Channels 0 to 3 flags are described in DMA_LISR and DMA_LIFCR (L as Low).
Channels 4 to 7 flags are described in DMA_HISR and DMA_HIFCR (H as High).
Macro STM32_DMA_ISR(n) returns the interrupt status register offset for the
channel id (n).
Macro STM32_DMA_IFCR(n) returns the interrupt flag clear register offset
for the channel id (n).

If chan->id % 4 = 2 or 3, then its flags are left-shifted by 16 bits.
If chan->id % 4 = 1 or 3, then its flags are additionally left-shifted by 6
bits.
If chan->id % 4 = 0, then its flags are not shifted.
Macro STM32_DMA_FLAGS_SHIFT(n) returns the required shift to get or set the
channel flags mask.

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