i2c: designware: fix controller is holding SCL low while ENABLE bit is disabled
authorKimriver Liu <kimriver.liu@siengine.com>
Fri, 13 Sep 2024 03:31:46 +0000 (11:31 +0800)
committerAndi Shyti <andi.shyti@kernel.org>
Tue, 24 Sep 2024 14:23:25 +0000 (16:23 +0200)
commit5d69d5a00f80488ddcb4dee7d1374a0709398178
tree2c0e5dc01b2fc3492a2b68941a41fa83f2fd9f22
parent4e2c9cd7dce6c7480f236c3ead196ff4e92ed597
i2c: designware: fix controller is holding SCL low while ENABLE bit is disabled

It was observed that issuing the ABORT bit (IC_ENABLE[1]) will not
work when IC_ENABLE is already disabled.

Check if the ENABLE bit (IC_ENABLE[0]) is disabled when the controller
is holding SCL low. If the ENABLE bit is disabled, the software needs
to enable it before trying to issue the ABORT bit. otherwise,
the controller ignores any write to ABORT bit.

These kernel logs show up whenever an I2C transaction is
attempted after this failure.
i2c_designware e95e0000.i2c: timeout waiting for bus ready
i2c_designware e95e0000.i2c: timeout in disabling adapter

The patch fixes the issue where the controller cannot be disabled
while SCL is held low if the ENABLE bit is already disabled.

Fixes: 2409205acd3c ("i2c: designware: fix __i2c_dw_disable() in case master is holding SCL low")
Signed-off-by: Kimriver Liu <kimriver.liu@siengine.com>
Cc: <stable@vger.kernel.org> # v6.6+
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
drivers/i2c/busses/i2c-designware-common.c
drivers/i2c/busses/i2c-designware-core.h
drivers/i2c/busses/i2c-designware-master.c