[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aRZQfqFjDNds19by@aurel32.net>
Date: Thu, 13 Nov 2025 22:41:18 +0100
From: Aurelien Jarno <aurelien@...el32.net>
To: Troy Mitchell <troy.mitchell@...ux.spacemit.com>
Cc: Andi Shyti <andi.shyti@...nel.org>, Yixun Lan <dlan@...too.org>,
Alex Elder <elder@...cstar.com>,
Michael Opdenacker <michael.opdenacker@...tcommit.com>,
Troy Mitchell <troymitchell988@...il.com>,
linux-i2c@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-riscv@...ts.infradead.org, spacemit@...ts.linux.dev
Subject: Re: [PATCH v2] i2c: spacemit: fix detect issue
On 2025-11-13 21:21, Troy Mitchell wrote:
> This commit addresses two issues causing i2c detect to fail.
>
> The identified issues are:
>
> 1. Incorrect error handling for BED (Bus Error No ACK/NAK):
> Before this commit, Both ALD (Arbitration Loss Detected) and
> BED returned -EAGAIN.
> 2. Missing interrupt status clear after initialization in xfer():
> On the K1 SoC, simply fixing the first issue changed the error
> from -EAGAIN to -ETIMEOUT. Through tracing, it was determined that
> this is likely due to MSD (Master Stop Detected) latency issues.
>
> That means the MSD bit in the ISR may still be set on the next transfer.
> As a result, the controller won't work — we can see from the scope that
> it doesn't issue any signal.
> (This only occurs during rapid consecutive I2C transfers.
> That explains why the issue only shows up with i2cdetect.)
>
> With these two fixes, i2c device detection now functions correctly on the K1 SoC.
>
> Fixes: 5ea558473fa31 ("i2c: spacemit: add support for SpacemiT K1 SoC")
> Tested-by: Aurelien Jarno <aurelien@...el32.net>
> Signed-off-by: Troy Mitchell <troy.mitchell@...ux.spacemit.com>
> ---
> Changelog in v2:
> - handle ALD and BED errors separately in spacemit_i2c_handle_err()
> - move clear_int_status() above spacemit_i2c_init()
> - move clear_int_status() from xfer() into spacemit_i2c_init()
> - Link to v1: https://lore.kernel.org/all/20251103-fix-k1-detect-failure-v1-1-bb07a8d7de7c@linux.spacemit.com/
> ---
> drivers/i2c/busses/i2c-k1.c | 19 +++++++++++++------
> 1 file changed, 13 insertions(+), 6 deletions(-)
Tested-by: Aurelien Jarno <aurelien@...el32.net>
Reviewed-by: Aurelien Jarno <aurelien@...el32.net>
--
Aurelien Jarno GPG: 4096R/1DDD8C9B
aurelien@...el32.net http://aurel32.net
Powered by blists - more mailing lists