From: Stefan Wahren <stefan.wahren@i2se.com>
To: Lukas Wunner <lukas@wunner.de>
Cc: Frank Pavlic <f.pavlic@kunbus.de>,
Martin Sperl <kernel@martin.sperl.org>,
Florian Meier <florian.meier@koalo.de>,
dmaengine@vger.kernel.org, Eric Anholt <eric@anholt.net>,
linux-rpi-kernel@lists.infradead.org,
Vinod Koul <vkoul@kernel.org>
Subject: [2/5] dmaengine: bcm2835: Fix abort of transactions
Date: Fri, 28 Dec 2018 14:20:42 +0100 (CET) [thread overview]
Message-ID: <891495697.176697.1546003242696@email.ionos.de> (raw)
Hi Lukas,
> Lukas Wunner <lukas@wunner.de> 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
next reply other threads:[~2018-12-28 13:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-28 13:20 Stefan Wahren [this message]
-- strict thread matches above, loose matches on Subject: below --
2019-01-06 8:38 [2/5] dmaengine: bcm2835: Fix abort of transactions Lukas Wunner
2018-12-22 7:28 Lukas Wunner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=891495697.176697.1546003242696@email.ionos.de \
--to=stefan.wahren@i2se.com \
--cc=dmaengine@vger.kernel.org \
--cc=eric@anholt.net \
--cc=f.pavlic@kunbus.de \
--cc=florian.meier@koalo.de \
--cc=kernel@martin.sperl.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=lukas@wunner.de \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox