]> git.sur5r.net Git - u-boot/commit
mmc: sdhci: Wait for SDHCI_INT_DATA_END when transferring.
authorAlex Deymo <deymo@google.com>
Sun, 2 Apr 2017 08:24:34 +0000 (01:24 -0700)
committerJaehoon Chung <jh80.chung@samsung.com>
Fri, 14 Apr 2017 06:23:14 +0000 (15:23 +0900)
commit7dde50d70787eb2faeced82d0c025762b12363ea
tree317c0770a9ef1b25f1f9ddac143a40d93d08f0e5
parent4db2b61fcf206cb45753cd1f988a9b0aad92b561
mmc: sdhci: Wait for SDHCI_INT_DATA_END when transferring.

sdhci_transfer_data() function transfers the blocks passed up to the
number of blocks defined in mmc_data, but returns immediately once all
the blocks are transferred, even if the loop exit condition is not met
(bit SDHCI_INT_DATA_END set in the STATUS word).

When doing multiple writes to mmc, returning right after the last block
is transferred can cause the write to fail when sending the
MMC_CMD_STOP_TRANSMISSION command right after the
MMC_CMD_WRITE_MULTIPLE_BLOCK command, leaving the mmc driver in an
unconsistent state until reboot. This error was observed in the rpi3
board.

This patch waits for the SDHCI_INT_DATA_END bit to be set even after
sending all the blocks.

Test: Reliably wrote 2GiB of data to mmc in a rpi3.

Signed-off-by: Alex Deymo <deymo@google.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/mmc/sdhci.c