Matt DeVillier has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/63561 )
Change subject: drivers/i2c/dw_i2c: Adjust to handle 0-byte transfers ......................................................................
drivers/i2c/dw_i2c: Adjust to handle 0-byte transfers
0-byte writes can be used as a way to probe/check presence of an i2c device, so adjust _dw_i2c_transfer() to immediately set the STOP bit and suppress TX abort messages when the segment length is zero.
Tested as part of entire i2c-detect patch train.
Change-Id: I518e849f4c476c264a1464886b1853af66c0b29d Signed-off-by: Matt DeVillier matt.devillier@gmail.com --- M src/drivers/i2c/designware/dw_i2c.c 1 file changed, 7 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/61/63561/1
diff --git a/src/drivers/i2c/designware/dw_i2c.c b/src/drivers/i2c/designware/dw_i2c.c index 56f3f27..1a61282 100644 --- a/src/drivers/i2c/designware/dw_i2c.c +++ b/src/drivers/i2c/designware/dw_i2c.c @@ -374,6 +374,10 @@
dw_i2c_enable(regs);
+ if (segments->len == 0) + /* stop immediately */ + write32(®s->cmd_data, CMD_DATA_STOP); + /* Process each segment */ while (count--) { if (CONFIG(DRIVERS_I2C_DESIGNWARE_DEBUG)) { @@ -424,8 +428,9 @@
/* 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)); + if (segments->len != 0) + printk(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;