Skip to content

Commit f209d35

Browse files
committed
drivers: clock: stm32_ll_h7: Disable clock configuration for XiP
Disables the clock configuration when CONFIG_STM32_APP_IN_EXT_FLASH is set. Instead SystemCoreClock is calculated based on current RCC register configuration (which represents the clock config done by the bootloader). Signed-off-by: Thomas Decker <[email protected]>
1 parent 77f1554 commit f209d35

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/clock_control/clock_stm32_ll_h7.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ static uint32_t get_hclk_frequency(void)
256256

257257
#if !defined(CONFIG_CPU_CORTEX_M4)
258258

259+
__unused
259260
static int32_t prepare_regulator_voltage_scale(void)
260261
{
261262
/* Make sure to put the CPU in highest Voltage scale during clock configuration */
@@ -271,6 +272,7 @@ static int32_t prepare_regulator_voltage_scale(void)
271272
return 0;
272273
}
273274

275+
__unused
274276
static int32_t optimize_regulator_voltage_scale(uint32_t sysclk_freq)
275277
{
276278

@@ -1051,6 +1053,8 @@ int stm32_clock_control_init(const struct device *dev)
10511053
{
10521054
int r = 0;
10531055

1056+
#if !defined(CONFIG_STM32_APP_IN_EXT_FLASH)
1057+
10541058
#if defined(CONFIG_CPU_CORTEX_M7)
10551059
uint32_t old_hclk_freq;
10561060
uint32_t new_hclk_freq;
@@ -1164,6 +1168,11 @@ int stm32_clock_control_init(const struct device *dev)
11641168

11651169
/* Update CMSIS variable */
11661170
SystemCoreClock = CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC;
1171+
1172+
#else /* defined(CONFIG_STM32_APP_IN_EXT_FLASH) */
1173+
/* Calculate SysClock based on RCC register config and clk_hse clock-frequency */
1174+
SystemCoreClock = HAL_RCC_GetSysClockFreq();
1175+
#endif /* defined(CONFIG_STM32_APP_IN_EXT_FLASH) */
11671176

11681177
return r;
11691178
}

0 commit comments

Comments
 (0)