Skip to content

Commit

Permalink
i2c-designware: Disable TX_EMPTY when all i2c_msg msgs has been proce…
Browse files Browse the repository at this point in the history
…ssed

Currently we disable TX_EMPTY interrupt when buf_len is zero, but this
is wrong.  (buf_len == 0) means that all transmit data in the current
i2c_msg message has been sent out, but that doesn't necessarily mean
all i2c_msg messages have been processed.

TX_EMPTY interrupt is used as the driving force of DW I2C transactions,
so we need to keep it enabled as long as i2c_msg messages are available.

Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi@necel.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
  • Loading branch information
Shinya Kuribayashi authored and Ben Dooks committed Dec 9, 2009
1 parent 201d6a7 commit 69151e5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions drivers/i2c/busses/i2c-designware.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,12 +415,17 @@ i2c_dw_xfer_msg(struct dw_i2c_dev *dev)
/* more bytes to be written */
dev->status |= STATUS_WRITE_IN_PROGRESS;
break;
} else {
} else
dev->status &= ~STATUS_WRITE_IN_PROGRESS;
intr_mask &= ~DW_IC_INTR_TX_EMPTY;
}
}

/*
* If i2c_msg index search is completed, we don't need TX_EMPTY
* interrupt any more.
*/
if (dev->msg_write_idx == dev->msgs_num)
intr_mask &= ~DW_IC_INTR_TX_EMPTY;

writel(intr_mask, dev->base + DW_IC_INTR_MASK);
}

Expand Down

0 comments on commit 69151e5

Please sign in to comment.