[PATCH v2 2/6] i2c: spacemit: remove stop function to avoid bus error
Aurelien Jarno
aurelien at aurel32.net
Thu Sep 25 13:11:41 PDT 2025
On 2025-09-25 10:02, Troy Mitchell wrote:
> 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 at linux.spacemit.com>
> ---
> drivers/i2c/busses/i2c-k1.c | 26 +++++++-------------------
> 1 file changed, 7 insertions(+), 19 deletions(-)
Reviewed-by: Aurelien Jarno <aurelien at aurel32.net>
--
Aurelien Jarno GPG: 4096R/1DDD8C9B
aurelien at aurel32.net http://aurel32.net
More information about the linux-riscv
mailing list