Re: [PATCH 1/2] dmaengine: xilinx: fix device_terminate_all() callback for AXI CDMA

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Feb 27, 2017 at 02:09:35AM +0900, Akinobu Mita wrote:
> The device_terminate_all() callback for this driver stops current DMA
> operations by clearing RUNSTOP bit in the control register and waiting
> HALTED bit set in the status register.
> 
> But AXI CDMA which is one of the supported DMA engine by this driver
> does not provide the run / stop controls and those bits in the control
> and status registers are reserved.  So when device_terminate_all() is
> called, the error message is printed and the channel is marked as having
> errors in xilinx_dma_halt().
> 
> This change avoids the unsupported operations and instead polls the
> status register to check if the DMA operations are in progress for AXI
> CDMA.
> 
> Cc: Vinod Koul <vinod.koul@xxxxxxxxx>
> Cc: Kedareswara rao Appana <appana.durga.rao@xxxxxxxxxx>
> Cc: Michal Simek <monstr@xxxxxxxxx>
> Signed-off-by: Akinobu Mita <akinobu.mita@xxxxxxxxx>
> ---
>  drivers/dma/xilinx/xilinx_dma.c | 17 ++++++++++++-----
>  1 file changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c
> index 8288fe4..c0c9f28 100644
> --- a/drivers/dma/xilinx/xilinx_dma.c
> +++ b/drivers/dma/xilinx/xilinx_dma.c
> @@ -954,12 +954,19 @@ static void xilinx_dma_halt(struct xilinx_dma_chan *chan)
>  	int err;
>  	u32 val;
>  
> -	dma_ctrl_clr(chan, XILINX_DMA_REG_DMACR, XILINX_DMA_DMACR_RUNSTOP);
> +	if (chan->xdev->dma_config->dmatype == XDMA_TYPE_CDMA) {
> +		err = xilinx_dma_poll_timeout(chan, XILINX_DMA_REG_DMASR, val,
> +					      val & XILINX_DMA_DMASR_IDLE, 0,
> +					      XILINX_DMA_LOOP_COUNT);
> +	} else {
> +		dma_ctrl_clr(chan, XILINX_DMA_REG_DMACR,
> +			     XILINX_DMA_DMACR_RUNSTOP);

this seems okay but are we going to have any more versions of this, if so
should we split it up and add this as ops which is set at probe and invoke
here..

>  
> -	/* Wait for the hardware to halt */
> -	err = xilinx_dma_poll_timeout(chan, XILINX_DMA_REG_DMASR, val,
> -				      (val & XILINX_DMA_DMASR_HALTED), 0,
> -				      XILINX_DMA_LOOP_COUNT);
> +		/* Wait for the hardware to halt */
> +		err = xilinx_dma_poll_timeout(chan, XILINX_DMA_REG_DMASR, val,
> +					      val & XILINX_DMA_DMASR_HALTED, 0,
> +					      XILINX_DMA_LOOP_COUNT);
> +	}
>  
>  	if (err) {
>  		dev_err(chan->dev, "Cannot stop channel %p: %x\n",
> -- 
> 2.7.4
> 

-- 
~Vinod
--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux PCI]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux