[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <547a51bf-a3ad-48ed-9797-65d28c63e852@quicinc.com>
Date: Fri, 28 Mar 2025 16:49:59 +0530
From: Mukesh Kumar Savaliya <quic_msavaliy@...cinc.com>
To: <mohammed.0.elbadry@...il.com>, <avifishman70@...il.com>,
<linux-i2c@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<andi.shyti@...nel.org>, <venture@...gle.com>
CC: Tali Perry <tali.perry1@...il.com>
Subject: Re: [PATCH v3] i2c: npcm: Add clock toggle recovery
On 3/28/2025 1:08 AM, mohammed.0.elbadry@...il.com wrote:
> From: Tali Perry <tali.perry1@...il.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@...il.com>
> Signed-off-by: Mohammed Elbadry <mohammed.0.elbadry@...il.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..f05cae20cb27 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, attempt recover\n", bus->num,
> + npcm_i2c_get_SDA(&bus->adap), npcm_i2c_get_SCL(&bus->adap));
> + if (npcm_i2c_recovery_tgclk(&bus->adap)) {
You are here post trying recovery. In the log below you may want to add,
"Post recovery" ? instead of "init fail" ? Just a suggestion.
> + dev_err(bus->dev, "I2C%d init fail: lines are low, SDA=%d SCL=%d\n",
> + bus->num, npcm_i2c_get_SDA(&bus->adap),
Thanks for making previous change. Now "lines are low" not relevant as
you just need to print status 1 or 0.
> + npcm_i2c_get_SCL(&bus->adap));
> + return -ENXIO;
> + }
> }
>
> npcm_i2c_int_enable(bus, true);
Powered by blists - more mailing lists