From: Nuno Sá Date: Tue, 3 Mar 2026 10:25:01 +0000 (+0000) Subject: dmaengine: dma-axi-dmac: Add cyclic transfers in .device_prep_peripheral_dma_vec() X-Git-Tag: v7.1-rc1~109^2~46 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ac85913ab71e0de9827b7f8f7fccb9f20943c02f;p=thirdparty%2Fkernel%2Flinux.git dmaengine: dma-axi-dmac: Add cyclic transfers in .device_prep_peripheral_dma_vec() 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 Signed-off-by: Nuno Sá Link: https://patch.msgid.link/20260303-axi-dac-cyclic-support-v2-2-0db27b4be95a@analog.com Signed-off-by: Vinod Koul --- diff --git a/drivers/dma/dma-axi-dmac.c b/drivers/dma/dma-axi-dmac.c index eb65872c5d5cd..79c01b7d97328 100644 --- a/drivers/dma/dma-axi-dmac.c +++ b/drivers/dma/dma-axi-dmac.c @@ -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); }