i2c: spacemit: remove stop function to avoid bus error
authorTroy Mitchell <troy.mitchell@linux.spacemit.com>
Thu, 25 Sep 2025 02:02:26 +0000 (10:02 +0800)
committerWolfram Sang <wsa+renesas@sang-engineering.com>
Thu, 25 Sep 2025 21:15:00 +0000 (23:15 +0200)
commit445522fe7aad6131b2747ae8c76f77266054cd84
tree8aa0b8bd176d90ad72622b61b0c856543c92a5c8
parent41d6f90ef5dc2841bdd09817c63a3d6188473b9b
i2c: spacemit: remove stop function to avoid bus error

Previously, STOP handling was split into two separate steps:
  1) clear TB/STOP/START/ACK bits
  2) issue STOP by calling spacemit_i2c_stop()

This left a small window where the control register was updated
twice, which can confuse the controller. While this race has not
been observed with interrupt-driven transfers, it reliably causes
bus errors in PIO mode.

Inline the STOP sequence into the IRQ handler and ensure that
control register bits are updated atomically in a single writel().

Fixes: 5ea558473fa31 ("i2c: spacemit: add support for SpacemiT K1 SoC")
Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
drivers/i2c/busses/i2c-k1.c