diff options
author | Leifu Zhao <leifu.zhao@intel.com> | 2019-07-11 11:03:36 +0800 |
---|---|---|
committer | Jack Rosenthal <jrosenth@chromium.org> | 2019-07-14 08:10:26 +0000 |
commit | 37d5a8382752364aca3349e03e7aa9e5e5dec32c (patch) | |
tree | 93e9bf970ae54ec553c3cb6b79f5d9d2eff9d0c3 /chip | |
parent | a19c530a97049b2ae12bc2b465a02519cfb67f09 (diff) | |
download | chrome-ec-37d5a8382752364aca3349e03e7aa9e5e5dec32c.tar.gz |
arcada: ensure i2c transmit fifo is empty
Make sure transmit fifo is empty before disable i2c
controller during transfer, otherwise the i2c write
may fail for speed 100k, it also helps 400K and 1M.
BUG=b:137218876
BRANCH=none
TEST=tested on arcada
Signed-off-by: Leifu Zhao <leifu.zhao@intel.com>
Change-Id: I6f9fb9a71c28f2d3f9696340cc87fe3b72c25a02
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1697061
Reviewed-by: Leifu Zhao <leifu.zhao@intel.corp-partner.google.com>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Tested-by: Leifu Zhao <leifu.zhao@intel.corp-partner.google.com>
Auto-Submit: Leifu Zhao <leifu.zhao@intel.corp-partner.google.com>
Commit-Queue: Leifu Zhao <leifu.zhao@intel.corp-partner.google.com>
Diffstat (limited to 'chip')
-rw-r--r-- | chip/ish/i2c.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/chip/ish/i2c.c b/chip/ish/i2c.c index f6c0cf3d0b..07da8638d2 100644 --- a/chip/ish/i2c.c +++ b/chip/ish/i2c.c @@ -404,8 +404,9 @@ int chip_i2c_xfer(int port, int slave_addr, const uint8_t *out, int out_size, /* do not disable device before master is idle */ expire_ts = __hw_clock_source_read() + I2C_TSC_TIMEOUT; - while (i2c_mmio_read(ctx->base, IC_STATUS) & - BIT(IC_STATUS_MASTER_ACTIVITY)) { + while ((i2c_mmio_read(ctx->base, IC_STATUS) & + (BIT(IC_STATUS_MASTER_ACTIVITY) | BIT(IC_STATUS_TFE))) != + BIT(IC_STATUS_TFE)) { if (__hw_clock_source_read() >= expire_ts) { ctx->error_flag = 1; |