aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorConor Dooley <conor.dooley@microchip.com>2022-10-26 08:49:19 +0100
committerHeiko Schocher <hs@denx.de>2022-11-14 07:21:58 +0100
commit6d133b31580a90e24fe95292a3e55aabe0fcc2da (patch)
tree6ec8a6862d2a669dfd7f66dc9f889c042c75d261 /drivers
parent95b22bd6dcf198340b0c40a906a463064c215b0c (diff)
downloadu-boot-6d133b31580a90e24fe95292a3e55aabe0fcc2da.zip
u-boot-6d133b31580a90e24fe95292a3e55aabe0fcc2da.tar.gz
u-boot-6d133b31580a90e24fe95292a3e55aabe0fcc2da.tar.bz2
i2c: microchip: 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: 0dc0d1e094 ("i2c: Add Microchip PolarFire SoC I2C driver") Signed-off-by: Conor Dooley <conor.dooley@microchip.com> Reviewed-by: Padmarao Begari <padmarao.begari@microchip.com> Reviewed-by: Heiko Schocher <hs@denx.de> Removed Tag by hs: Fixes: 0190d48488 ("i2c: microchip: fix ack sending logic")
Diffstat (limited to 'drivers')
-rw-r--r--drivers/i2c/i2c-microchip.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/i2c/i2c-microchip.c b/drivers/i2c/i2c-microchip.c
index 3a27459..d82b80f 100644
--- a/drivers/i2c/i2c-microchip.c
+++ b/drivers/i2c/i2c-microchip.c
@@ -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);