Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers: entropy: stm32: clear data available IRQ flag on WB09 #87364

Merged

Conversation

mathieuchopstm
Copy link
Collaborator

The STM32WB09 TRNG does not clear FIFO_FULL IRQ flag in hardware once the FIFO is no longer full, a behavior which differs from all other series. This results in spurious IRQs, as the TRNG IRQ line effectively remains high forever once a single interrupt has been generated.

Clear the flag in software after reading from the FIFO on STM32WB09 SoC.

N.B.: the error IRQ flag is already handled properly, as this flag must also be cleared by software on other series.

@mathieuchopstm mathieuchopstm force-pushed the wb09_trng_acknowledge_irq branch from e9150d1 to 9e49fd2 Compare March 20, 2025 12:40
@mathieuchopstm
Copy link
Collaborator Author

Modified to take @etienne-lms comment into account + added small refactor to make header more readable.

Tested OK on WB05, WB09 and H7 after refactor.

Copy link
Collaborator

@etienne-lms etienne-lms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM aside indentation issues.

CONFIG_SOC_STM32WB09XX implies CONFIG_SOC_SERIES_STM32WB0X, making it
pointless to assert the latter is defined before checking the former.

Simplify #ifdef checks in the entropy driver's LL wrappers thanks to
this observation, by removing unnecessary nesting.

Signed-off-by: Mathieu Choplain <mathieu.choplain@st.com>
The STM32WB09 TRNG does not clear FIFO_FULL IRQ flag in hardware once the
FIFO is no longer full, a behavior which differs from all other series.
This results in spurious IRQs, as the TRNG IRQ line effectively remains
high forever once a single interrupt has been generated.

Clear the flag in software after reading from the FIFO on STM32WB09 SoC.

N.B.: the error IRQ flag is already handled properly, as this flag must
also be cleared by software on other series.

Signed-off-by: Mathieu Choplain <mathieu.choplain@st.com>
@mathieuchopstm mathieuchopstm force-pushed the wb09_trng_acknowledge_irq branch from 9e49fd2 to 921e90c Compare March 20, 2025 14:07
@tomi-font tomi-font removed their request for review March 24, 2025 10:24
@kartben kartben merged commit 7288223 into zephyrproject-rtos:main Mar 24, 2025
21 checks passed
@mathieuchopstm mathieuchopstm deleted the wb09_trng_acknowledge_irq branch March 25, 2025 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants