From: Mukesh Kumar Savaliya <quic_msavaliy@quicinc.com>
To: <mohammed.0.elbadry@gmail.com>
Cc: Tali Perry <tali.perry1@gmail.com>,
Avi Fishman <avifishman70@gmail.com>,
Tomer Maimon <tmaimon77@gmail.com>,
Patrick Venture <venture@google.com>,
Nancy Yuen <yuenn@google.com>,
Benjamin Fair <benjaminfair@google.com>,
Andi Shyti <andi.shyti@kernel.org>, <openbmc@lists.ozlabs.org>,
<linux-i2c@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4] i2c: npcm: Add clock toggle recovery
Date: Sat, 29 Mar 2025 14:45:38 +0530 [thread overview]
Message-ID: <e09c0d10-60f3-480b-a3f9-654ee2f14978@quicinc.com> (raw)
In-Reply-To: <20250328193252.1570811-1-mohammed.0.elbadry@gmail.com>
Looks good to me.
On 3/29/2025 1:02 AM, mohammed.0.elbadry@gmail.com wrote:
> From: Tali Perry <tali.perry1@gmail.com>
>
> During init of the bus, the module checks that the bus is idle.
> If one of the lines are stuck try to recover them first before failing.
> Sometimes SDA and SCL are low if improper reset occurs (e.g., reboot).
>
> Signed-off-by: Tali Perry <tali.perry1@gmail.com>
> Signed-off-by: Mohammed Elbadry <mohammed.0.elbadry@gmail.com>
Reviewed-by: Mukesh Kumar Savaliya <quic_msavaliy@quicinc.com>
> ---
> drivers/i2c/busses/i2c-npcm7xx.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm7xx.c
> index 2fe68615942e..caf9aa1e6319 100644
> --- a/drivers/i2c/busses/i2c-npcm7xx.c
> +++ b/drivers/i2c/busses/i2c-npcm7xx.c
> @@ -1967,10 +1967,14 @@ static int npcm_i2c_init_module(struct npcm_i2c *bus, enum i2c_mode mode,
>
> /* Check HW is OK: SDA and SCL should be high at this point. */
> if ((npcm_i2c_get_SDA(&bus->adap) == 0) || (npcm_i2c_get_SCL(&bus->adap) == 0)) {
> - dev_err(bus->dev, "I2C%d init fail: lines are low\n", bus->num);
> - dev_err(bus->dev, "SDA=%d SCL=%d\n", npcm_i2c_get_SDA(&bus->adap),
> - npcm_i2c_get_SCL(&bus->adap));
> - return -ENXIO;
> + dev_warn(bus->dev, " I2C%d SDA=%d SCL=%d, attempting to recover\n", bus->num,
> + npcm_i2c_get_SDA(&bus->adap), npcm_i2c_get_SCL(&bus->adap));
> + if (npcm_i2c_recovery_tgclk(&bus->adap)) {
> + dev_err(bus->dev, "I2C%d init fail: SDA=%d SCL=%d\n",
> + bus->num, npcm_i2c_get_SDA(&bus->adap),
> + npcm_i2c_get_SCL(&bus->adap));
> + return -ENXIO;
> + }
> }
>
> npcm_i2c_int_enable(bus, true);
next prev parent reply other threads:[~2025-03-29 9:16 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-24 20:32 [PATCH v1 0/1] i2c: npcm: Add clock toggle in case of stuck bus during init mohammed.0.elbadry
2025-03-24 20:32 ` [PATCH v1 1/1] i2c: npcm: Add clock toggle in case of stuck bus during init in npcm_i2c_init_module mohammed.0.elbadry
2025-03-24 20:58 ` [PATCH v2 0/1] i2c: npcm: Add clock toggle recovery mohammed.0.elbadry
2025-03-24 20:58 ` [PATCH v2 1/1] " mohammed.0.elbadry
2025-03-26 4:43 ` Mukesh Kumar Savaliya
2025-03-27 19:38 ` [PATCH v3] " mohammed.0.elbadry
2025-03-28 11:19 ` Mukesh Kumar Savaliya
2025-03-28 19:32 ` [PATCH v4] " mohammed.0.elbadry
2025-03-29 9:15 ` Mukesh Kumar Savaliya [this message]
2025-04-13 23:06 ` Andi Shyti
2025-04-14 0:07 ` Mohammed Elbadry
2025-04-17 16:11 ` Andi Shyti
2025-05-27 2:22 ` [PATCH v5] " Mohammed Elbadry
2025-05-27 3:05 ` Mohammed Elbadry
2025-03-26 4:45 ` [PATCH v2 0/1] " Mukesh Kumar Savaliya
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=e09c0d10-60f3-480b-a3f9-654ee2f14978@quicinc.com \
--to=quic_msavaliy@quicinc.com \
--cc=andi.shyti@kernel.org \
--cc=avifishman70@gmail.com \
--cc=benjaminfair@google.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mohammed.0.elbadry@gmail.com \
--cc=openbmc@lists.ozlabs.org \
--cc=tali.perry1@gmail.com \
--cc=tmaimon77@gmail.com \
--cc=venture@google.com \
--cc=yuenn@google.com \
/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