diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/drivers/i2c/designware/dw_i2c.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/drivers/i2c/designware/dw_i2c.c b/src/drivers/i2c/designware/dw_i2c.c index 761fa914b4..fdedf63b56 100644 --- a/src/drivers/i2c/designware/dw_i2c.c +++ b/src/drivers/i2c/designware/dw_i2c.c @@ -358,6 +358,7 @@ static enum cb_err _dw_i2c_transfer(unsigned int bus, const struct i2c_msg *segm struct dw_i2c_regs *regs; size_t byte; enum cb_err ret = CB_ERR; + bool seg_zero_len = segments->len == 0; regs = (struct dw_i2c_regs *)dw_i2c_base_address(bus); if (!regs) { @@ -374,6 +375,10 @@ static enum cb_err _dw_i2c_transfer(unsigned int bus, const struct i2c_msg *segm dw_i2c_enable(regs); + if (seg_zero_len) + /* stop immediately */ + write32(®s->cmd_data, CMD_DATA_STOP); + /* Process each segment */ while (count--) { if (CONFIG(DRIVERS_I2C_DESIGNWARE_DEBUG)) { @@ -424,8 +429,8 @@ static enum cb_err _dw_i2c_transfer(unsigned int bus, const struct i2c_msg *segm /* Check TX abort */ if (read32(®s->raw_intr_stat) & INTR_STAT_TX_ABORT) { - printk(BIOS_ERR, "I2C TX abort detected (%08x)\n", - read32(®s->tx_abort_source)); + printk(seg_zero_len ? BIOS_SPEW : BIOS_ERR, "I2C TX abort detected (%08x)\n", + read32(®s->tx_abort_source)); /* clear INTR_STAT_TX_ABORT */ read32(®s->clear_tx_abrt_intr); goto out; @@ -462,7 +467,7 @@ static enum cb_err dw_i2c_transfer(unsigned int bus, const struct i2c_msg *msg, size_t start; uint16_t addr; - if (count == 0 || !msg) + if (!msg) return -1; /* Break up the transfers at the differing slave address boundary. */ |