Re: [PATCH v8] i2c: designware: fix master is holding SCL low while ENABLE bit is disabled

From: Jarkko Nikula
Date: Tue Sep 10 2024 - 05:03:23 EST


On 9/10/24 9:13 AM, Kimriver Liu wrote:
It was observed issuing ABORT bit(IC_ENABLE[1]) will not work when
IC_ENABLE is already disabled.

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

Signed-off-by: Kimriver Liu <kimriver.liu@xxxxxxxxxxxx>
Reviewed-by: Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx>

---
V7->V8:
1.calculate this delay based on the actual speed in use
fsleep(DIV_ROUND_CLOSEST_ULL(10 * MICRO, t->bus_freq_hz))
2. add Reviewed-by: Mika Westerberg<mika.westerberg@xxxxxxxxxxxxxxx>
V6->V7:
1. add Subject versioning [PATCH v7]
2. change fsleep(25) to usleep_range(25, 250)
3. Add macro definition DW_iC_ENABLE_ENABLE to fix compile errors
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes:https://lore.kernel.org/oe-kbuild-all/202409082011.9JF6aYsk-lkp@xxxxxxxxx/
4. base: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=master
V5->V6: restore i2c_dw_is_master_idling() function checking
V4->V5: delete master idling checking
V3->V4:
1. update commit messages and add patch version and changelog
2. move print the error message in i2c_dw_xfer
V2->V3: change (!enable) to (!(enable & DW_IC_ENABLE_ENABLE))
V1->V2: used standard words in function names and addressed review comments

link to V1:
https://lore.kernel.org/lkml/20240904064224.2394-1-kimriver.liu@xxxxxxxxxxxx/
---
drivers/i2c/busses/i2c-designware-common.c | 13 +++++++++++++
drivers/i2c/busses/i2c-designware-core.h | 1 +
drivers/i2c/busses/i2c-designware-master.c | 22 ++++++++++++++++++++++
3 files changed, 36 insertions(+)

Acked-by: Jarkko Nikula <jarkko.nikula@xxxxxxxxxxxxxxx>