Skip to content

Commit 02fe0fb

Browse files
Ondrej Jirmanwsakernel
authored andcommitted
i2c: rk3x: Handle a spurious start completion interrupt flag
In a typical read transfer, start completion flag is being set after read finishes (notice ipd bit 4 being set): trasnfer poll=0 i2c start rk3x-i2c fdd40000.i2c: IRQ: state 1, ipd: 10 i2c read rk3x-i2c fdd40000.i2c: IRQ: state 2, ipd: 1b i2c stop rk3x-i2c fdd40000.i2c: IRQ: state 4, ipd: 33 This causes I2C transfer being aborted in polled mode from a stop completion handler: trasnfer poll=1 i2c start rk3x-i2c fdd40000.i2c: IRQ: state 1, ipd: 10 i2c read rk3x-i2c fdd40000.i2c: IRQ: state 2, ipd: 0 rk3x-i2c fdd40000.i2c: IRQ: state 2, ipd: 1b i2c stop rk3x-i2c fdd40000.i2c: IRQ: state 4, ipd: 13 i2c stop rk3x-i2c fdd40000.i2c: unexpected irq in STOP: 0x10 Clearing the START flag after read fixes the issue without any obvious side effects. This issue was dicovered on RK3566 when adding support for powering off the RK817 PMIC. Signed-off-by: Ondrej Jirman <[email protected]> Reviewed-by: John Keeping <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent 1229f82 commit 02fe0fb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/i2c/busses/i2c-rk3x.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,8 +423,8 @@ static void rk3x_i2c_handle_read(struct rk3x_i2c *i2c, unsigned int ipd)
423423
if (!(ipd & REG_INT_MBRF))
424424
return;
425425

426-
/* ack interrupt */
427-
i2c_writel(i2c, REG_INT_MBRF, REG_IPD);
426+
/* ack interrupt (read also produces a spurious START flag, clear it too) */
427+
i2c_writel(i2c, REG_INT_MBRF | REG_INT_START, REG_IPD);
428428

429429
/* Can only handle a maximum of 32 bytes at a time */
430430
if (len > 32)

0 commit comments

Comments
 (0)