From 227f34f48815a2c7c5338751b5db8958a0cbc259 Mon Sep 17 00:00:00 2001 From: Sugar Zhang Date: Fri, 13 Oct 2023 08:59:24 +0800 Subject: [PATCH] dmaengine: pl330: Fix pos calculation on interleaved dma bytes_requested should use the full buffer size which include ICG(inter-chuck-gap) size. Fixes: 0eba9f8ec037 ("dmaengine: pl330: Add support for interleaved transfer") Signed-off-by: Sugar Zhang Change-Id: Ib0bb5a55abaea306071d96e76d219de942b151b4 --- drivers/dma/pl330.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index 0b2b7acf5462..010fbad47dca 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -2924,7 +2924,7 @@ static struct dma_async_tx_descriptor *pl330_prep_interleaved_dma( struct dma_pl330_desc *desc = NULL; struct dma_pl330_chan *pch = to_pchan(chan); dma_addr_t dst = 0, src = 0; - size_t size, src_icg, dst_icg, period_bytes, buffer_bytes; + size_t size, src_icg, dst_icg, period_bytes, buffer_bytes, full_buffer_bytes; size_t nump = 0, numf = 0; if (!xt->numf || !xt->sgl[0].size || xt->frame_size != 1) @@ -2960,17 +2960,19 @@ static struct dma_async_tx_descriptor *pl330_prep_interleaved_dma( desc->rqcfg.dst_inc = 0; src = xt->src_start; dst = pch->fifo_dma; + full_buffer_bytes = (size + src_icg) * numf; } else { desc->rqcfg.src_inc = 0; desc->rqcfg.dst_inc = 1; src = pch->fifo_dma; dst = xt->dst_start; + full_buffer_bytes = (size + dst_icg) * numf; } desc->rqtype = xt->dir; desc->rqcfg.brst_size = pch->burst_sz; desc->rqcfg.brst_len = pch->burst_len; - desc->bytes_requested = buffer_bytes; + desc->bytes_requested = full_buffer_bytes; desc->sgl.size = size; desc->sgl.src_icg = src_icg; desc->sgl.dst_icg = dst_icg;