i2c: cadence: keep bus_hold_flag unless I2C_M_NOSTART is set
When using i2c_smbus_read_byte_data to read one byte from a slave device, because of the commit d358def7 ("i2c: cadence: Fix the hold bit setting"), the transaction becomes: S Addr Wr [A] Comm [A] P S Addr Rd [A] [Data] NA P ^ CR_HOLD bit as 0 This will result that the read operation fails and will read "0xff" from the slave device. In the SMBus protocol, it stipulates that it must follow that command with a repeated START condition as below: S Addr Wr [A] Comm [A] Sr Addr Rd [A] [Data] NA P So add a check if I2C_M_NOSTART is set in flags. If set, clear the CR_HOLD bit, or else keep CR_HOLD bit to be 1 to make sure that the read operation begins with a repeated START. Signed-off-by: Quanyang Wang <quanyang.wang@windriver.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
parent
d26d99cd
Please register or sign in to comment