diff options
author | Simon Glass <sjg@chromium.org> | 2012-07-05 19:19:13 -0700 |
---|---|---|
committer | Gerrit <chrome-bot@google.com> | 2012-07-05 22:56:39 -0700 |
commit | 10058960d7843fe625c7b6653ccd03522e2d69c0 (patch) | |
tree | a08391a53cbfeb2d8e0e5c67da372cbdb3f552bf /board/snow | |
parent | c1a2ba7caddd7b17362b7630dc10b8e0dcdeb742 (diff) | |
download | chrome-ec-10058960d7843fe625c7b6653ccd03522e2d69c0.tar.gz |
i2c: Add delay after bus release, print an error on failure
Change the delay for bus claim to 100ms, since in testing with the AP
requesting the bus constantly, I was able to make a 50ms timeout happen
after about 3000 transactions. With 100ms, the timeout happens only
once in 130,000 i2c transactions with both AP and EC fully loading the
i2c bus simulataneously.
The bus claim failure should never happen, but in case it does, print
an error. Also make sure we delay for a bit, to allow the AP to see the
change in state.
BUG=chrome-os-partner:10888
TEST=manual:
build for all boards
boot on snow, test:
on AP:
$ while true; do i2cdump -f -y 4 0x48; done >/dev/null
on EC:
$ pmu 10000
See that the machine operates normally with no lock-ups, etc.
Change-Id: I9a48144f560c596429c525a42c77ac41ec095ec0
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/26828
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Diffstat (limited to 'board/snow')
-rw-r--r-- | board/snow/board.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/board/snow/board.c b/board/snow/board.c index 1e29c3ebed..10bb68f247 100644 --- a/board/snow/board.c +++ b/board/snow/board.c @@ -183,7 +183,7 @@ enum { BUS_WAIT_RETRY_US = 3000, /* Time to wait until the bus becomes free */ - BUS_WAIT_FREE_US = 50 * 1000, + BUS_WAIT_FREE_US = 100 * 1000, }; #ifdef CONFIG_ARBITRATE_I2C @@ -231,6 +231,10 @@ int board_i2c_claim(int port) usleep(BUS_WAIT_RETRY_US); } while (time_since32(start) < BUS_WAIT_FREE_US); + gpio_set_level(GPIO_EC_CLAIM, 1); + usleep(BUS_SLEW_DELAY_US); + + panic_puts("Unable to access I2C bus (arbitration timeout)\n"); return EC_ERROR_BUSY; } @@ -239,6 +243,7 @@ void board_i2c_release(int port) if (port == I2C_PORT_HOST) { /* Release our claim */ gpio_set_level(GPIO_EC_CLAIM, 1); + usleep(BUS_SLEW_DELAY_US); } } #endif /* CONFIG_ARBITRATE_I2C */ |