aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/i2c/busses/i2c-designware.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/drivers/i2c/busses/i2c-designware.c b/drivers/i2c/busses/i2c-designware.c
index cdfd94e41ccc..bfb42f0f87a6 100644
--- a/drivers/i2c/busses/i2c-designware.c
+++ b/drivers/i2c/busses/i2c-designware.c
@@ -338,6 +338,8 @@ i2c_dw_xfer_msg(struct dw_i2c_dev *dev)
338 u32 addr = msgs[dev->msg_write_idx].addr; 338 u32 addr = msgs[dev->msg_write_idx].addr;
339 u32 buf_len = dev->tx_buf_len; 339 u32 buf_len = dev->tx_buf_len;
340 340
341 intr_mask = DW_IC_INTR_STOP_DET | DW_IC_INTR_TX_ABRT;
342
341 if (!(dev->status & STATUS_WRITE_IN_PROGRESS)) { 343 if (!(dev->status & STATUS_WRITE_IN_PROGRESS)) {
342 /* Disable the adapter */ 344 /* Disable the adapter */
343 writel(0, dev->base + DW_IC_ENABLE); 345 writel(0, dev->base + DW_IC_ENABLE);
@@ -387,17 +389,19 @@ i2c_dw_xfer_msg(struct dw_i2c_dev *dev)
387 dev->base + DW_IC_DATA_CMD); 389 dev->base + DW_IC_DATA_CMD);
388 tx_limit--; buf_len--; 390 tx_limit--; buf_len--;
389 } 391 }
392
393 dev->tx_buf_len = buf_len;
394
395 if (buf_len > 0) {
396 /* more bytes to be written */
397 intr_mask |= DW_IC_INTR_TX_EMPTY;
398 dev->status |= STATUS_WRITE_IN_PROGRESS;
399 break;
400 } else
401 dev->status &= ~STATUS_WRITE_IN_PROGRESS;
390 } 402 }
391 403
392 intr_mask = DW_IC_INTR_STOP_DET | DW_IC_INTR_TX_ABRT;
393 if (buf_len > 0) { /* more bytes to be written */
394 intr_mask |= DW_IC_INTR_TX_EMPTY;
395 dev->status |= STATUS_WRITE_IN_PROGRESS;
396 } else
397 dev->status &= ~STATUS_WRITE_IN_PROGRESS;
398 writel(intr_mask, dev->base + DW_IC_INTR_MASK); 404 writel(intr_mask, dev->base + DW_IC_INTR_MASK);
399
400 dev->tx_buf_len = buf_len;
401} 405}
402 406
403static void 407static void