From: mohammed.0.elbadry@gmail.com
Cc: Tali Perry <tali.perry1@gmail.com>,
Mohammed Elbadry <mohammed.0.elbadry@google.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: [PATCH v1 1/1] i2c: npcm: Add clock toggle in case of stuck bus during init in npcm_i2c_init_module
Date: Mon, 24 Mar 2025 20:30:02 +0000 [thread overview]
Message-ID: <20250324203005.1266044-2-mohammed.0.elbadry@gmail.com> (raw)
In-Reply-To: <20250324203005.1266044-1-mohammed.0.elbadry@gmail.com>
From: Tali Perry <tali.perry1@gmail.com>
Signed-off-by: Tali Perry <tali.perry1@gmail.com>
Signed-off-by: Mohammed Elbadry <mohammed.0.elbadry@google.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 3ad6124be80f..78c85015d955 100644
--- a/drivers/i2c/busses/i2c-npcm7xx.c
+++ b/drivers/i2c/busses/i2c-npcm7xx.c
@@ -2043,10 +2043,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)) {
+ 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;
+ }
}
npcm_i2c_int_enable(bus, true);
--
2.34.1
**Reported-by: Mohammed Elbadry <mohammed.0.elbadry@google.com>**
**Tested-by: Mohammed Elbadry <mohammed.0.elbadry@google.com>**
next prev parent reply other threads:[~2025-03-24 20:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-24 20:30 [PATCH v1 0/1] i2c: npcm: Add clock toggle in case of stuck bus during init mohammed.0.elbadry
2025-03-24 20:30 ` mohammed.0.elbadry [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-03-24 20:32 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
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=20250324203005.1266044-2-mohammed.0.elbadry@gmail.com \
--to=mohammed.0.elbadry@gmail.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@google.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