]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
dmaengine: dma-axi-dmac: Add cyclic transfers in .device_prep_peripheral_dma_vec()
authorNuno Sá <nuno.sa@analog.com>
Tue, 3 Mar 2026 10:25:01 +0000 (10:25 +0000)
committerVinod Koul <vkoul@kernel.org>
Mon, 9 Mar 2026 07:28:21 +0000 (08:28 +0100)
Add support for cyclic transfers by checking the DMA_PREP_REPEAT
flag. If the flag is set, close the loop and clear the flag for the last
segment (the same done for .device_prep_dma_cyclic().

Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20260303-axi-dac-cyclic-support-v2-2-0db27b4be95a@analog.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/dma-axi-dmac.c

index eb65872c5d5cd7ee3ad1c0f4f4d7f13227f5fe1e..79c01b7d973280f0eb18025f4e6992f4788fef48 100644 (file)
@@ -657,7 +657,12 @@ axi_dmac_prep_peripheral_dma_vec(struct dma_chan *c, const struct dma_vec *vecs,
                                              vecs[i].len, dsg);
        }
 
-       desc->cyclic = false;
+       desc->cyclic = flags & DMA_PREP_REPEAT;
+       if (desc->cyclic) {
+               /* Chain the last descriptor to the first, and remove its "last" flag */
+               desc->sg[num_sgs - 1].hw->flags &= ~AXI_DMAC_HW_FLAG_LAST;
+               desc->sg[num_sgs - 1].hw->next_sg_addr = desc->sg[0].hw_phys;
+       }
 
        return vchan_tx_prep(&chan->vchan, &desc->vdesc, flags);
 }