• Roger Luethi's avatar
    [PATCH] Fix Tx engine race for good · 8332b1fc
    Roger Luethi authored
    It finally dawned on me how to eliminate the race I've been narrowing
    down with earlier patches: Instead of writing the command registers as
    one word, write them one at a time (as bytes). The race was for settings
    bits in ChipCmd and ChipCmd1 (0x09) against the chip clearing CmdTxOn
    which is in ChipCmd.
    
    In addition to writing single bytes, the fix requires a switch from
    using bit 5 in ChipCmd0 to bit 5 in ChipCmd1 (which is equivalent)
    to signal Tx demand.
    
    Also, don't restart Rx engine "pre-emptively" in rhine_rx, that's a
    sure way to race with the chip.
    
    Introduce RHINE_WAIT_FOR, a macro for small busy loops with primitive
    completion checking.
    Signed-off-by: default avatarRoger Luethi <rl@hellgate.ch>
    8332b1fc
via-rhine.c 53.7 KB