diff options
Diffstat (limited to 'chip/stm32/i2c-stm32f0.c')
-rw-r--r-- | chip/stm32/i2c-stm32f0.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/chip/stm32/i2c-stm32f0.c b/chip/stm32/i2c-stm32f0.c index 47393fc209..01e3269263 100644 --- a/chip/stm32/i2c-stm32f0.c +++ b/chip/stm32/i2c-stm32f0.c @@ -50,14 +50,15 @@ static int wait_isr(int port, int mask) while (get_time().val < timeout) { int isr = STM32_I2C_ISR(port); + /* Check for errors */ + if (isr & (STM32_I2C_ISR_ARLO | STM32_I2C_ISR_BERR | + STM32_I2C_ISR_NACK)) + return EC_ERROR_UNKNOWN; + /* Check for desired mask */ if ((isr & mask) == mask) return EC_SUCCESS; - /* Check for errors */ - if (isr & (STM32_I2C_ISR_ARLO | STM32_I2C_ISR_BERR)) - return EC_ERROR_UNKNOWN; - /* I2C is slow, so let other things run while we wait */ usleep(100); } |