From: Anand Moon <linux.amoon@gmail.com>
To: Andi Shyti <andi.shyti@kernel.org>
Cc: Heiko Stuebner <heiko@sntech.de>,
"moderated list:ARM/Rockchip SoC support"
<linux-arm-kernel@lists.infradead.org>,
"open list:ARM/Rockchip SoC support"
<linux-rockchip@lists.infradead.org>,
"open list:I2C SUBSYSTEM HOST DRIVERS"
<linux-i2c@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>,
David Wu <david.wu@rock-chips.com>
Subject: Re: [PATCH v2] i2c: rk3x: add support for SCL OE debounce and slave hold recovery
Date: Tue, 31 Mar 2026 18:48:10 +0530 [thread overview]
Message-ID: <CANAwSgRVXd4PLAV3NGVdmxcJUVe6UUs74HkRmOG7TkkoLBCFeg@mail.gmail.com> (raw)
In-Reply-To: <acaO5ouMmGA8-tqJ@zenone.zhora.eu>
Hi Andi,
Thanks for your review comments.
On Fri, 27 Mar 2026 at 19:43, Andi Shyti <andi.shyti@kernel.org> wrote:
>
> Hi Anand,
>
> ...
>
> > @@ -1125,6 +1141,17 @@ static int rk3x_i2c_xfer_common(struct i2c_adapter *adap,
> > }
> > }
> >
> > + /*
> > + * If a timeout occurred and the slave is holding SCL,
> > + * re-apply the timings/dividers to attempt recovery.
> > + */
> > + if (ret == -ETIMEDOUT && i2c->soc_data->has_scl_oe_debounce) {
> > + if (ipd & REG_INT_SLV_HDSCL) {
> > + dev_err(i2c->dev, "SCL hold by slave detected, resetting timings.\n");
> > + rk3x_i2c_adapt_div(i2c, clk_get_rate(i2c->clk));
>
> argh! this nests i2c->lock. rk3x_i2c_xfer_common() already holds
> it when calling rk3x_i2c_adapt_div().
I agree; the current implementation can lead to a deadlock.
To resolve this, I'll split the function into locked and unlocked variants.
Note that this deadlock only occurs if REG_INT_SLV_HDSCL is active in the
interrupt enable mask, as shown below:
static void rk3x_i2c_start(struct rk3x_i2c *i2c)
{
u32 val = i2c_readl(i2c, REG_CON) & REG_CON_TUNING_MASK;
+ u32 ien = REG_INT_START;
- i2c_writel(i2c, REG_INT_START, REG_IEN);
+ if(i2c->soc_data->has_scl_oe_debounce)
+ ien != REG_INT_SLV_HDSCL;
+
+ i2c_writel(i2c, ien, REG_IEN);
Thanks
-Anand
prev parent reply other threads:[~2026-03-31 13:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-21 10:51 Anand Moon
2026-03-27 14:13 ` Andi Shyti
2026-03-31 13:18 ` Anand Moon [this message]
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=CANAwSgRVXd4PLAV3NGVdmxcJUVe6UUs74HkRmOG7TkkoLBCFeg@mail.gmail.com \
--to=linux.amoon@gmail.com \
--cc=andi.shyti@kernel.org \
--cc=david.wu@rock-chips.com \
--cc=heiko@sntech.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.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
all inboxes | Powered by JetHome®