Commit dde61c48 authored by Conor Dooley's avatar Conor Dooley Committed by Wolfram Sang

i2c: microchip-corei2c: fix erroneous late ack send

A late ack is currently being sent at the end of a transfer due to
incorrect logic in mchp_corei2c_empty_rx(). Currently the Assert Ack
bit is being written to the controller's control reg after the last
byte has been received, causing it to sent another byte with the ack.
Instead, the AA flag should be written to the control register when
the penultimate byte is read so it is sent out for the last byte.
Reported-by: default avatarAndreas Buerkler <andreas.buerkler@enclustra.com>
Fixes: 64a6f1c4 ("i2c: add support for microchip fpga i2c controllers")
Tested-by: default avatarLewis Hanly <lewis.hanly@microchip.com>
Signed-off-by: default avatarConor Dooley <conor.dooley@microchip.com>
[wsa: fixed typos in commit message]
Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
parent 0a0b80a4
......@@ -206,7 +206,7 @@ static void mchp_corei2c_empty_rx(struct mchp_corei2c_dev *idev)
idev->msg_len--;
}
if (idev->msg_len == 0) {
if (idev->msg_len <= 1) {
ctrl = readb(idev->base + CORE_I2C_CTRL);
ctrl &= ~CTRL_AA;
writeb(ctrl, idev->base + CORE_I2C_CTRL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment