linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] mmci: calculate remaining bytes at error correctly
Date: Mon, 31 Jan 2011 10:40:09 +0000	[thread overview]
Message-ID: <20110131104009.GC8948@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <AANLkTinBbXN-fxppo1Pa33DxiS6QYSdwqFsadFDxmPPy@mail.gmail.com>

On Mon, Jan 31, 2011 at 11:31:11AM +0100, Linus Walleij wrote:
> 2011/1/31 Russell King - ARM Linux <linux@arm.linux.org.uk>:
> >> > - ? ? ? if (status & MCI_DATAEND) {
> >> > + ? ? ? if (status & MCI_DATAEND || data->error) {
> >> > ? ? ? ? ? ? ? ?mmci_stop_data(host);
> >>
> >> The hardware always sets the MCI_DATAEND bit if there is
> >> some error, so these flags always appear simultaneously, but
> >> it doesn't hurt to take some extra precaution, so
> >
> > The hardware may do, but you won't see that here. ?When we setup a
> > transfer, we do this:
> >
> > ? ? ? ?writel(readl(base + MMCIMASK0) & ~MCI_DATAENDMASK, base + MMCIMASK0);
> 
> Ah! I get it.
> 
> We've actually played around with that, having MCI_DATAEND on all the
> time, it's not necessary any more since we're not using the blockend IRQ
> and they cannot race, so we can take a little bit of quirking out of it.
> But I'll get back on that issue.

Wrong issue.  What can happen is you receive the DATAEND interrupt,
which tears down the data side of the request, and starts the stop
command.  Meanwhile there's still data left in the FIFO for the CPU
to read.

I suspect there's a similar race between DMA and the host CPU too as
you leave the DATAEND interrupt on.  I suspect for reliability, we
need to have the DMA controller callback function in place to enable
the DATAEND interrupt.  Or something like that.

  reply	other threads:[~2011-01-31 10:40 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-27 14:14 [PATCH] mmci: calculate remaining bytes at error correctly Linus Walleij
2011-01-27 16:36 ` Russell King - ARM Linux
2011-01-27 16:43   ` Linus Walleij
2011-01-27 16:47     ` Russell King - ARM Linux
2011-01-30 21:28 ` Russell King - ARM Linux
2011-01-30 21:29   ` Russell King - ARM Linux
2011-01-31 10:24     ` Linus Walleij
2011-02-03  0:30       ` Russell King - ARM Linux
2011-02-03 14:00         ` Russell King - ARM Linux
2011-02-04 13:24           ` Linus Walleij
2011-01-31 10:17   ` Linus Walleij
2011-01-31 10:27     ` Russell King - ARM Linux
2011-01-31 10:31       ` Linus Walleij
2011-01-31 10:40         ` Russell King - ARM Linux [this message]
2011-01-31 13:53           ` Linus Walleij
2011-01-31 14:00             ` Russell King - ARM Linux
2011-01-31 12:00   ` Sergei Shtylyov
2011-01-31 12:25     ` Russell King - ARM Linux
2011-01-31 12:31       ` Sergei Shtylyov
2011-02-01 23:40         ` Russell King - ARM Linux
  -- strict thread matches above, loose matches on Subject: below --
2011-01-27 14:02 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=20110131104009.GC8948@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --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).