From 1f2735782901608656436b2b3e3a5fa9a77a441e Mon Sep 17 00:00:00 2001 From: Chris Ching Date: Tue, 16 Jan 2018 11:38:17 -0800 Subject: [PATCH] drivers/i2c/designware: Unset IC_ENABLE when setting target address To set address on AMD, IC_ENABLE == 0. BUG=b:69416132 BRANCH=none TEST=Test communication with i2c TPM on grunt and coral Change-Id: I7faee8e11439deceab946cc82d30d274b529b90d Signed-off-by: Chris Ching Reviewed-on: https://review.coreboot.org/23293 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin Reviewed-by: Subrata Banik --- src/drivers/i2c/designware/dw_i2c.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/drivers/i2c/designware/dw_i2c.c b/src/drivers/i2c/designware/dw_i2c.c index 384cca5783..af769ca02e 100644 --- a/src/drivers/i2c/designware/dw_i2c.c +++ b/src/drivers/i2c/designware/dw_i2c.c @@ -379,7 +379,11 @@ int dw_i2c_transfer(unsigned int bus, } /* Set target slave address */ - write32(®s->target_addr, segments->slave); + if (read32(®s->target_addr) != segments->slave) { + dw_i2c_disable(regs); + write32(®s->target_addr, segments->slave); + dw_i2c_enable(regs); + } /* Read or write each byte in segment */ for (byte = 0; byte < segments->len; byte++) {