diff options
-rw-r--r-- | drivers/i2c/busses/i2c-designware-core.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-designware-core.c b/drivers/i2c/busses/i2c-designware-core.c index ad46616de29e..f325ec7abfb1 100644 --- a/drivers/i2c/busses/i2c-designware-core.c +++ b/drivers/i2c/busses/i2c-designware-core.c | |||
@@ -416,6 +416,7 @@ i2c_dw_xfer_msg(struct dw_i2c_dev *dev) | |||
416 | u32 addr = msgs[dev->msg_write_idx].addr; | 416 | u32 addr = msgs[dev->msg_write_idx].addr; |
417 | u32 buf_len = dev->tx_buf_len; | 417 | u32 buf_len = dev->tx_buf_len; |
418 | u8 *buf = dev->tx_buf; | 418 | u8 *buf = dev->tx_buf; |
419 | bool need_restart = false; | ||
419 | 420 | ||
420 | intr_mask = DW_IC_INTR_DEFAULT_MASK; | 421 | intr_mask = DW_IC_INTR_DEFAULT_MASK; |
421 | 422 | ||
@@ -443,6 +444,14 @@ i2c_dw_xfer_msg(struct dw_i2c_dev *dev) | |||
443 | /* new i2c_msg */ | 444 | /* new i2c_msg */ |
444 | buf = msgs[dev->msg_write_idx].buf; | 445 | buf = msgs[dev->msg_write_idx].buf; |
445 | buf_len = msgs[dev->msg_write_idx].len; | 446 | buf_len = msgs[dev->msg_write_idx].len; |
447 | |||
448 | /* If both IC_EMPTYFIFO_HOLD_MASTER_EN and | ||
449 | * IC_RESTART_EN are set, we must manually | ||
450 | * set restart bit between messages. | ||
451 | */ | ||
452 | if ((dev->master_cfg & DW_IC_CON_RESTART_EN) && | ||
453 | (dev->msg_write_idx > 0)) | ||
454 | need_restart = true; | ||
446 | } | 455 | } |
447 | 456 | ||
448 | tx_limit = dev->tx_fifo_depth - dw_readl(dev, DW_IC_TXFLR); | 457 | tx_limit = dev->tx_fifo_depth - dw_readl(dev, DW_IC_TXFLR); |
@@ -461,6 +470,11 @@ i2c_dw_xfer_msg(struct dw_i2c_dev *dev) | |||
461 | buf_len == 1) | 470 | buf_len == 1) |
462 | cmd |= BIT(9); | 471 | cmd |= BIT(9); |
463 | 472 | ||
473 | if (need_restart) { | ||
474 | cmd |= BIT(10); | ||
475 | need_restart = false; | ||
476 | } | ||
477 | |||
464 | if (msgs[dev->msg_write_idx].flags & I2C_M_RD) { | 478 | if (msgs[dev->msg_write_idx].flags & I2C_M_RD) { |
465 | 479 | ||
466 | /* avoid rx buffer overrun */ | 480 | /* avoid rx buffer overrun */ |