• Jon Povey's avatar
    i2c-davinci: Fix race when setting up for TX · 4bba0fd8
    Jon Povey authored
    When setting up to transmit, a race exists between the ISR and
    i2c_davinci_xfer_msg() trying to load the first byte and adjust counters.
    This is mostly visible for transmits > 1 byte long.
    
    The hardware starts sending immediately that MDR is loaded. IMR trickery
    doesn't work because if we start sending, finish the first byte and an
    XRDY event occurs before we load IMR to unmask it, we never get an
    interrupt, and we timeout.
    
    Move the MDR load after DXR,IMR loads to avoid this race without locking.
    
    Tested on DM355 connected to Techwell TW2836 and Wolfson WM8985
    Signed-off-by: default avatarJon Povey <jon.povey@racelogic.co.uk>
    Signed-off-by: default avatarBen Dooks <ben-linux@fluff.org>
    4bba0fd8
i2c-davinci.c 20.7 KB