Skip to content

Commit dde61c4

Browse files
ConchuODwsakernel
authored andcommitted
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: Andreas Buerkler <andreas.buerkler@enclustra.com> Fixes: 64a6f1c ("i2c: add support for microchip fpga i2c controllers") Tested-by: Lewis Hanly <lewis.hanly@microchip.com> Signed-off-by: Conor Dooley <conor.dooley@microchip.com> [wsa: fixed typos in commit message] Signed-off-by: Wolfram Sang <wsa@kernel.org>
1 parent 0a0b80a commit dde61c4

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/i2c/busses/i2c-microchip-corei2c.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ static void mchp_corei2c_empty_rx(struct mchp_corei2c_dev *idev)
206206
idev->msg_len--;
207207
}
208208

209-
if (idev->msg_len == 0) {
209+
if (idev->msg_len <= 1) {
210210
ctrl = readb(idev->base + CORE_I2C_CTRL);
211211
ctrl &= ~CTRL_AA;
212212
writeb(ctrl, idev->base + CORE_I2C_CTRL);

0 commit comments

Comments
 (0)