Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dmaengine: fsl-edma: fix eDMAv4 channel allocation issue

The eDMAv4 channel mux has a limitation where certain requests must use
even channels, while others must use odd numbers.

Add two flags (ARGS_EVEN_CH and ARGS_ODD_CH) to reflect this limitation.
The device tree source (dts) files need to be updated accordingly.

This issue was identified by the following commit:
commit a725990557e7 ("arm64: dts: imx93: Fix the dmas entries order")

Reverting channel orders triggered this problem.

Fixes: 72f5801a4e2b ("dmaengine: fsl-edma: integrate v3 support")
Signed-off-by: Frank Li <Frank.Li@nxp.com>
Link: https://lore.kernel.org/r/20231114154824.3617255-2-Frank.Li@nxp.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Frank Li and committed by
Vinod Koul
dc51b444 f60dfe0c

+8
+8
drivers/dma/fsl-edma-main.c
··· 24 24 #define ARGS_RX BIT(0) 25 25 #define ARGS_REMOTE BIT(1) 26 26 #define ARGS_MULTI_FIFO BIT(2) 27 + #define ARGS_EVEN_CH BIT(3) 28 + #define ARGS_ODD_CH BIT(4) 27 29 28 30 static void fsl_edma_synchronize(struct dma_chan *chan) 29 31 { ··· 158 156 fsl_chan->is_rxchan = dma_spec->args[2] & ARGS_RX; 159 157 fsl_chan->is_remote = dma_spec->args[2] & ARGS_REMOTE; 160 158 fsl_chan->is_multi_fifo = dma_spec->args[2] & ARGS_MULTI_FIFO; 159 + 160 + if ((dma_spec->args[2] & ARGS_EVEN_CH) && (i & 0x1)) 161 + continue; 162 + 163 + if ((dma_spec->args[2] & ARGS_ODD_CH) && !(i & 0x1)) 164 + continue; 161 165 162 166 if (!b_chmux && i == dma_spec->args[0]) { 163 167 chan = dma_get_slave_channel(chan);