Skip to content

Commit 1a8a2bc

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 external flash through the xspi. It must not disable its own clock source. Signed-off-by: Francois Ramu <[email protected]>
1 parent 1ceaf00 commit 1a8a2bc

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

drivers/clock_control/clock_stm32_ll_h5.c

+21
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,21 @@ 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
@@ -445,6 +460,12 @@ static int set_up_plls(void)
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)