diff options
author | Sachin Surendran <sachin.surendran@alliedtelesis.co.nz> | 2012-11-25 17:20:01 -0500 |
---|---|---|
committer | Scott Wood <scottwood@freescale.com> | 2013-06-25 17:53:26 -0400 |
commit | a16d8aa4726a944ffc1616689ae34ff6a902faba (patch) | |
tree | 383c8a010d1dc8a2a6a6bda0467f52507b91d9d7 /drivers/i2c | |
parent | 98c7355fb373d7c29e5c45d0a423810ad2476b34 (diff) |
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: Sachin Surendran <sachin.surendran@alliedtelesis.co.nz>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/i2c-cpm.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c index 3823623baa48..9e6002108720 100644 --- a/drivers/i2c/busses/i2c-cpm.c +++ b/drivers/i2c/busses/i2c-cpm.c | |||
@@ -338,6 +338,14 @@ static int cpm_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) | |||
338 | tptr = 0; | 338 | tptr = 0; |
339 | rptr = 0; | 339 | rptr = 0; |
340 | 340 | ||
341 | /* | ||
342 | * If there was a collision in the last i2c transaction, | ||
343 | * Set I2COM_MASTER as it was cleared during collision. | ||
344 | */ | ||
345 | if (in_be16(&tbdf->cbd_sc) & BD_SC_CL) { | ||
346 | out_8(&cpm->i2c_reg->i2com, I2COM_MASTER); | ||
347 | } | ||
348 | |||
341 | while (tptr < num) { | 349 | while (tptr < num) { |
342 | pmsg = &msgs[tptr]; | 350 | pmsg = &msgs[tptr]; |
343 | dev_dbg(&adap->dev, "R: %d T: %d\n", rptr, tptr); | 351 | dev_dbg(&adap->dev, "R: %d T: %d\n", rptr, tptr); |