Re: [PATCH 2/5] dmaengine: bcm2835: Fix abort of transactions

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

 



Hi Lukas,

> Lukas Wunner <lukas@xxxxxxxxx> hat am 22. Dezember 2018 um 08:28 geschrieben:
> 
> 
> ...
>  drivers/dma/bcm2835-dma.c | 33 +++------------------------------
>  1 file changed, 3 insertions(+), 30 deletions(-)
> 
> diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c
> index e94f41c56975..17bc7304db3a 100644
> --- a/drivers/dma/bcm2835-dma.c
> +++ b/drivers/dma/bcm2835-dma.c
> @@ -419,25 +419,11 @@ static int bcm2835_dma_abort(void __iomem *chan_base)
>  	writel(0, chan_base + BCM2835_DMA_CS);
>  
>  	/* Wait for any current AXI transfer to complete */
> -	while ((cs & BCM2835_DMA_ISPAUSED) && --timeout) {
> +	while ((readl(chan_base + BCM2835_DMA_CS) &
> +		BCM2835_DMA_WAITING_FOR_WRITES) && --timeout)
>  		cpu_relax();
> -		cs = readl(chan_base + BCM2835_DMA_CS);
> -	}
> -
> -	/* We'll un-pause when we set of our next DMA */
> -	if (!timeout)
> -		return -ETIMEDOUT;

i'm only sceptical about silently ignoring the timeout case. I prefer to have a comment explaining why we proceed with BCM2835_DMA_RESET in this case and some kind of error / debug message like below.

> -
> -	if (!(cs & BCM2835_DMA_ACTIVE))
> -		return 0;
> -
> -	/* Terminate the control block chain */
> -	writel(0, chan_base + BCM2835_DMA_NEXTCB);
> -
> -	/* Abort the whole DMA */
> -	writel(BCM2835_DMA_ABORT | BCM2835_DMA_ACTIVE,
> -	       chan_base + BCM2835_DMA_CS);
>  
> +	writel(BCM2835_DMA_RESET, chan_base + BCM2835_DMA_CS);
>  	return 0;
>  }
>  
> @@ -787,7 +773,6 @@ static int bcm2835_dma_terminate_all(struct dma_chan *chan)
>  	struct bcm2835_chan *c = to_bcm2835_dma_chan(chan);
>  	struct bcm2835_dmadev *d = to_bcm2835_dma_dev(c->vc.chan.device);
>  	unsigned long flags;
> -	int timeout = 10000;
>  	LIST_HEAD(head);
>  
>  	spin_lock_irqsave(&c->vc.lock, flags);
> @@ -802,18 +787,6 @@ static int bcm2835_dma_terminate_all(struct dma_chan *chan)
>  		vchan_terminate_vdesc(&c->desc->vd);
>  		c->desc = NULL;
>  		bcm2835_dma_abort(c->chan_base);
> -
> -		/* Wait for stopping */
> -		while (--timeout) {
> -			if (!(readl(c->chan_base + BCM2835_DMA_CS) &
> -						BCM2835_DMA_ACTIVE))
> -				break;
> -
> -			cpu_relax();
> -		}
> -
> -		if (!timeout)
> -			dev_err(d->ddev.dev, "DMA transfer could not be terminated\n");
>  	}
>  

Stefan



[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