[PATCH] mmci: calculate remaining bytes at error correctly

Linus Walleij linus.walleij at linaro.org
Mon Jan 31 08:53:32 EST 2011

On Mon, Jan 31, 2011 at 11:40 AM, Russell King - ARM Linux <
linux at arm.linux.org.uk> wrote:

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.

Yes I get it now, well, what we do is essentially create three state
variables that are all checked at end of DMA (by adding a
DMA termination callback), end of PIO or DATAEND IRQ arrival.
So a little bit like:

if (dataend && (pio_end || dma_end))

I'll cook up some patch ASAP, just need to backport some
stuff on top of your latest MMCI patches.

Linus Walleij
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20110131/8faa2c07/attachment.html>

More information about the linux-arm-kernel mailing list