Merged in david_s5/arch/upstream_to_greg (pull request #54)
Ensures frequency is updated on reinitalized bus
This commit is contained in:
commit
36edaaa502
@ -1556,6 +1556,11 @@ static int stm32_i2c_init(FAR struct stm32_i2c_priv_s *priv)
|
||||
*/
|
||||
|
||||
stm32_i2c_putreg(priv, STM32_I2C_CR2_OFFSET, (STM32_PCLK1_FREQUENCY / 1000000));
|
||||
|
||||
/* Force a frequency update */
|
||||
|
||||
priv->frequency = 0;
|
||||
|
||||
stm32_i2c_setclock(priv, 100000);
|
||||
|
||||
/* Enable I2C */
|
||||
@ -1829,6 +1834,7 @@ static int stm32_i2c_reset(FAR struct i2c_master_s *dev)
|
||||
uint32_t scl_gpio;
|
||||
uint32_t sda_gpio;
|
||||
int ret = ERROR;
|
||||
uint32_t freqency;
|
||||
|
||||
ASSERT(dev);
|
||||
|
||||
@ -1840,6 +1846,10 @@ static int stm32_i2c_reset(FAR struct i2c_master_s *dev)
|
||||
|
||||
stm32_i2c_sem_wait(priv);
|
||||
|
||||
/* Save the current frequency */
|
||||
|
||||
freqency = priv->frequency;
|
||||
|
||||
/* De-init the port */
|
||||
|
||||
stm32_i2c_deinit(priv);
|
||||
@ -1918,6 +1928,10 @@ static int stm32_i2c_reset(FAR struct i2c_master_s *dev)
|
||||
/* Re-init the port */
|
||||
|
||||
stm32_i2c_init(priv);
|
||||
|
||||
/* Restore the frequecncy */
|
||||
|
||||
stm32_i2c_setclock(priv, freqency);
|
||||
ret = OK;
|
||||
|
||||
out:
|
||||
|
Loading…
Reference in New Issue
Block a user