forked from Minki/linux
i2c: octeon: Avoid sending STOP during recovery
Due to a bug in the ThunderX I2C hardware sending STOP during a recovery attempt could lock up the hardware. To work around this problem do not send STOP at the beginning of the recovery but use the override registers to bring the TWSI including the high-level controller out of the bad state. Signed-off-by: Dmitry Bazhenov <dmitry.bazhenov@auriga.com> Signed-off-by: Jan Glauber <jglauber@cavium.com> [Changed commit message] Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
This commit is contained in:
parent
e7051556b6
commit
de919ff6a0
@ -783,13 +783,14 @@ static void octeon_i2c_prepare_recovery(struct i2c_adapter *adap)
|
||||
{
|
||||
struct octeon_i2c *i2c = i2c_get_adapdata(adap);
|
||||
|
||||
/*
|
||||
* The stop resets the state machine, does not _transmit_ STOP unless
|
||||
* engine was active.
|
||||
*/
|
||||
octeon_i2c_stop(i2c);
|
||||
|
||||
octeon_i2c_hlc_disable(i2c);
|
||||
|
||||
/*
|
||||
* Bring control register to a good state regardless
|
||||
* of HLC state.
|
||||
*/
|
||||
octeon_i2c_ctl_write(i2c, TWSI_CTL_ENAB);
|
||||
|
||||
octeon_i2c_write_int(i2c, 0);
|
||||
}
|
||||
|
||||
@ -797,6 +798,15 @@ static void octeon_i2c_unprepare_recovery(struct i2c_adapter *adap)
|
||||
{
|
||||
struct octeon_i2c *i2c = i2c_get_adapdata(adap);
|
||||
|
||||
/*
|
||||
* Generate STOP to finish the unfinished transaction.
|
||||
* Can't generate STOP via the TWSI CTL register
|
||||
* since it could bring the TWSI controller into an inoperable state.
|
||||
*/
|
||||
octeon_i2c_write_int(i2c, TWSI_INT_SDA_OVR | TWSI_INT_SCL_OVR);
|
||||
udelay(5);
|
||||
octeon_i2c_write_int(i2c, TWSI_INT_SDA_OVR);
|
||||
udelay(5);
|
||||
octeon_i2c_write_int(i2c, 0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user