diff mbox series

dmaengine: xilinx_dma: Configure parking registers only if parking enabled

Message ID 20241031171132.56861-1-marex@denx.de (mailing list archive)
State Accepted
Commit 8a20040f9de3a4ea90ab900cdd7745d57bc2da82
Headers show
Series dmaengine: xilinx_dma: Configure parking registers only if parking enabled | expand

Commit Message

Marek Vasut Oct. 31, 2024, 5:11 p.m. UTC
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@denx.de>
---
Cc: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
Cc: Michal Simek <michal.simek@amd.com>
Cc: Peter Korsgaard <peter@korsgaard.com>
Cc: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Cc: Vinod Koul <vkoul@kernel.org>
Cc: dmaengine@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
---
 drivers/dma/xilinx/xilinx_dma.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

Comments

Radhey Shyam Pandey Nov. 6, 2024, 9:37 a.m. UTC | #1
> -----Original Message-----
> From: Marek Vasut <marex@denx.de>
> Sent: Thursday, October 31, 2024 10:41 PM
> To: dmaengine@vger.kernel.org
> Cc: Marek Vasut <marex@denx.de>; Uwe Kleine-König <u.kleine-
> koenig@baylibre.com>; Simek, Michal <michal.simek@amd.com>; Peter Korsgaard
> <peter@korsgaard.com>; Pandey, Radhey Shyam
> <radhey.shyam.pandey@amd.com>; Vinod Koul <vkoul@kernel.org>; linux-arm-
> kernel@lists.infradead.org
> Subject: [PATCH] dmaengine: xilinx_dma: Configure parking registers only if parking
> enabled
> 
> 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@denx.de>

Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Thanks!
> ---
> Cc: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
> Cc: Michal Simek <michal.simek@amd.com>
> Cc: Peter Korsgaard <peter@korsgaard.com>
> Cc: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
> Cc: Vinod Koul <vkoul@kernel.org>
> Cc: dmaengine@vger.kernel.org
> Cc: linux-arm-kernel@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
Vinod Koul Dec. 2, 2024, 5:31 p.m. UTC | #2
On Thu, 31 Oct 2024 18:11:04 +0100, Marek Vasut wrote:
> 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.
> 
> 

Applied, thanks!

[1/1] dmaengine: xilinx_dma: Configure parking registers only if parking enabled
      commit: 8a20040f9de3a4ea90ab900cdd7745d57bc2da82

Best regards,
diff mbox series

Patch

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);