diff mbox

[2/2] i2c: octeon: Fix waiting for operation completion

Message ID 20161111085707.GC16907@hardcore
State New
Headers show

Commit Message

Jan Glauber Nov. 11, 2016, 8:57 a.m. UTC
> As you can see octeon_i2c_driver_init never returns. Are you able to test on 

> one of your MIPS-based systems?

> 

> Thanks,

>     Paul


Hi Paul,

we can reproduce the problem on our side, but I don't have direct access
to a MIPS system so I'm still just guessing what happens. If you want
you can try the attached patches.

I'm trying to get rid of the polling around the interrupt altogether.
It works fine on Thunderx, sometimes I run into an interrupt timeout 
after a lost-arbitration but recovery/retry is able to clean that up.

Please also revert 70121f7 as before. The last patch adds some debugging
output to see if we run into timeouts or recovery.

thanks,
Jan

Comments

Steven J. Hill Nov. 11, 2016, 8:51 p.m. UTC | #1
On 11/11/2016 02:57 AM, Jan Glauber wrote:
> 

> we can reproduce the problem on our side, but I don't have direct access

> to a MIPS system so I'm still just guessing what happens. If you want

> you can try the attached patches.

> 

> I'm trying to get rid of the polling around the interrupt altogether.

> It works fine on Thunderx, sometimes I run into an interrupt timeout 

> after a lost-arbitration but recovery/retry is able to clean that up.

> 

> Please also revert 70121f7 as before. The last patch adds some debugging

> output to see if we run into timeouts or recovery.

> 

Using your three patches without reverting 70121f7 fails on both 71xx
and 78xx boards. Paul's "[PATCH 1/2] i2c: octeon: Fix register access"
eliminates the i2c probe hang and both boards boot properly. Tested
on top of Linus' v4.9-rc4 tag.

Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Daney Nov. 11, 2016, 10:11 p.m. UTC | #2
On 11/11/2016 12:51 PM, Steven J. Hill wrote:
> On 11/11/2016 02:57 AM, Jan Glauber wrote:

>>

>> we can reproduce the problem on our side, but I don't have direct access

>> to a MIPS system so I'm still just guessing what happens. If you want

>> you can try the attached patches.

>>

>> I'm trying to get rid of the polling around the interrupt altogether.

>> It works fine on Thunderx, sometimes I run into an interrupt timeout

>> after a lost-arbitration but recovery/retry is able to clean that up.

>>

>> Please also revert 70121f7 as before. The last patch adds some debugging

>> output to see if we run into timeouts or recovery.

>>

> Using your three patches without reverting 70121f7 fails on both 71xx

> and 78xx boards. Paul's "[PATCH 1/2] i2c: octeon: Fix register access"

> eliminates the i2c probe hang and both boards boot properly. Tested

> on top of Linus' v4.9-rc4 tag.

>


We need a definitive set of patches to apply.  If Paul's patches are not 
sufficient, work with Jan to create and test a set (perhaps including 
reversions) that will make it work on both OCTEON and Thunder, noting 
any dependencies on Paul's patches.  Then get that posted ASAP so that 
I2C can work again

David.

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

From 45eae05b8d793f5652f77ab1d5faa62c30927a10 Mon Sep 17 00:00:00 2001
From: Jan Glauber <jglauber@cavium.com>
Date: Fri, 11 Nov 2016 09:40:15 +0100
Subject: [PATCH 3/3] i2c: octeon: thunderx: Debug prints for timeout and
 recovery

Signed-off-by: Jan Glauber <jglauber@cavium.com>
---
 drivers/i2c/busses/i2c-octeon-core.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-octeon-core.c b/drivers/i2c/busses/i2c-octeon-core.c
index 1d8775799..a2a92b6 100644
--- a/drivers/i2c/busses/i2c-octeon-core.c
+++ b/drivers/i2c/busses/i2c-octeon-core.c
@@ -72,9 +72,10 @@  static int octeon_i2c_wait(struct octeon_i2c *i2c)
 		return 0;
 	}
 
-	if (!time_left)
+	if (!time_left) {
+		pr_err("%s: timed out\n", __func__);
 		return -ETIMEDOUT;
-
+	}
 	return 0;
 }
 
@@ -169,8 +170,10 @@  static int octeon_i2c_hlc_wait(struct octeon_i2c *i2c)
 		return 0;
 	}
 
-	if (!time_left)
+	if (!time_left) {
+		pr_err("%s: timed out\n", __func__);
 		return -ETIMEDOUT;
+	}
 	return 0;
 }
 
@@ -280,6 +283,7 @@  static int octeon_i2c_start(struct octeon_i2c *i2c)
 
 error:
 	/* START failed, try to recover */
+	pr_err("%s: try to recover from status: %d\n", __func__, stat);
 	ret = octeon_i2c_recovery(i2c);
 	return (ret) ? ret : -EAGAIN;
 }
-- 
1.9.1