Skip to content

drivers: clock_control: stm32h7: disable PLLs before configuration and guard for XIP #75655

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions drivers/clock_control/clock_stm32_ll_h7.c
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,36 @@ static int set_up_plls(void)
stm32_clock_switch_to_hsi();
LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_1);
}

#if defined(CONFIG_STM32_MEMMAP) && defined(CONFIG_BOOTLOADER_MCUBOOT)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non blocking: I wonder about the use of CONFIG_BOOTLOADER_MCUBOOT which restricts usage of this code to MCUBoot while code should be compatible with any other bootloader.

Copy link
Collaborator Author

@GeorgeCGV GeorgeCGV Sep 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, using CONFIG_BOOTLOADER_MCUBOOT to differentiate if the app runs by a bootloader is not very clean. That seems to be the only differentiation way as of now. The CONFIG_STM32_MEMMAP is set for both (bootloader and the application). Currently, there is only one supported bootloader.

Maybe it is worth introducing a more generic config? Something agnostic, like CONFIG_CHAINLOADED that could be y by default for BOOTLOADER_MCUBOOT?

Copy link
Member

@erwango erwango Nov 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it is worth introducing a more generic config? Something agnostic, like CONFIG_CHAINLOADED that could be y by default for BOOTLOADER_MCUBOOT

Indeed, I wonder why this isn't already available

/*
* Don't disable PLL during application initialization
* that runs in memmap mode when (Q/O)SPI uses PLL
* as its clock source.
*/
#if defined(OCTOSPI1) || defined(OCTOSPI2)
if (LL_RCC_GetOSPIClockSource(LL_RCC_OSPI_CLKSOURCE) != LL_RCC_OSPI_CLKSOURCE_PLL1Q) {
LL_RCC_PLL1_Disable();
}
if (LL_RCC_GetOSPIClockSource(LL_RCC_OSPI_CLKSOURCE) != LL_RCC_OSPI_CLKSOURCE_PLL2R) {
LL_RCC_PLL2_Disable();
}
#elif defined(QUADSPI)
if (LL_RCC_GetQSPIClockSource(LL_RCC_QSPI_CLKSOURCE) != LL_RCC_QSPI_CLKSOURCE_PLL1Q) {
LL_RCC_PLL1_Disable();
}
if (LL_RCC_GetQSPIClockSource(LL_RCC_QSPI_CLKSOURCE) != LL_RCC_QSPI_CLKSOURCE_PLL2R) {
LL_RCC_PLL2_Disable();
}
#else
LL_RCC_PLL1_Disable();
LL_RCC_PLL2_Disable();
#endif
#else
LL_RCC_PLL1_Disable();
LL_RCC_PLL2_Disable();
#endif
LL_RCC_PLL3_Disable();

/* Configure PLL source */

Expand Down
Loading