drivers: clock_control: stm32u5: Switch to HSI only when needed

When configuring PLL, we should first make sure we're not running on PLL,
and if running on PLL, first switch to a fixed clock before proceeding
with PLL configuration.
Current code is doing the switch systematically which is not useful as
default startup case is to use MSI as sysclk source.
So add a test before doing this switch.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
This commit is contained in:
Erwan Gouriou 2022-07-28 17:19:00 +02:00 committed by Kumar Gala
parent 97d75a6f59
commit eb52d8dca2

View file

@ -425,7 +425,9 @@ static int set_up_plls(void)
* case we're currently running from the PLL we're about to
* turn off and reconfigure.)
*/
clock_switch_to_hsi();
if (LL_RCC_GetSysClkSource() == LL_RCC_SYS_CLKSOURCE_STATUS_PLL1) {
clock_switch_to_hsi();
}
LL_RCC_PLL1_Disable();