]> git.baikalelectronics.ru Git - kernel.git/commit
i2c: omap: Trigger bus recovery in lockup case
authorClaudio Foellmi <claudio.foellmi@ergon.ch>
Wed, 4 Oct 2017 09:43:45 +0000 (11:43 +0200)
committerWolfram Sang <wsa@the-dreams.de>
Mon, 30 Oct 2017 14:18:31 +0000 (15:18 +0100)
commit0867f1e6f6b002386ecb59328a4f0afedf5cacc3
tree3752c6741d03204705ee9764649af1a9b10668ad
parent275ca7eea2b71545ebfad0ab8b456cdeec7d5ded
i2c: omap: Trigger bus recovery in lockup case

A very conservative check for bus activity (to prevent interference
in multimaster setups) prevented the bus recovery methods from being
triggered in the case that SDA or SCL was stuck low.
This defeats the purpose of the recovery mechanism, which was introduced
for exactly this situation (a slave device keeping SDA pulled down).

Also added a check to make sure SDA is low before attempting recovery.
If SDA is not stuck low, recovery will not help, so we can skip it.

Note that bus lockups can persist across reboots. The only other options
are to reset or power cycle the offending slave device, and many i2c
slaves do not even have a reset pin.

If we see that one of the lines is low for the entire timeout duration,
we can actually be sure that there is no other master driving the bus.
It is therefore save for us to attempt a bus recovery.

Signed-off-by: Claudio Foellmi <claudio.foellmi@ergon.ch>
Tested-by: Vignesh R <vigneshr@ti.com>
Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
[wsa: fixed one return code to -EBUSY]
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/busses/i2c-omap.c