{
struct i2c_msg *msgs = dev->msgs;
u32 intr_mask;
- int tx_limit = dev->tx_fifo_depth - readl(dev->base + DW_IC_TXFLR);
- int rx_limit = dev->rx_fifo_depth - readl(dev->base + DW_IC_RXFLR);
+ int tx_limit, rx_limit;
u32 addr = msgs[dev->msg_write_idx].addr;
u32 buf_len = dev->tx_buf_len;
u8 *buf = dev->tx_buf;;
buf_len = msgs[dev->msg_write_idx].len;
}
+ tx_limit = dev->tx_fifo_depth - readl(dev->base + DW_IC_TXFLR);
+ rx_limit = dev->rx_fifo_depth - readl(dev->base + DW_IC_RXFLR);
+
while (buf_len > 0 && tx_limit > 0 && rx_limit > 0) {
if (msgs[dev->msg_write_idx].flags & I2C_M_RD) {
writel(0x100, dev->base + DW_IC_DATA_CMD);
{
struct i2c_msg *msgs = dev->msgs;
u32 addr = msgs[dev->msg_read_idx].addr;
- int rx_valid = readl(dev->base + DW_IC_RXFLR);
+ int rx_valid;
for (; dev->msg_read_idx < dev->msgs_num; dev->msg_read_idx++) {
u32 len;
buf = dev->rx_buf;
}
+ rx_valid = readl(dev->base + DW_IC_RXFLR);
+
for (; len > 0 && rx_valid > 0; len--, rx_valid--)
*buf++ = readl(dev->base + DW_IC_DATA_CMD);