Message ID | 20190218083522.4681-1-sxauwsk@163.com |
---|---|
State | Superseded |
Headers | show |
Series | i2c: cadence: try reset when master receive arbitration lost | expand |
Hi, On 18. 02. 19 9:35, sxauwsk wrote: > When the adapter receive arbitration lost error interrupts, > cdns_i2c_master_xfer return to the caller directly instead of resetting > the adapter which resulted in the adapter being out of control. > > So when driver detect err_status such as arbitration lost, > then try to repair and fix it. > > Signed-off-by: sxauwsk <sxauwsk@163.com> Can you please fix your name here? And also in subject. Thanks, Michal
diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c index b13605718291..595b0d56ff1a 100644 --- a/drivers/i2c/busses/i2c-cadence.c +++ b/drivers/i2c/busses/i2c-cadence.c @@ -548,10 +548,6 @@ static int cdns_i2c_process_msg(struct cdns_i2c *id, struct i2c_msg *msg, cdns_i2c_writereg(CDNS_I2C_IXR_ALL_INTR_MASK, CDNS_I2C_IDR_OFFSET); - /* If it is bus arbitration error, try again */ - if (id->err_status & CDNS_I2C_IXR_ARB_LOST) - return -EAGAIN; - return 0; } @@ -624,6 +620,12 @@ static int cdns_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, if (id->err_status) { cdns_i2c_master_reset(adap); + /* If it is bus arbitration error, try again */ + if (id->err_status & CDNS_I2C_IXR_ARB_LOST) { + ret = -EAGAIN; + goto out; + } + if (id->err_status & CDNS_I2C_IXR_NACK) { ret = -ENXIO; goto out;