drivers: clocks_control: stm32wba: Fix erratum 2.2.4

Cf Errata sheet, 2.2.4: With HSE active, switching the system clock source
from any other source to HSI, spuriously deactivates HSE.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
This commit is contained in:
Erwan Gouriou 2024-03-13 17:22:51 +01:00 committed by Fabio Baltieri
parent 930e03fdfd
commit fa4ab81f40

View file

@ -346,6 +346,22 @@ static void stm32_clock_switch_to_hsi(void)
LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_HSI);
while (LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_HSI) {
}
/* Erratum 2.2.4: Spurious deactivation of HSE when HSI is selected as
* system clock source
* Re-enable HSE clock if required after switch source to HSI
*/
if (IS_ENABLED(STM32_HSE_ENABLED)) {
if (IS_ENABLED(STM32_HSE_DIV2)) {
LL_RCC_HSE_EnablePrescaler();
}
/* Enable HSE */
LL_RCC_HSE_Enable();
while (LL_RCC_HSE_IsReady() != 1) {
/* Wait for HSE ready */
}
}
}
__unused