Skip to content

Commit

Permalink
i2c: microchip: fix erroneous late ack send
Browse files Browse the repository at this point in the history
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 <[email protected]>
Fixes: 0dc0d1e ("i2c: Add Microchip PolarFire SoC I2C driver")
Signed-off-by: Conor Dooley <[email protected]>
Reviewed-by: Padmarao Begari <[email protected]>
Reviewed-by: Heiko Schocher <[email protected]>

Removed Tag by hs: Fixes: 0190d48488 ("i2c: microchip: fix ack sending logic")
  • Loading branch information
ConchuOD authored and hsdenx committed Nov 14, 2022
1 parent 95b22bd commit 6d133b3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/i2c/i2c-microchip.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ static void mpfs_i2c_empty_rx(struct mpfs_i2c_bus *bus)
bus->msg_len--;
}

if (bus->msg_len == 0) {
if (bus->msg_len <= 1) {
ctrl = readl(bus->base + MPFS_I2C_CTRL);
ctrl &= ~CTRL_AA;
writel(ctrl, bus->base + MPFS_I2C_CTRL);
Expand Down

0 comments on commit 6d133b3

Please sign in to comment.