diff options
Diffstat (limited to 'chip/stm32/i2c-stm32l.c')
-rw-r--r-- | chip/stm32/i2c-stm32l.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/chip/stm32/i2c-stm32l.c b/chip/stm32/i2c-stm32l.c index e274207cb8..8b37eb3ef9 100644 --- a/chip/stm32/i2c-stm32l.c +++ b/chip/stm32/i2c-stm32l.c @@ -73,10 +73,6 @@ static int wait_sr1(int port, int mask) while (get_time().val < timeout) { int sr1 = STM32_I2C_SR1(port); - /* Check for desired mask */ - if ((sr1 & mask) == mask) - return EC_SUCCESS; - /* Check for errors */ if (sr1 & (STM32_I2C_SR1_ARLO | STM32_I2C_SR1_BERR | STM32_I2C_SR1_AF)) { @@ -84,6 +80,10 @@ static int wait_sr1(int port, int mask) return EC_ERROR_UNKNOWN; } + /* Check for desired mask */ + if ((sr1 & mask) == mask) + return EC_SUCCESS; + /* I2C is slow, so let other things run while we wait */ usleep(100); } |