summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Anderson <dianders@chromium.org>2014-05-01 14:19:32 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-05-06 00:08:22 +0000
commit6ed3fe80b2c3320bb49dbb23286316d1a3d5616c (patch)
tree94175cf57f5c28e099a46de0cf7e78a71ef36bb9
parentc9cedde125d1450a1275d853942f981c3b192a9e (diff)
downloadchrome-ec-stabilize-5828.0.B.tar.gz
i2c: stm32l: Increase timeout from 10ms to 30msstabilize-5828.0.B
We found some cases where the battery can flip out and get confused and hold the i2c lines. Since the battery is actually smbus it will give up after 25ms. Increase our timeout to 30ms so that the next trasaction will work OK. BRANCH=ToT BUG=chrome-os-partner:28425 TEST=Revert (1cd618e Wait for battery boot-up) and use a problematic battery; see boot works OK. Change-Id: Ife051220cbbbd49d7bc9c8607ba177cd9582fe58 Signed-off-by: Doug Anderson <dianders@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/198212 Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r--chip/stm32/i2c-stm32f.c6
-rw-r--r--chip/stm32/i2c-stm32l.c6
2 files changed, 10 insertions, 2 deletions
diff --git a/chip/stm32/i2c-stm32f.c b/chip/stm32/i2c-stm32f.c
index 6c7f58556c..851209557b 100644
--- a/chip/stm32/i2c-stm32f.c
+++ b/chip/stm32/i2c-stm32f.c
@@ -44,9 +44,13 @@
* mode). The slave is supposed to wait forever for the master to read bytes.
* ...but we're going to keep the timeout to make sure we're robust. It may in
* fact be needed if the host resets itself mid-read.
+ *
+ * NOTE: One case where this timeout is useful is when the battery
+ * flips out. The battery may flip out and hold lines low for up to
+ * 25ms. If we just wait it will eventually let them go.
*/
#define I2C_TX_TIMEOUT_SLAVE (100 * MSEC)
-#define I2C_TX_TIMEOUT_MASTER (10 * MSEC)
+#define I2C_TX_TIMEOUT_MASTER (30 * MSEC)
/*
* We delay 5us in bitbang mode. That gives us 5us low and 5us high or
diff --git a/chip/stm32/i2c-stm32l.c b/chip/stm32/i2c-stm32l.c
index 8c256d5cb4..b2f528aa4f 100644
--- a/chip/stm32/i2c-stm32l.c
+++ b/chip/stm32/i2c-stm32l.c
@@ -34,8 +34,12 @@
* mode). The slave is supposed to wait forever for the master to read bytes.
* ...but we're going to keep the timeout to make sure we're robust. It may in
* fact be needed if the host resets itself mid-read.
+ *
+ * NOTE: One case where this timeout is useful is when the battery
+ * flips out. The battery may flip out and hold lines low for up to
+ * 25ms. If we just wait it will eventually let them go.
*/
-#define I2C_TX_TIMEOUT_MASTER (10 * MSEC)
+#define I2C_TX_TIMEOUT_MASTER (30 * MSEC)
/*
* Delay 5us in bitbang mode. That gives us roughly 5us low and 5us high or