i2c: octeon: thunderx: TWSI software reset in recovery
authorJan Glauber <jglauber@cavium.com>
Fri, 9 Dec 2016 09:31:55 +0000 (10:31 +0100)
committerWolfram Sang <wsa@the-dreams.de>
Sun, 11 Dec 2016 21:58:34 +0000 (22:58 +0100)
I've seen i2c recovery reporting long loops of:

[ 1035.887818] i2c i2c-4: SCL is stuck low, exit recovery
[ 1037.999748] i2c i2c-4: SCL is stuck low, exit recovery
[ 1040.111694] i2c i2c-4: SCL is stuck low, exit recovery
...

Add a TWSI software reset which clears the status and
STA,STP,IFLG in SW_TWSI_EOP_TWSI_CTL.

With this the recovery works fine and above message is not seen.

Signed-off-by: Jan Glauber <jglauber@cavium.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/busses/i2c-octeon-core.c

index 419b54bfc7c77a981b754f87fd1cbd116e5c0672..0b020703017dafee75de6b245d5949b7b8f3db3f 100644 (file)
@@ -791,6 +791,9 @@ static void octeon_i2c_prepare_recovery(struct i2c_adapter *adap)
        struct octeon_i2c *i2c = i2c_get_adapdata(adap);
 
        octeon_i2c_hlc_disable(i2c);
+       octeon_i2c_reg_write(i2c, SW_TWSI_EOP_TWSI_RST, 0);
+       /* wait for software reset to settle */
+       udelay(5);
 
        /*
         * Bring control register to a good state regardless