dmaengine: cv1800b-dmamux: fix channel allocation order
PATCH 1/1 dmaengine: cv1800b-dmamux: fix channel allocation order
The dmamux builds the free_maps list using llist_add(), which inserts new nodes at the head. Using increasing channel indices causes the first allocation to use DMA channel 7 while the DMA engine hands out channel 0, leading to mismatched routing.
Reverse the channel index order so the first allocation gets channel 0.
--- drivers/dma/cv1800b-dmamux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/cv1800b-dmamux.c +1 -1
@@ -214,7 +214,7 @@ static int cv1800_dmamux_probe(struct platform_device *pdev) }init_llist_node (&tmp->node); - tmp->channel = i; + tmp->channel =MAX_DMA_CH_ID - i;llist_add (&tmp->node, &data->free_maps); }
Signature · 1 line
2.43.0
Quoted 29 lines · Anton D. Stavinskii
The dmamux builds the
free_mapslist usingllist_add(), which inserts new nodes at the head. Using increasing channel indices causes the first allocation to use DMA channel 7 while the DMA engine hands out channel 0, leading to mismatched routing.Reverse the channel index order so the first allocation gets channel 0.
Fixes db7d07b5add4d ("dmaengine: add driver for Sophgo CV18XX/SG200X dmamux")Signed-off-by Anton D. Stavinskii <[email protected]>--- drivers/dma/cv1800b-dmamux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/dma/cv1800b-dmamux.c +1
-1@@ -214,7 +214,7 @@ static int cv1800_dmamux_probe(struct platform_device *pdev) }init_llist_node (&tmp->node); - tmp->channel = i; + tmp->channel =MAX_DMA_CH_ID - i;llist_add (&tmp->node, &data->free_maps); }Signature · 1 line
2.43.0
The problem is caused by the dw-axi-dmac driver, which allocate channel dynamically. And the dma multiplexer can only routes the interrupt statically, so it has the wrong information about the channel enabled.
This patch does not fix the problem actually, I have sent a new patch for it.
https://lore.kernel.org/all/[email protected]/
Regards,
Inochi