]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
mmc: tmio: ensure end of DMA and SD access are in sync
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Fri, 17 Feb 2017 18:22:41 +0000 (19:22 +0100)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 24 Apr 2017 19:41:14 +0000 (21:41 +0200)
commit52ad9a8e854ca13151f4af8140297f73d49e318a
tree0d623e49de4a6b02f452e3f48dc0ff8452eac710
parent21b22284619bbb201775c125af53f2834eb91674
mmc: tmio: ensure end of DMA and SD access are in sync

The current code assumes that DMA is finished before SD access end is
flagged. Thus, it schedules the 'dma_complete' tasklet in the SD card
interrupt routine when DATAEND is set. The assumption is not safe,
though. Even by mounting an SD card, it can be seen that sometimes DMA
complete is first, sometimes DATAEND. It seems they are usually close
enough timewise to not cause problems. However, a customer reported that
with CMD53 sometimes things really break apart. As a result, the BSP has
a patch which introduces flags for both events and makes sure both flags
are set before scheduling the tasklet. The customer accepted the patch,
yet it doesn't seem a proper upstream solution to me.

This patch refactors the code to replace the tasklet with already
existing and more lightweight mechanisms. First of all, we set the
callback in a DMA descriptor to automatically get notified when DMA is
done. In the callback, we then use a completion to make sure the SD
access has already ended. Then, we proceed as before.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/tmio_mmc.h
drivers/mmc/host/tmio_mmc_dma.c
drivers/mmc/host/tmio_mmc_pio.c