Skip to content

Commit

Permalink
i2c: i2c-bfin-twi: Tighten condition when failing I2C transfer if MEN…
Browse files Browse the repository at this point in the history
… bit is reset unexpectedly.

In order to mark I2C transfer fail when MEN bit in I2C controller is
reset unexpectedly in MCOMP interrupt, interrupt status bits XMTSERV or
RCVSERV should be checked.

Master Transfer Complete (MCOMP).
[1] The initiated master transfer has completed. In the absence of a
repeat start, the bus has been released.
[0] The completion of a transfer has not been detected.

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

[wsa: fixed spaces around operators and typo in commit message]

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
  • Loading branch information
Sonic Zhang authored and Wolfram Sang committed Jul 13, 2012
1 parent a25733d commit 2ee74eb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/i2c/busses/i2c-bfin-twi.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ static void bfin_twi_handle_interrupt(struct bfin_twi_iface *iface,
return;
}
if (twi_int_status & MCOMP) {
if ((read_MASTER_CTL(iface) & MEN) == 0 &&
if (twi_int_status & (XMTSERV | RCVSERV) &&
(read_MASTER_CTL(iface) & MEN) == 0 &&
(iface->cur_mode == TWI_I2C_MODE_REPEAT ||
iface->cur_mode == TWI_I2C_MODE_COMBINED)) {
iface->result = -1;
Expand Down

0 comments on commit 2ee74eb

Please sign in to comment.