diff options
author | Aseda Aboagye <aaboagye@google.com> | 2018-08-19 17:14:29 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-08-22 00:10:38 -0700 |
commit | fe16ade3ea5dfdd01cf466a9a6bff76d8fa17f11 (patch) | |
tree | f8dde4ea45bb74f588ea111b6094a0e2a8c0e14f /common | |
parent | af908bfce225415c01d56b3f57cfc399d8485d3e (diff) | |
download | chrome-ec-fe16ade3ea5dfdd01cf466a9a6bff76d8fa17f11.tar.gz |
i2c: Don't try to unwedge unpowered busses.
If an i2c bus is known to be unpowered, we should not spend time trying
to unwedge it. It's futile, so stop trying. This commit adds a config
option,
CONFIG_I2C_BUS_MAY_BE_UNPOWERED
which can be defined by a board if a bus may be unpowered during
runtime.
BUG=b:111683988
BRANCH=nocturne
TEST=Verify that unwedge attempts are skipped if the bus is deemed
unpowered.
Change-Id: Ice12b3957121be476ef0173a86f239f183010b47
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1182877
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Alexandru M Stan <amstan@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/i2c_master.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/common/i2c_master.c b/common/i2c_master.c index e02a479aeb..fb967afd0f 100644 --- a/common/i2c_master.c +++ b/common/i2c_master.c @@ -491,6 +491,16 @@ int i2c_unwedge(int port) int i, j; int ret = EC_SUCCESS; +#ifdef CONFIG_I2C_BUS_MAY_BE_UNPOWERED + /* + * Don't try to unwedge the port if we know it's unpowered; it's futile. + */ + if (!board_is_i2c_port_powered(port)) { + CPRINTS("Skipping i2c unwedge, bus not powered."); + return EC_ERROR_NOT_POWERED; + } +#endif /* CONFIG_I2C_BUS_MAY_BE_UNPOWERED */ + /* Try to put port in to raw bit bang mode. */ if (i2c_raw_mode(port, 1) != EC_SUCCESS) return EC_ERROR_UNKNOWN; |