Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

i2c: stm32f7: fix configuration of the digital filter

The digital filter related computation are present in the driver
however the programming of the filter within the IP is missing.
The maximum value for the DNF is wrong and should be 15 instead of 16.

Fixes: aeb068c57214 ("i2c: i2c-stm32f7: add driver")

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Signed-off-by: Pierre-Yves MORDRET <pierre-yves.mordret@foss.st.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>

authored by

Alain Volmat and committed by
Wolfram Sang
3d6a3d3a 92bf2261

+10 -1
+10 -1
drivers/i2c/busses/i2c-stm32f7.c
··· 57 #define STM32F7_I2C_CR1_RXDMAEN BIT(15) 58 #define STM32F7_I2C_CR1_TXDMAEN BIT(14) 59 #define STM32F7_I2C_CR1_ANFOFF BIT(12) 60 #define STM32F7_I2C_CR1_ERRIE BIT(7) 61 #define STM32F7_I2C_CR1_TCIE BIT(6) 62 #define STM32F7_I2C_CR1_STOPIE BIT(5) ··· 162 }; 163 164 #define STM32F7_I2C_DNF_DEFAULT 0 165 - #define STM32F7_I2C_DNF_MAX 16 166 167 #define STM32F7_I2C_ANALOG_FILTER_ENABLE 1 168 #define STM32F7_I2C_ANALOG_FILTER_DELAY_MIN 50 /* ns */ ··· 727 else 728 stm32f7_i2c_set_bits(i2c_dev->base + STM32F7_I2C_CR1, 729 STM32F7_I2C_CR1_ANFOFF); 730 stm32f7_i2c_set_bits(i2c_dev->base + STM32F7_I2C_CR1, 731 STM32F7_I2C_CR1_PE); 732 }
··· 57 #define STM32F7_I2C_CR1_RXDMAEN BIT(15) 58 #define STM32F7_I2C_CR1_TXDMAEN BIT(14) 59 #define STM32F7_I2C_CR1_ANFOFF BIT(12) 60 + #define STM32F7_I2C_CR1_DNF_MASK GENMASK(11, 8) 61 + #define STM32F7_I2C_CR1_DNF(n) (((n) & 0xf) << 8) 62 #define STM32F7_I2C_CR1_ERRIE BIT(7) 63 #define STM32F7_I2C_CR1_TCIE BIT(6) 64 #define STM32F7_I2C_CR1_STOPIE BIT(5) ··· 160 }; 161 162 #define STM32F7_I2C_DNF_DEFAULT 0 163 + #define STM32F7_I2C_DNF_MAX 15 164 165 #define STM32F7_I2C_ANALOG_FILTER_ENABLE 1 166 #define STM32F7_I2C_ANALOG_FILTER_DELAY_MIN 50 /* ns */ ··· 725 else 726 stm32f7_i2c_set_bits(i2c_dev->base + STM32F7_I2C_CR1, 727 STM32F7_I2C_CR1_ANFOFF); 728 + 729 + /* Program the Digital Filter */ 730 + stm32f7_i2c_clr_bits(i2c_dev->base + STM32F7_I2C_CR1, 731 + STM32F7_I2C_CR1_DNF_MASK); 732 + stm32f7_i2c_set_bits(i2c_dev->base + STM32F7_I2C_CR1, 733 + STM32F7_I2C_CR1_DNF(i2c_dev->setup.dnf)); 734 + 735 stm32f7_i2c_set_bits(i2c_dev->base + STM32F7_I2C_CR1, 736 STM32F7_I2C_CR1_PE); 737 }