diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2019-05-30 10:28:25 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-05-31 06:12:49 +0000 |
commit | f2fe683ccc41dcf8a3dba4975e306e74a60fb6e3 (patch) | |
tree | 22509ffb09c1fc97c9bf6ba6ed5eb45689f58a19 | |
parent | 2661a71263bb47b45c8b547885dc80a1a4790c95 (diff) | |
download | chrome-ec-stabilize-flapjack-12109.B.tar.gz |
Flapjack: Unwedge I2C before reading EEPROMstabilize-flapjack-12109.B
FOR_BRANCH NOT_FOR_MASTER
This patch makes CBI unwedge I2C bus when it fails to read CBI
from an EEPROM.
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
BUG=none
BRANCH=none
TEST=Verify CBI is read correctly.
Change-Id: I327875e781b781e185fb78b41b2256245b3da322
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1637851
Reviewed-by: Nick Sanders <nsanders@chromium.org>
Commit-Queue: Nick Sanders <nsanders@chromium.org>
Tested-by: Nick Sanders <nsanders@chromium.org>
-rw-r--r-- | chip/stm32/i2c-stm32f0.c | 2 | ||||
-rw-r--r-- | common/cbi.c | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/chip/stm32/i2c-stm32f0.c b/chip/stm32/i2c-stm32f0.c index ad4df85bdd..70f08aff95 100644 --- a/chip/stm32/i2c-stm32f0.c +++ b/chip/stm32/i2c-stm32f0.c @@ -135,7 +135,7 @@ static void i2c_set_freq_port(const struct i2c_port_t *p, * * @param p the I2c port */ -static void i2c_init_port(const struct i2c_port_t *p) +void i2c_init_port(const struct i2c_port_t *p) { int port = p->port; enum stm32_i2c_clk_src src = I2C_CLK_SRC_48MHZ; diff --git a/common/cbi.c b/common/cbi.c index d8feee3189..1206e3e4fa 100644 --- a/common/cbi.c +++ b/common/cbi.c @@ -141,13 +141,19 @@ static int do_read_board_info(void) return EC_SUCCESS; } +void i2c_init_port(const struct i2c_port_t *p); + static int read_board_info(void) { if (cached_read_result == EC_ERROR_CBI_CACHE_INVALID) { cached_read_result = do_read_board_info(); - if (cached_read_result) + if (cached_read_result) { + int rv = i2c_unwedge(I2C_PORT_EEPROM); + CPRINTS("I2C-4 unwedged (%d)", rv); + i2c_init_port(&i2c_ports[4]); /* On error (I2C or bad contents), retry a read */ cached_read_result = do_read_board_info(); + } } /* Else, we already tried and know the result. Return the cached * error code immediately to avoid wasteful reads. */ |