linux-stable/drivers/i2c
Ondrej Jirman 7bcb50fff9 i2c: rk3x: Handle a spurious start completion interrupt flag
[ Upstream commit 02fe0fbd8a ]

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 <megous@megous.com>
Reviewed-by: John Keeping <john@metanate.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-12-22 09:17:58 +01:00
..
algos i2c: algo: pca: Reapply i2c bus settings after reset 2020-09-23 10:46:34 +02:00
busses i2c: rk3x: Handle a spurious start completion interrupt flag 2021-12-22 09:17:58 +01:00
muxes i2c: mux: demux-pinctrl: Fix an error handling path in 'i2c_demux_pinctrl_probe()' 2020-05-27 16:42:52 +02:00
i2c-boardinfo.c
i2c-core-acpi.c i2c: acpi: fix resource leak in reconfiguration device addition 2021-10-17 10:08:33 +02:00
i2c-core-base.c i2c: core: Disable client irq on reboot/shutdown 2021-07-20 16:17:51 +02:00
i2c-core-of.c i2c: core: fix use after free in of_i2c_notify 2019-12-17 20:37:32 +01:00
i2c-core-slave.c i2c: slave: add sanity check when unregistering 2020-08-21 09:47:59 +02:00
i2c-core-smbus.c
i2c-core.h
i2c-dev.c i2c: dev: zero out array used for i2c reads from userspace 2021-08-26 08:37:00 -04:00
i2c-mux.c
i2c-slave-eeprom.c
i2c-smbus.c
i2c-stub.c
Kconfig
Makefile