<div dir="ltr">Thank you, Mukesh. Updated patch uploaded.<div><br></div><div>Mo</div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Fri, Mar 28, 2025 at 12:33 PM <<a href="mailto:mohammed.0.elbadry@gmail.com">mohammed.0.elbadry@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">From: Tali Perry <<a href="mailto:tali.perry1@gmail.com" target="_blank">tali.perry1@gmail.com</a>><br>
<br>
During init of the bus, the module checks that the bus is idle.<br>
If one of the lines are stuck try to recover them first before failing.<br>
Sometimes SDA and SCL are low if improper reset occurs (e.g., reboot).<br>
<br>
Signed-off-by: Tali Perry <<a href="mailto:tali.perry1@gmail.com" target="_blank">tali.perry1@gmail.com</a>><br>
Signed-off-by: Mohammed Elbadry <<a href="mailto:mohammed.0.elbadry@gmail.com" target="_blank">mohammed.0.elbadry@gmail.com</a>><br>
---<br>
 drivers/i2c/busses/i2c-npcm7xx.c | 12 ++++++++----<br>
 1 file changed, 8 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm7xx.c<br>
index 2fe68615942e..caf9aa1e6319 100644<br>
--- a/drivers/i2c/busses/i2c-npcm7xx.c<br>
+++ b/drivers/i2c/busses/i2c-npcm7xx.c<br>
@@ -1967,10 +1967,14 @@ static int npcm_i2c_init_module(struct npcm_i2c *bus, enum i2c_mode mode,<br>
<br>
        /* Check HW is OK: SDA and SCL should be high at this point. */<br>
        if ((npcm_i2c_get_SDA(&bus->adap) == 0) || (npcm_i2c_get_SCL(&bus->adap) == 0)) {<br>
-               dev_err(bus->dev, "I2C%d init fail: lines are low\n", bus->num);<br>
-               dev_err(bus->dev, "SDA=%d SCL=%d\n", npcm_i2c_get_SDA(&bus->adap),<br>
-                       npcm_i2c_get_SCL(&bus->adap));<br>
-               return -ENXIO;<br>
+               dev_warn(bus->dev, " I2C%d SDA=%d SCL=%d, attempting to recover\n", bus->num,<br>
+                                npcm_i2c_get_SDA(&bus->adap), npcm_i2c_get_SCL(&bus->adap));<br>
+               if (npcm_i2c_recovery_tgclk(&bus->adap)) {<br>
+                       dev_err(bus->dev, "I2C%d init fail: SDA=%d SCL=%d\n",<br>
+                               bus->num, npcm_i2c_get_SDA(&bus->adap),<br>
+                               npcm_i2c_get_SCL(&bus->adap));<br>
+                       return -ENXIO;<br>
+               }<br>
        }<br>
<br>
        npcm_i2c_int_enable(bus, true);<br>
-- <br>
2.49.0.472.ge94155a9ec-goog<br>
<br>
</blockquote></div>