summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Ching <chingcodes@chromium.org>2018-01-16 11:38:17 -0800
committerChris Ching <chingcodes@chromium.org>2018-02-01 16:35:20 +0000
commit1f2735782901608656436b2b3e3a5fa9a77a441e (patch)
treed06349065977f0e28f99fe353f5105479dbac06b /src
parent65d78e880a6eeeaeb084ec2dd37c2126b952df6d (diff)
downloadcoreboot-1f2735782901608656436b2b3e3a5fa9a77a441e.tar.xz
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 <chingcodes@chromium.org> Reviewed-on: https://review.coreboot.org/23293 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Subrata Banik <subrata.banik@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/drivers/i2c/designware/dw_i2c.c6
1 files changed, 5 insertions, 1 deletions
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(&regs->target_addr, segments->slave);
+ if (read32(&regs->target_addr) != segments->slave) {
+ dw_i2c_disable(regs);
+ write32(&regs->target_addr, segments->slave);
+ dw_i2c_enable(regs);
+ }
/* Read or write each byte in segment */
for (byte = 0; byte < segments->len; byte++) {