drivers/clock_control: stm32: HSE_BYPASS code cleanup
Rework CONFIG_CLOCK_STM32_HSE_BYPASS related code to make this part of the code more readable. Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
This commit is contained in:
parent
9631709ca4
commit
157fb6af72
2 changed files with 16 additions and 14 deletions
|
@ -350,11 +350,13 @@ static int stm32_clock_control_init(struct device *dev)
|
|||
LL_RCC_MSI_Disable();
|
||||
|
||||
#elif CONFIG_CLOCK_STM32_PLL_SRC_HSE
|
||||
int hse_bypass = LL_UTILS_HSEBYPASS_OFF;
|
||||
int hse_bypass;
|
||||
|
||||
#ifdef CONFIG_CLOCK_STM32_HSE_BYPASS
|
||||
if (IS_ENABLED(CONFIG_CLOCK_STM32_HSE_BYPASS)) {
|
||||
hse_bypass = LL_UTILS_HSEBYPASS_ON;
|
||||
#endif /* CONFIG_CLOCK_STM32_HSE_BYPASS */
|
||||
} else {
|
||||
hse_bypass = LL_UTILS_HSEBYPASS_OFF;
|
||||
}
|
||||
|
||||
/* Switch to PLL with HSE as clock source */
|
||||
LL_PLL_ConfigSystemClock_HSE(
|
||||
|
@ -376,11 +378,11 @@ static int stm32_clock_control_init(struct device *dev)
|
|||
/* Enable HSE if not enabled */
|
||||
if (LL_RCC_HSE_IsReady() != 1) {
|
||||
/* Check if need to enable HSE bypass feature or not */
|
||||
#ifdef CONFIG_CLOCK_STM32_HSE_BYPASS
|
||||
if (IS_ENABLED(CONFIG_CLOCK_STM32_HSE_BYPASS)) {
|
||||
LL_RCC_HSE_EnableBypass();
|
||||
#else
|
||||
} else {
|
||||
LL_RCC_HSE_DisableBypass();
|
||||
#endif /* CONFIG_CLOCK_STM32_HSE_BYPASS */
|
||||
}
|
||||
|
||||
/* Enable HSE */
|
||||
LL_RCC_HSE_Enable();
|
||||
|
|
|
@ -220,11 +220,11 @@ static int stm32_clock_control_init(struct device *dev)
|
|||
|
||||
#ifdef CONFIG_CLOCK_STM32_PLL_SRC_HSE
|
||||
|
||||
#ifdef CONFIG_CLOCK_STM32_HSE_BYPASS
|
||||
if (IS_ENABLED(CONFIG_CLOCK_STM32_HSE_BYPASS)) {
|
||||
LL_RCC_HSE_EnableBypass();
|
||||
#else
|
||||
} else {
|
||||
LL_RCC_HSE_DisableBypass();
|
||||
#endif /* CONFIG_CLOCK_STM32_HSE_BYPASS */
|
||||
}
|
||||
|
||||
/* Enable HSE oscillator */
|
||||
LL_RCC_HSE_Enable();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue