[PATCH] dmaengine: xilinx_dma: Configure parking registers only if parking enabled

Marek Vasut marex at denx.de
Thu Oct 31 10:11:04 PDT 2024


The VDMA can work in two modes, parking or circular. Do not program the
parking mode registers in case circular mode is used, it is useless.

Signed-off-by: Marek Vasut <marex at denx.de>
---
Cc: "Uwe Kleine-König" <u.kleine-koenig at baylibre.com>
Cc: Michal Simek <michal.simek at amd.com>
Cc: Peter Korsgaard <peter at korsgaard.com>
Cc: Radhey Shyam Pandey <radhey.shyam.pandey at amd.com>
Cc: Vinod Koul <vkoul at kernel.org>
Cc: dmaengine at vger.kernel.org
Cc: linux-arm-kernel at lists.infradead.org
---
 drivers/dma/xilinx/xilinx_dma.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c
index 48647c8a64a5b..87db381ff1286 100644
--- a/drivers/dma/xilinx/xilinx_dma.c
+++ b/drivers/dma/xilinx/xilinx_dma.c
@@ -1404,16 +1404,18 @@ static void xilinx_vdma_start_transfer(struct xilinx_dma_chan *chan)
 
 	dma_ctrl_write(chan, XILINX_DMA_REG_DMACR, reg);
 
-	j = chan->desc_submitcount;
-	reg = dma_read(chan, XILINX_DMA_REG_PARK_PTR);
-	if (chan->direction == DMA_MEM_TO_DEV) {
-		reg &= ~XILINX_DMA_PARK_PTR_RD_REF_MASK;
-		reg |= j << XILINX_DMA_PARK_PTR_RD_REF_SHIFT;
-	} else {
-		reg &= ~XILINX_DMA_PARK_PTR_WR_REF_MASK;
-		reg |= j << XILINX_DMA_PARK_PTR_WR_REF_SHIFT;
+	if (config->park) {
+		j = chan->desc_submitcount;
+		reg = dma_read(chan, XILINX_DMA_REG_PARK_PTR);
+		if (chan->direction == DMA_MEM_TO_DEV) {
+			reg &= ~XILINX_DMA_PARK_PTR_RD_REF_MASK;
+			reg |= j << XILINX_DMA_PARK_PTR_RD_REF_SHIFT;
+		} else {
+			reg &= ~XILINX_DMA_PARK_PTR_WR_REF_MASK;
+			reg |= j << XILINX_DMA_PARK_PTR_WR_REF_SHIFT;
+		}
+		dma_write(chan, XILINX_DMA_REG_PARK_PTR, reg);
 	}
-	dma_write(chan, XILINX_DMA_REG_PARK_PTR, reg);
 
 	/* Start the hardware */
 	xilinx_dma_start(chan);
-- 
2.45.2




More information about the linux-arm-kernel mailing list