diff options
Diffstat (limited to 'drivers/i2c/busses/i2c-mpc.c')
-rw-r--r-- | drivers/i2c/busses/i2c-mpc.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c index b76731edbf10..64b0b4d265d5 100644 --- a/drivers/i2c/busses/i2c-mpc.c +++ b/drivers/i2c/busses/i2c-mpc.c | |||
@@ -576,7 +576,23 @@ static int mpc_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) | |||
576 | mpc_write(i2c, pmsg->addr, pmsg->buf, pmsg->len, i); | 576 | mpc_write(i2c, pmsg->addr, pmsg->buf, pmsg->len, i); |
577 | } | 577 | } |
578 | } | 578 | } |
579 | mpc_i2c_stop(i2c); | 579 | mpc_i2c_stop(i2c); /* Initiate STOP */ |
580 | orig_jiffies = jiffies; | ||
581 | /* Wait until STOP is seen, allow up to 1 s */ | ||
582 | while (readb(i2c->base + MPC_I2C_SR) & CSR_MBB) { | ||
583 | if (time_after(jiffies, orig_jiffies + HZ)) { | ||
584 | u8 status = readb(i2c->base + MPC_I2C_SR); | ||
585 | |||
586 | dev_dbg(i2c->dev, "timeout\n"); | ||
587 | if ((status & (CSR_MCF | CSR_MBB | CSR_RXAK)) != 0) { | ||
588 | writeb(status & ~CSR_MAL, | ||
589 | i2c->base + MPC_I2C_SR); | ||
590 | mpc_i2c_fixup(i2c); | ||
591 | } | ||
592 | return -EIO; | ||
593 | } | ||
594 | cond_resched(); | ||
595 | } | ||
580 | return (ret < 0) ? ret : num; | 596 | return (ret < 0) ? ret : num; |
581 | } | 597 | } |
582 | 598 | ||