linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linus.walleij@linaro.org (Linus Walleij)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] mmci: sync DATAEND irq with dma transfer done
Date: Wed, 20 Apr 2011 18:29:40 +0200	[thread overview]
Message-ID: <BANLkTimrsn1MxY+L7_yt0b1LXmaXxpMHPg@mail.gmail.com> (raw)
In-Reply-To: <20110419120344.GG22799@n2100.arm.linux.org.uk>

On Tue, Apr 19, 2011 at 2:03 PM, Russell King - ARM Linux
<linux@arm.linux.org.uk> wrote:
> On Tue, Apr 19, 2011 at 02:00:17PM +0200, Linus Walleij wrote:
>>
>> On a high-speeded ux500 the DATAEND IRQ will assert before the
>> DMA data is actually finished, thus if we start hammering in the next
>> request we break an ongoing transfer. :-(
>
> Yes, you've already said that in the past. ?And this is partly why we
> have this code in the dma unmap:
>
> ? ? ? ?/* Wait up to 1ms for the DMA to complete */
> ? ? ? ?for (i = 0; ; i++) {
> ? ? ? ? ? ? ? ?status = readl(host->base + MMCISTATUS);
> ? ? ? ? ? ? ? ?if (!(status & MCI_RXDATAAVLBLMASK) || i >= 100)
> ? ? ? ? ? ? ? ? ? ? ? ?break;
> ? ? ? ? ? ? ? ?udelay(10);
> ? ? ? ?}
>
> So, we wait until the DMA has drained the FIFO before we fire off the
> next request - or even unmap the DMA buffer. ?Should the DMA fail to
> drain the FIFO in a reasonable time, we timeout and disable DMA.
>
> Again, I ask, why is this not sufficient to cover the case where the
> data end IRQ occurs before the DMA engine has completed the transfer -
> which is likely to take a very short time indeed.

It doesn't help, we have really tested this and at high speed transfers
(especially if we use Per Fridens speed-up patches) apparently
the flag RXDATAAVLBL goes to zero before the block is really
finished.

My rough guess (after looking at the VHDL code) is that
RXDATAVLBL flag goes low when the FIFO is empty, but that
doesn't mean that the DMA handshake logic is out of its send/recieve
state and thus we screw it up if we hammer in another transfer before
it has had time to deassert the single/burst request signals and go to
idle state. This can only be seen by the side effect of the DMA
transfer actually terminating, and the DMA engine calling its
callback.

Our version is not that far away from the pure ARM versions
so I think this problem is actually present in an unmodified
PL180 as well.

Yours,
Linus Walleij

  reply	other threads:[~2011-04-20 16:29 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-19  9:02 [PATCH] mmci: sync DATAEND irq with dma transfer done Linus Walleij
2011-04-19  9:20 ` Russell King - ARM Linux
2011-04-19 12:00   ` Linus Walleij
2011-04-19 12:03     ` Russell King - ARM Linux
2011-04-20 16:29       ` Linus Walleij [this message]
2011-04-20 16:46         ` Vitaly Wool
2011-04-20 17:17           ` Linus Walleij
2011-04-20 17:58             ` Vitaly Wool
2011-04-20 20:11               ` Linus Walleij
2011-04-28 17:03         ` Russell King - ARM Linux
2011-04-28 22:24           ` Martin Furmanski
2011-05-11 20:13             ` Linus Walleij
2011-04-29 12:44           ` Ulf Hansson
2011-04-29 13:49             ` Russell King - ARM Linux
2011-05-06  8:13               ` Ulf Hansson
2011-05-12  8:36         ` Per Forlin
2011-05-12 13:15           ` Linus Walleij

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=BANLkTimrsn1MxY+L7_yt0b1LXmaXxpMHPg@mail.gmail.com \
    --to=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).