From: Mukesh Savaliya <mukesh.savaliya@oss.qualcomm.com>
To: Jonas Gorski <jonas.gorski@bisdn.de>,
Andi Shyti <andi.shyti@kernel.org>, Ray Jui <rjui@broadcom.com>,
Scott Branden <sbranden@broadcom.com>,
Kevin Cernekee <cernekee@chromium.org>,
Wolfram Sang <wsa@kernel.org>
Cc: linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] i2c: iproc: reset bus after timeout if START_BUSY is stuck
Date: Fri, 17 Jul 2026 15:10:01 +0530 [thread overview]
Message-ID: <eba6d3b3-b5ee-4543-a437-4e7c16c5653e@oss.qualcomm.com> (raw)
In-Reply-To: <20260717085507.34209-1-jonas.gorski@bisdn.de>
On 7/17/2026 2:25 PM, Jonas Gorski wrote:
> If a transaction times out, the START_BUSY signal can stay up, and
What's exactly START_BUSY signal
> subsequent transactaction attempts will fail as the bus is still
transactaction => transaction
> considered busy.
>
> I can easily trigger this by attempting to read from an address with no
> device, e.g. when running i2cdetect. After the first read times out, all
> subsequent read attempts return busy.
>
> To get to a working state again, the controller needs to be reset to
> clear the START_BUSY signal. So check for START_BUSY still asserted on a
> timeout, and do reset in case it is,
>
what's here after it is, ? wanted to end the statement ?
> This is also done by the original non-upstream iproc-smbus driver
> implementation [1].
>
> Works around situations like:
>
> bcm-iproc-2c 1803b000.i2c: transaction timed out
> bcm-iproc-2c 1803b000.i2c: bus is busy
> bcm-iproc-2c 1803b000.i2c: bus is busy
> bcm-iproc-2c 1803b000.i2c: bus is busy
> bcm-iproc-2c 1803b000.i2c: bus is busy
> bcm-iproc-2c 1803b000.i2c: bus is busy
> ...
>
> where the bus never recovers after a timeout.
isn't there a max retry count ?
>
[...]
> if (!time_left && !iproc_i2c->xfer_is_done) {
> + /*
> + * The controller may fail to clear START_BUSY after a timeout,
> + * reset the controller to recover in that case.
> + */
Make it simple ?
Recover controller if START_BUSY signal is high after timeout
> + if (!!(iproc_i2c_rd_reg(iproc_i2c, M_CMD_OFFSET) &
> + BIT(M_CMD_START_BUSY_SHIFT))) {
> + bcm_iproc_i2c_enable_disable(iproc_i2c, false);
> + bcm_iproc_i2c_init(iproc_i2c);
> + bcm_iproc_i2c_enable_disable(iproc_i2c, true);
> + }
> +
> /* flush both TX/RX FIFOs */
> val = BIT(M_FIFO_RX_FLUSH_SHIFT) | BIT(M_FIFO_TX_FLUSH_SHIFT);
> iproc_i2c_wr_reg(iproc_i2c, M_FIFO_CTRL_OFFSET, val);
next prev parent reply other threads:[~2026-07-17 9:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-17 8:55 Jonas Gorski
2026-07-17 9:40 ` Mukesh Savaliya [this message]
2026-07-17 11:08 ` Jonas Gorski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=eba6d3b3-b5ee-4543-a437-4e7c16c5653e@oss.qualcomm.com \
--to=mukesh.savaliya@oss.qualcomm.com \
--cc=andi.shyti@kernel.org \
--cc=cernekee@chromium.org \
--cc=jonas.gorski@bisdn.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rjui@broadcom.com \
--cc=sbranden@broadcom.com \
--cc=wsa@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox