1 /* 2 * 3 * Copyright (c) 2019 Ilya Tagunov 4 * Copyright (c) 2019 STMicroelectronics 5 * 6 * SPDX-License-Identifier: Apache-2.0 7 */ 8 9 10 #include <soc.h> 11 #include <stm32_ll_bus.h> 12 #include <stm32_ll_rcc.h> 13 #include <stm32_ll_utils.h> 14 #include <drivers/clock_control.h> 15 #include <sys/util.h> 16 #include <drivers/clock_control/stm32_clock_control.h> 17 #include "clock_stm32_ll_common.h" 18 19 20 #if STM32_SYSCLK_SRC_PLL 21 22 /* Macros to fill up multiplication and division factors values */ 23 #define z_pll_div(v) LL_RCC_PLLM_DIV_ ## v 24 #define pll_div(v) z_pll_div(v) 25 26 #define z_pllr(v) LL_RCC_PLLR_DIV_ ## v 27 #define pllr(v) z_pllr(v) 28 29 /** 30 * @brief Fill PLL configuration structure 31 */ config_pll_init(LL_UTILS_PLLInitTypeDef * pllinit)32void config_pll_init(LL_UTILS_PLLInitTypeDef *pllinit) 33 { 34 pllinit->PLLN = STM32_PLL_N_MULTIPLIER; 35 pllinit->PLLM = pll_div(STM32_PLL_M_DIVISOR); 36 pllinit->PLLR = pllr(STM32_PLL_R_DIVISOR); 37 } 38 #endif /* STM32_SYSCLK_SRC_PLL */ 39 40 /** 41 * @brief Activate default clocks 42 */ config_enable_default_clocks(void)43void config_enable_default_clocks(void) 44 { 45 /* Enable the power interface clock */ 46 LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_PWR); 47 } 48 49 /** 50 * @brief Function kept for driver genericity 51 */ LL_RCC_MSI_Disable(void)52void LL_RCC_MSI_Disable(void) 53 { 54 /* Do nothing */ 55 } 56