• Sifan Naeem's avatar
    i2c: img-scb: enable fencing for all versions of the ip · 0e59378b
    Sifan Naeem authored
    The code to read from the master read fifo, and write to the master
    write fifo, checks a bit in an SCB register before every byte to
    ensure that the fifo is not full (write fifo) or empty (read fifo).
    Due to clock domain crossing inside the SCB block the updated value
    of this bit is only visible after 2 cycles.
    
    The scb_wr_rd_fence() function does 2 dummy writes (to the read-only
    revision register), and it's called before reading from or writing to the
    fifos to ensure that subsequent reads of the fifo status bits do not read
    stale values.
    
    As the 2 dummy writes are required in all versions of the ip, the version
    check is dropped.
    
    Fixes: commit 27bce457 ("i2c: img-scb: Add Imagination Technologies I2C SCB driver")
    Signed-off-by: default avatarSifan Naeem <sifan.naeem@imgtec.com>
    Acked-by: default avatarJames Hogan <james.hogan@imgtec.com>
    Reviewed-by: default avatarJames Hartley <james.hartley@imgtec.com>
    Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
    0e59378b
i2c-img-scb.c 37.7 KB