atmel-mci: Initialize BLKR before sending data transfer command
authorHaavard Skinnemoen <haavard.skinnemoen@atmel.com>
Fri, 3 Oct 2008 12:46:17 +0000 (14:46 +0200)
committerHaavard Skinnemoen <haavard.skinnemoen@atmel.com>
Sun, 5 Oct 2008 18:39:20 +0000 (20:39 +0200)
commita252e3e35ef8144fb772da70bb93c99a1486097a
tree0609ff242637015e0e171860bfd6d60564c351c2
parentfec6ed1d1f9b78a6acb4a3eb2c46c812ac2e96f0
atmel-mci: Initialize BLKR before sending data transfer command

The atmel-mci driver sometimes fails data transfers like this:

   mmcblk0: error -5 transferring data
   end_request: I/O error, dev mmcblk0, sector 2749769
   end_request: I/O error, dev mmcblk0, sector 2749777

It turns out that this might be caused by the BLKR register (which
contains the block size and the number of blocks being transfered) being
initialized too late. This patch moves the initialization of BLKR so
that it contains the correct value before the block transfer command is
sent.

This error is difficult to reproduce, but if you insert a long delay
(mdelay(10) or thereabouts) between the calls to atmci_start_command()
and atmci_submit_data(), all transfers seem to fail without this patch,
while I haven't seen any failures with this patch.

Reported-by: Hein_Tibosch <hein_tibosch@yahoo.es>
Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
drivers/mmc/host/atmel-mci.c