From d04802283be69d94d4542955a8465d451522e54b Mon Sep 17 00:00:00 2001 From: Erwan Gouriou Date: Tue, 22 Mar 2022 14:36:23 +0100 Subject: [PATCH] drivers/clock_control: stm32 common: Don't disable fixed clocks Each clock should be configured individually by device tree, don't disable them blindly. Signed-off-by: Erwan Gouriou --- drivers/clock_control/clock_stm32_ll_common.c | 26 ------------------- drivers/clock_control/clock_stm32_ll_common.h | 3 --- drivers/clock_control/clock_stm32f0_f3.c | 8 ------ drivers/clock_control/clock_stm32f1.c | 8 ------ drivers/clock_control/clock_stm32f2_f4_f7.c | 8 ------ drivers/clock_control/clock_stm32g0.c | 8 ------ drivers/clock_control/clock_stm32g4.c | 8 ------ 7 files changed, 69 deletions(-) diff --git a/drivers/clock_control/clock_stm32_ll_common.c b/drivers/clock_control/clock_stm32_ll_common.c index c83851d8fa1..58875f88214 100644 --- a/drivers/clock_control/clock_stm32_ll_common.c +++ b/drivers/clock_control/clock_stm32_ll_common.c @@ -463,18 +463,10 @@ int stm32_clock_control_init(const struct device *dev) /* Switch to PLL with MSI as clock source */ LL_PLL_ConfigSystemClock_MSI(&s_PLLInitStruct, &s_ClkInitStruct); - /* Disable other clocks */ - LL_RCC_HSI_Disable(); - LL_RCC_HSE_Disable(); - #elif STM32_PLL_SRC_HSI /* Switch to PLL with HSI as clock source */ LL_PLL_ConfigSystemClock_HSI(&s_PLLInitStruct, &s_ClkInitStruct); - /* Disable other clocks */ - LL_RCC_HSE_Disable(); - LL_RCC_MSI_Disable(); - #elif STM32_PLL_SRC_HSE #ifndef CONFIG_SOC_SERIES_STM32WLX @@ -504,10 +496,6 @@ int stm32_clock_control_init(const struct device *dev) &s_PLLInitStruct, &s_ClkInitStruct); - /* Disable other clocks */ - LL_RCC_HSI_Disable(); - LL_RCC_MSI_Disable(); - #endif /* STM32_PLL_SRC_* */ #elif STM32_SYSCLK_SRC_HSE @@ -594,11 +582,6 @@ int stm32_clock_control_init(const struct device *dev) LL_SetFlashLatency(new_flash_freq); } - /* Disable other clocks */ - LL_RCC_HSI_Disable(); - LL_RCC_MSI_Disable(); - LL_RCC_PLL_Disable(); - #elif STM32_SYSCLK_SRC_MSI old_flash_freq = RCC_CALC_FLASH_FREQ(HAL_RCC_GetSysClockFreq(), @@ -677,11 +660,6 @@ int stm32_clock_control_init(const struct device *dev) LL_SetFlashLatency(new_flash_freq); } - /* Disable other clocks */ - LL_RCC_HSE_Disable(); - LL_RCC_HSI_Disable(); - LL_RCC_PLL_Disable(); - #elif STM32_SYSCLK_SRC_HSI stm32_clock_switch_to_hsi(hclk_prescaler); @@ -710,10 +688,6 @@ int stm32_clock_control_init(const struct device *dev) /* HSI used as SYSCLK, set latency to 0 */ LL_FLASH_SetLatency(LL_FLASH_LATENCY_0); - /* Disable other clocks */ - LL_RCC_HSE_Disable(); - LL_RCC_MSI_Disable(); - LL_RCC_PLL_Disable(); #endif /* STM32_SYSCLK_SRC_... */ diff --git a/drivers/clock_control/clock_stm32_ll_common.h b/drivers/clock_control/clock_stm32_ll_common.h index 5d7d88a8313..b5d375d9ecb 100644 --- a/drivers/clock_control/clock_stm32_ll_common.h +++ b/drivers/clock_control/clock_stm32_ll_common.h @@ -37,9 +37,6 @@ void config_pll_init(LL_UTILS_PLLInitTypeDef *pllinit); #endif /* 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); diff --git a/drivers/clock_control/clock_stm32f0_f3.c b/drivers/clock_control/clock_stm32f0_f3.c index 956cf7490de..441e1c8c483 100644 --- a/drivers/clock_control/clock_stm32f0_f3.c +++ b/drivers/clock_control/clock_stm32f0_f3.c @@ -76,11 +76,3 @@ void config_enable_default_clocks(void) #endif #endif /* !CONFIG_SOC_SERIES_STM32F3X */ } - -/** - * @brief Function kept for driver genericity - */ -void LL_RCC_MSI_Disable(void) -{ - /* Do nothing */ -} diff --git a/drivers/clock_control/clock_stm32f1.c b/drivers/clock_control/clock_stm32f1.c index af789aba601..c6c48e7bbcd 100644 --- a/drivers/clock_control/clock_stm32f1.c +++ b/drivers/clock_control/clock_stm32f1.c @@ -98,11 +98,3 @@ void config_enable_default_clocks(void) { /* Nothing for now */ } - -/** - * @brief Function kept for driver genericity - */ -void LL_RCC_MSI_Disable(void) -{ - /* Do nothing */ -} diff --git a/drivers/clock_control/clock_stm32f2_f4_f7.c b/drivers/clock_control/clock_stm32f2_f4_f7.c index 5e1c9a87cde..506d8b1b555 100644 --- a/drivers/clock_control/clock_stm32f2_f4_f7.c +++ b/drivers/clock_control/clock_stm32f2_f4_f7.c @@ -44,11 +44,3 @@ void config_enable_default_clocks(void) /* Power Interface clock enabled by default */ LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_PWR); } - -/** - * @brief Function kept for driver genericity - */ -void LL_RCC_MSI_Disable(void) -{ - /* Do nothing */ -} diff --git a/drivers/clock_control/clock_stm32g0.c b/drivers/clock_control/clock_stm32g0.c index 464cd598243..76946b6420a 100644 --- a/drivers/clock_control/clock_stm32g0.c +++ b/drivers/clock_control/clock_stm32g0.c @@ -45,11 +45,3 @@ void config_enable_default_clocks(void) /* Enable the power interface clock */ LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_PWR); } - -/** - * @brief Function kept for driver genericity - */ -void LL_RCC_MSI_Disable(void) -{ - /* Do nothing */ -} diff --git a/drivers/clock_control/clock_stm32g4.c b/drivers/clock_control/clock_stm32g4.c index c392abbee51..94687d86746 100644 --- a/drivers/clock_control/clock_stm32g4.c +++ b/drivers/clock_control/clock_stm32g4.c @@ -67,11 +67,3 @@ void config_enable_default_clocks(void) LL_PWR_DisableBkUpAccess(); #endif } - -/** - * @brief Function kept for driver genericity - */ -void LL_RCC_MSI_Disable(void) -{ - /* Do nothing */ -}