Skip to content
  • Theodor-Adrian Stana's avatar
    wb_i2c_bridge: Fix error in state-machine · 46e0f6dc
    Theodor-Adrian Stana authored and Dimitris Lampridis's avatar Dimitris Lampridis committed
    The main state machine had an error whereby the wb_cyc and wb_stb
    outputs were not assigned in the IDLE state.
    
    This manifested itself as follows (output from telnet console):
    
    %> writereg 1 100 0 # read to illegal address
      Not acknowledged!
    %> readreg 1 4 # read from legal address returns NACK
      Not acknowledged
    %> readreg 1 4 # next read from legal address returns right data
      Read data: 01234567
    
    The bug was because the first writereg started a WB transfer from
    an unexisting address, threw an error and returned to IDLE without
    releasing the wb_cyc and wb_stb outputs in the process. This meant
    that on the readreg command, the WB write access would still be in
    progress and only on the readreg command, an error would clear the
    wb_cyc and wb_stb, which released the transfer.
    
    The error has been fixed by placing the clearing of wb_cyc and wb_stb
    in the IDLE state.
    46e0f6dc