Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Haavard Skinnemoen and committed by
Linus Torvalds
e683b423 e84956f9

+4 -2
+4 -2
drivers/mmc/host/atmel-mci.c
··· 426 426 host->sg = NULL; 427 427 host->data = data; 428 428 429 - mci_writel(host, BLKR, MCI_BCNT(data->blocks) 430 - | MCI_BLKLEN(data->blksz)); 431 429 dev_vdbg(&mmc->class_dev, "BLKR=0x%08x\n", 432 430 MCI_BCNT(data->blocks) | MCI_BLKLEN(data->blksz)); 433 431 ··· 481 483 if (data->blocks > 1 && data->blksz & 3) 482 484 goto fail; 483 485 atmci_set_timeout(host, data); 486 + 487 + /* Must set block count/size before sending command */ 488 + mci_writel(host, BLKR, MCI_BCNT(data->blocks) 489 + | MCI_BLKLEN(data->blksz)); 484 490 } 485 491 486 492 iflags = MCI_CMDRDY;