]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
mmc: mxcmmc: fix bug that may block a data transfer forever
authorJavier Martin <javier.martin@vista-silicon.com>
Fri, 7 Sep 2012 10:43:37 +0000 (10:43 +0000)
committerChris Ball <cjb@laptop.org>
Wed, 3 Oct 2012 14:05:24 +0000 (10:05 -0400)
commitf6ad0a481342223b2e7ae9f55b154e14f1391ada
tree94559fe56544dae3fd145547da5536a5f002b7aa
parentc4c8eeb4df00aabb641553d6fbcd46f458e56cd9
mmc: mxcmmc: fix bug that may block a data transfer forever

The problem can be easily reproduced using a script that loops
copying a file in an SD card to another place in the same SD card
and its related to read transfers. This only happens with DMA enabled.

This is related to the fact that, when reading, an MMC irq signals
the fact that all data from the SD card has been copied to the
internal buffers. However, it doesn't signal whether the DMA transfer
that is in charge of moving data from these internal buffers to RAM
has finished or not. Thus, calling dmaengine_terminate_all() in the
MMC irq routine can cancel an ongoing DMA transfer leaving some data
in the internal buffers that produces an accumulative effect which,
in the end, blocks a read data transfer forever.

The following patch watches DMA irq for reading and MMC irqs for
writing transfers. The 'dangerous' usage of dmaengine_terminate_all()
is removed and a timeout of 10 seconds is added so that the MMC won't
block forever anymore.

Signed-off-by: Javier Martin <javier.martin@vista-silicon.com>
Reviewed-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Chris Ball <cjb@laptop.org>
drivers/mmc/host/mxcmmc.c