From fc41846935c21b1f1c07feac75cc377703798e86 Mon Sep 17 00:00:00 2001 From: Francois Ramu Date: Mon, 8 Feb 2021 14:18:55 +0100 Subject: [PATCH] drivers: clock: stm32 clock control with low power modes This will export the stm32_clock_control_init function to restore the clocks after the low power modes. Signed-off-by: Francois Ramu --- drivers/clock_control/clock_stm32_ll_common.c | 15 ++++++++++++++- drivers/clock_control/clock_stm32_ll_common.h | 5 +++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/clock_control/clock_stm32_ll_common.c b/drivers/clock_control/clock_stm32_ll_common.c index a047f681ff3..aabd3e1630f 100644 --- a/drivers/clock_control/clock_stm32_ll_common.c +++ b/drivers/clock_control/clock_stm32_ll_common.c @@ -318,7 +318,20 @@ static inline void stm32_clock_control_mco_init(void) #endif /* CONFIG_CLOCK_STM32_MCO2_SRC_NOCLOCK */ } -static int stm32_clock_control_init(const struct device *dev) + +/** + * @brief Initialize clocks for the stm32 + * + * This routine is called to enable and configure the clocks and PLL + * of the soc on the board. It depends on the board definition. + * This function is called on the startup and also to restore the config + * when exiting for low power mode. + * + * @param dev clock device struct + * + * @return 0 + */ +int stm32_clock_control_init(const struct device *dev) { LL_UTILS_ClkInitTypeDef s_ClkInitStruct; uint32_t hclk_prescaler; diff --git a/drivers/clock_control/clock_stm32_ll_common.h b/drivers/clock_control/clock_stm32_ll_common.h index 768fb295e6c..8baec85dd21 100644 --- a/drivers/clock_control/clock_stm32_ll_common.h +++ b/drivers/clock_control/clock_stm32_ll_common.h @@ -30,10 +30,15 @@ #define MCO2_SOURCE LL_RCC_MCO2SOURCE_PLLCLK #endif +#ifdef CONFIG_CLOCK_STM32_SYSCLK_SRC_PLL void config_pll_init(LL_UTILS_PLLInitTypeDef *pllinit); +#endif /* CONFIG_CLOCK_STM32_SYSCLK_SRC_PLL */ void config_enable_default_clocks(void); /* Section for functions not available in every Cube packages */ void LL_RCC_MSI_Disable(void); +/* function exported to the soc power.c */ +int stm32_clock_control_init(const struct device *dev); + #endif /* ZEPHYR_DRIVERS_CLOCK_CONTROL_STM32_LL_CLOCK_H_ */