diff options
author | Vincent Palatin <vpalatin@chromium.org> | 2012-05-22 21:39:43 +0000 |
---|---|---|
committer | Vincent Palatin <vpalatin@chromium.org> | 2012-05-22 21:42:36 +0000 |
commit | 4a7774c1226b5af2ae99d753902be4a84e55955f (patch) | |
tree | 1fdf9d077fa6772fc56fe8a34dc7da34e2a5eb9a | |
parent | d819f6cee4f212d95e375a5fda8a08725909b89b (diff) | |
download | chrome-ec-4a7774c1226b5af2ae99d753902be4a84e55955f.tar.gz |
stm32: ensure I2C properly behave after sysjump
Sometimes when requesting a sysjump from the AP, the I2C bus gets
wedged. Ensure we restore it in a proper state during the driver
initialization.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BUG=chrome-os-partner:8865
TEST=On Snow, use flashrom to program the EC.
Change-Id: I6279afba2bdeed4473ace42220a0342c4addaf1d
-rw-r--r-- | chip/stm32/i2c.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/chip/stm32/i2c.c b/chip/stm32/i2c.c index 2ccecdba16..e1018ed31b 100644 --- a/chip/stm32/i2c.c +++ b/chip/stm32/i2c.c @@ -176,6 +176,12 @@ static int i2c_init2(void) /* enable I2C2 clock */ STM32_RCC_APB1ENR |= 1 << 22; + /* force reset if the bus is stuck in BUSY state */ + if (STM32_I2C_SR2(I2C2) & 0x2) { + STM32_I2C_CR1(I2C2) = 0x8000; + STM32_I2C_CR1(I2C2) = 0x0000; + } + /* set clock configuration : standard mode (100kHz) */ STM32_I2C_CCR(I2C2) = I2C_CCR; |