[PATCH] mmci: calculate remaining bytes at error correctly

Russell King - ARM Linux linux at arm.linux.org.uk
Thu Jan 27 11:36:43 EST 2011


On Thu, Jan 27, 2011 at 03:14:26PM +0100, Linus Walleij wrote:
> The MMCIDATACNT register contain the number of byte left at error
> not the number of words, so loose the << 2 thing. Further if CRC
> fails on the first block, we may end up with a negative number
> of transferred bytes which is not good, and the formula was in
> wrong order.

Hmm.

In order to have a CRC error, you must have transferred one block through
the FIFO.  We might read the data counter before one block has been fully
transferred.

So, maybe we want:

	host->data_xfered = ((success - 1) / data->blksz) * data->blksz;

instead?



More information about the linux-arm-kernel mailing list