Skip to content

Commit 132289e

Browse files
mihnenkartben
authored andcommitted
drivers: entropy: stm32: fix compile errors for STM32L4 series
The low level function names in the stm32l4xx low level driver are different than all the other stm32's even though the functionality is the same. This breaks the entropy module for these parts. This patch fixes the build and has been tested on a custom stm32l4p5 board. This STM32CubeL4 issue has been reported (ST Internal Reference: 207828). Fixes: #88621 Signed-off-by: Matt Ihnen <matt.ihnen@gmail.com>
1 parent 0d547d4 commit 132289e

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

drivers/entropy/entropy_stm32.c

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,10 +232,17 @@ static void configure_rng(void)
232232
LL_RNG_SetHealthConfig(rng, desired_htcr);
233233
#endif /* health_test_config */
234234

235+
#if defined(CONFIG_SOC_SERIES_STM32L4X)
236+
LL_RNG_ResetConditioningResetBit(rng);
237+
/* Wait for conditioning reset process to be completed */
238+
while (LL_RNG_IsResetConditioningBitSet(rng) == 1) {
239+
}
240+
#else
235241
LL_RNG_DisableCondReset(rng);
236242
/* Wait for conditioning reset process to be completed */
237243
while (LL_RNG_IsEnabledCondReset(rng) == 1) {
238244
}
245+
#endif /* CONFIG_SOC_SERIES_STM32L4X */
239246
}
240247
#endif /* STM32_CONDRST_SUPPORT */
241248

@@ -285,13 +292,23 @@ static int recover_seed_error(RNG_TypeDef *rng)
285292
{
286293
uint32_t count_timeout = 0;
287294

288-
LL_RNG_EnableCondReset(rng);
289-
LL_RNG_DisableCondReset(rng);
295+
#if defined(CONFIG_SOC_SERIES_STM32L4X)
296+
LL_RNG_SetConditioningResetBit(rng);
297+
LL_RNG_ResetConditioningResetBit(rng);
298+
#else
299+
LL_RNG_EnableCondReset(rng);
300+
LL_RNG_DisableCondReset(rng);
301+
#endif /* CONFIG_SOC_SERIES_STM32L4X */
302+
290303
/* When reset process is done cond reset bit is read 0
291304
* This typically takes: 2 AHB clock cycles + 2 RNG clock cycles.
292305
*/
293306

307+
#if defined(CONFIG_SOC_SERIES_STM32L4X)
308+
while (LL_RNG_IsResetConditioningBitSet(rng) ||
309+
#else
294310
while (LL_RNG_IsEnabledCondReset(rng) ||
311+
#endif /* CONFIG_SOC_SERIES_STM32L4X */
295312
ll_rng_is_active_seis(rng) ||
296313
ll_rng_is_active_secs(rng)) {
297314
count_timeout++;

0 commit comments

Comments
 (0)