• James Hogan's avatar
    mmc: dw_mmc: clear TXDR/RXDR ints before enabling · b40af3aa
    James Hogan authored
    DMA is only used for transactions exceeding a certain length, otherwise
    PIO is used. The TXDR and RXDR interrupts are masked when in DMA mode
    but still fire. When switching to PIO mode (e.g. to get SCR field when
    an SD card is inserted) these interrupts are not cleared and so they
    trigger the ISR as soon as they are unmasked. If the previous DMA did a
    write, then the ISR will handle the TXDR interrupt even if the
    transaction is a read, completing the transaction without modifying the
    read buffer.
    
    This is fixed primarily by clearing these two interrupts before
    unmasking them when setting up PIO mode, and also by making the ISR more
    robust by only handling TXDR/RXDR in the correct read/write direction.
    Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
    Acked-by: default avatarWill Newton <will.newton@imgtec.com>
    Signed-off-by: default avatarChris Ball <cjb@laptop.org>
    b40af3aa
dw_mmc.c 43.5 KB