Skip to content

Commit 86df576

Browse files
committed
drivers: clock: stm32H5 clock control of the PLL in memoryMapped mode
Do not disable the pll clock if it source the xspi and if the external flash is executing in Place. On mcuboot reset, the code is executed on the exteranl flash through the xspi. Signed-off-by: Francois Ramu <[email protected]>
1 parent 7c46f0a commit 86df576

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

drivers/clock_control/clock_stm32_ll_h5.c

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,17 +434,38 @@ static int set_up_plls(void)
434434
#endif
435435

436436
#if defined(STM32_PLL_ENABLED)
437+
438+
#if defined(CONFIG_STM32_MEMMAP) && defined(CONFIG_BOOTLOADER_MCUBOOT)
439+
/*
440+
* Don't disable PLL during application initialization
441+
* that runs in memmap mode when (Q/O)SPI uses PLL
442+
* as its clock source.
443+
*/
444+
#if defined(XSPI1) || defined(XSPI2)
445+
if (LL_RCC_GetOSPIClockSource(LL_RCC_OSPI_CLKSOURCE) != LL_RCC_OSPI_CLKSOURCE_PLL1Q) {
446+
LL_RCC_PLL1_Disable();
447+
}
448+
if (LL_RCC_GetOSPIClockSource(LL_RCC_OSPI_CLKSOURCE) != LL_RCC_OSPI_CLKSOURCE_PLL2R) {
449+
LL_RCC_PLL2_Disable();
450+
}
451+
#else
437452
/*
438453
* Switch to HSI and disable the PLL before configuration.
439454
* (Switching to HSI makes sure we have a SYSCLK source in
440455
* case we're currently running from the PLL we're about to
441456
* turn off and reconfigure.)
442457
*/
443-
if (LL_RCC_GetSysClkSource() == LL_RCC_SYS_CLKSOURCE_STATUS_PLL1) {
458+
if (LL_RCC_GetSysClkSource() == LL_RCC_SYS_CLKSOURCE_STATUS_PLL1) {
444459
clock_switch_to_hsi();
445460
}
446461

447462
LL_RCC_PLL1_Disable();
463+
LL_RCC_PLL2_Disable();
464+
#endif
465+
#else
466+
LL_RCC_PLL1_Disable();
467+
LL_RCC_PLL2_Disable();
468+
#endif
448469

449470
/* Configure PLL source : Can be HSE, HSI, MSIS */
450471
if (IS_ENABLED(STM32_PLL_SRC_HSE)) {

0 commit comments

Comments
 (0)