提交 a16d8aa4 编写于 作者: S Sachin Surendran 提交者: Scott Wood

i2c-cpm: Fix to takeback i2c bus master-ship after a collision

In case of collision on i2c bus the controller which lost bus mastership
stays as a slave for all subsequent transfers. This results in the i2c
controller never writing to the bus for future transactions, resulting
in i2c transfer timeouts.
  This fix checks for a collision on last I2C transaction and sets the
I2COM_MASTER bit for the new transaction.
Signed-off-by: NSachin Surendran <sachin.surendran@alliedtelesis.co.nz>
Signed-off-by: NScott Wood <scottwood@freescale.com>
上级 98c7355f
......@@ -338,6 +338,14 @@ static int cpm_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
tptr = 0;
rptr = 0;
/*
* If there was a collision in the last i2c transaction,
* Set I2COM_MASTER as it was cleared during collision.
*/
if (in_be16(&tbdf->cbd_sc) & BD_SC_CL) {
out_8(&cpm->i2c_reg->i2com, I2COM_MASTER);
}
while (tptr < num) {
pmsg = &msgs[tptr];
dev_dbg(&adap->dev, "R: %d T: %d\n", rptr, tptr);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册