* [PATCH v1 0/1] i2c: npcm: Add clock toggle in case of stuck bus during init
@ 2025-03-24 20:30 mohammed.0.elbadry
2025-03-24 20:30 ` [PATCH v1 1/1] i2c: npcm: Add clock toggle in case of stuck bus during init in npcm_i2c_init_module mohammed.0.elbadry
0 siblings, 1 reply; 3+ messages in thread
From: mohammed.0.elbadry @ 2025-03-24 20:30 UTC (permalink / raw)
Cc: Tali Perry, Mohammed Elbadry, Avi Fishman, Tomer Maimon,
Patrick Venture, Nancy Yuen, Benjamin Fair, Andi Shyti, openbmc,
linux-i2c, linux-kernel
From: Tali Perry <tali.perry1@gmail.com>
Hi,
During init of the bus, the module checks that the bus is idle.
If one of the lines are stuck try to toggle them first.
Fixes: 76487532f797 (i2c: npcm: Add slave enable/disable function)
Signed-off-by: Tali Perry <tali.perry1@gmail.com>
Signed-off-by: Mohammed Elbadry <mohammed.0.elbadry@google.com>
---
Tali Perry (1):
i2c: npcm: Add clock toggle in case of stuck bus during init in
npcm_i2c_init_module
drivers/i2c/busses/i2c-npcm7xx.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH v1 1/1] i2c: npcm: Add clock toggle in case of stuck bus during init in npcm_i2c_init_module
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
0 siblings, 0 replies; 3+ messages in thread
From: mohammed.0.elbadry @ 2025-03-24 20:30 UTC (permalink / raw)
Cc: Tali Perry, Mohammed Elbadry, Avi Fishman, Tomer Maimon,
Patrick Venture, Nancy Yuen, Benjamin Fair, Andi Shyti, openbmc,
linux-i2c, linux-kernel
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>**
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v1 0/1] i2c: npcm: Add clock toggle in case of stuck bus during init
@ 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
0 siblings, 1 reply; 3+ messages in thread
From: mohammed.0.elbadry @ 2025-03-24 20:32 UTC (permalink / raw)
Cc: Tali Perry, Mohammed Elbadry, Avi Fishman, Tomer Maimon,
Patrick Venture, Nancy Yuen, Benjamin Fair, Andi Shyti, openbmc,
linux-i2c, linux-kernel
From: Tali Perry <tali.perry1@gmail.com>
Hi,
During init of the bus, the module checks that the bus is idle.
If one of the lines are stuck try to toggle them first.
Fixes: 76487532f797 (i2c: npcm: Add slave enable/disable function)
Signed-off-by: Tali Perry <tali.perry1@gmail.com>
Signed-off-by: Mohammed Elbadry <mohammed.0.elbadry@gmail.com>
---
Tali Perry (1):
i2c: npcm: Add clock toggle in case of stuck bus during init in
npcm_i2c_init_module
drivers/i2c/busses/i2c-npcm7xx.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH v1 1/1] i2c: npcm: Add clock toggle in case of stuck bus during init in npcm_i2c_init_module
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 ` mohammed.0.elbadry
0 siblings, 0 replies; 3+ messages in thread
From: mohammed.0.elbadry @ 2025-03-24 20:32 UTC (permalink / raw)
Cc: Tali Perry, Mohammed Elbadry, Avi Fishman, Tomer Maimon,
Patrick Venture, Nancy Yuen, Benjamin Fair, Andi Shyti, openbmc,
linux-i2c, linux-kernel
From: Tali Perry <tali.perry1@gmail.com>
Signed-off-by: Tali Perry <tali.perry1@gmail.com>
Signed-off-by: Mohammed Elbadry <mohammed.0.elbadry@gmail.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@gmail.com>**
**Tested-by: Mohammed Elbadry <mohammed.0.elbadry@gmail.com>**
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-03-24 20:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH v1 1/1] i2c: npcm: Add clock toggle in case of stuck bus during init in npcm_i2c_init_module mohammed.0.elbadry
-- strict thread matches above, loose matches on Subject: below --
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox