Skip to content
  • Alex Deymo's avatar
    mmc: sdhci: Wait for SDHCI_INT_DATA_END when transferring. · 7dde50d7
    Alex Deymo authored and Jaehoon Chung's avatar Jaehoon Chung committed
    
    
    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: default avatarAlex Deymo <deymo@google.com>
    Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
    7dde50d7