summaryrefslogtreecommitdiff
path: root/chip/it83xx
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2020-04-06 13:16:49 -0600
committerCommit Bot <commit-bot@chromium.org>2020-04-08 01:06:55 +0000
commit972246ce6cdbf3d7b2f05512da57efdcfdf18961 (patch)
tree3dc9a2a719ca88c5f1ae89993df7e8c884600fed /chip/it83xx
parentf2437f110406508f7b16752fb92abcd5f6254e6d (diff)
downloadchrome-ec-972246ce6cdbf3d7b2f05512da57efdcfdf18961.tar.gz
ITE: Return an error if i2c unwedge attempt failed
Checks the return of the i2c unwedge attempt and returns the error if the bus was unable to be unwedged. BRANCH=None BUG=b:153195490 TEST=on waddledee, "apshutdown" can be run from the EC with no i2c wedge issues Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Id0785f099bdf20d622226501f415ac411eea6f81 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2136873 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'chip/it83xx')
-rw-r--r--chip/it83xx/i2c.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/chip/it83xx/i2c.c b/chip/it83xx/i2c.c
index 1160b1bd2c..0ab872f323 100644
--- a/chip/it83xx/i2c.c
+++ b/chip/it83xx/i2c.c
@@ -670,10 +670,16 @@ int chip_i2c_xfer(int port, uint16_t slave_addr_flags,
/* Make sure we're in a good state to start */
if ((flags & I2C_XFER_START) && (i2c_is_busy(port)
|| (i2c_get_line_levels(port) != I2C_LINE_IDLE))) {
+
/* Attempt to unwedge the port. */
- i2c_unwedge(port);
+ pd->err = i2c_unwedge(port);
+
/* reset i2c port */
i2c_reset(port, I2C_RC_NO_IDLE_FOR_START);
+
+ /* Return if port is still wedged */
+ if (pd->err)
+ return pd->err;
}
pd->task_waiting = task_get_current();