Message ID | 20220815111905.4090289-2-jorge@foundries.io |
---|---|
State | Superseded |
Delegated to: | Patrice Chotard |
Headers | show |
Series | [1/2] i2c: stm32f7: fix clearing the control register | expand |
Jorge, On Mon, Aug 15, 2022 at 2:19 PM Jorge Ramirez-Ortiz <jorge@foundries.io> wrote: > > Sending the stop condition without waiting for TC has been > found to lock the bus. > > Tested accessing the the NXP SE05X I2C device. "the the" seems like a typo. With this, Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io> > Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io> > --- > drivers/i2c/stm32f7_i2c.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/drivers/i2c/stm32f7_i2c.c b/drivers/i2c/stm32f7_i2c.c > index 3a727e68ac..14827e5cec 100644 > --- a/drivers/i2c/stm32f7_i2c.c > +++ b/drivers/i2c/stm32f7_i2c.c > @@ -485,9 +485,11 @@ static int stm32_i2c_message_xfer(struct stm32_i2c_priv *i2c_priv, > } > } > > - /* End of transfer, send stop condition */ > - mask = STM32_I2C_CR2_STOP; > - setbits_le32(®s->cr2, mask); > + if (!ret) { > + /* End of transfer, send stop condition */ > + mask = STM32_I2C_CR2_STOP; > + setbits_le32(®s->cr2, mask); > + } > > return stm32_i2c_check_end_of_message(i2c_priv); > } > -- > 2.34.1 >
diff --git a/drivers/i2c/stm32f7_i2c.c b/drivers/i2c/stm32f7_i2c.c index 3a727e68ac..14827e5cec 100644 --- a/drivers/i2c/stm32f7_i2c.c +++ b/drivers/i2c/stm32f7_i2c.c @@ -485,9 +485,11 @@ static int stm32_i2c_message_xfer(struct stm32_i2c_priv *i2c_priv, } } - /* End of transfer, send stop condition */ - mask = STM32_I2C_CR2_STOP; - setbits_le32(®s->cr2, mask); + if (!ret) { + /* End of transfer, send stop condition */ + mask = STM32_I2C_CR2_STOP; + setbits_le32(®s->cr2, mask); + } return stm32_i2c_check_end_of_message(i2c_priv); }
Sending the stop condition without waiting for TC has been found to lock the bus. Tested accessing the the NXP SE05X I2C device. Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io> --- drivers/i2c/stm32f7_i2c.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)