2017-01-23 17:45:42 +01:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Copyright (c) 2017 Linaro Limited.
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
2018-09-14 19:43:44 +02:00
|
|
|
#ifndef ZEPHYR_DRIVERS_CLOCK_CONTROL_STM32_LL_CLOCK_H_
|
|
|
|
#define ZEPHYR_DRIVERS_CLOCK_CONTROL_STM32_LL_CLOCK_H_
|
2017-01-23 17:45:42 +01:00
|
|
|
|
2021-03-05 16:28:57 +01:00
|
|
|
#include <stm32_ll_utils.h>
|
|
|
|
|
2018-05-19 10:34:32 +02:00
|
|
|
#if CONFIG_CLOCK_STM32_MCO1_SRC_NOCLOCK
|
|
|
|
#define MCO1_SOURCE LL_RCC_MCO1SOURCE_NOCLOCK
|
|
|
|
#elif CONFIG_CLOCK_STM32_MCO1_SRC_LSE
|
|
|
|
#define MCO1_SOURCE LL_RCC_MCO1SOURCE_LSE
|
|
|
|
#elif CONFIG_CLOCK_STM32_MCO1_SRC_HSE
|
|
|
|
#define MCO1_SOURCE LL_RCC_MCO1SOURCE_HSE
|
|
|
|
#elif CONFIG_CLOCK_STM32_MCO1_SRC_HSI
|
|
|
|
#define MCO1_SOURCE LL_RCC_MCO1SOURCE_HSI
|
|
|
|
#elif CONFIG_CLOCK_STM32_MCO1_SRC_PLLCLK
|
|
|
|
#define MCO1_SOURCE LL_RCC_MCO1SOURCE_PLLCLK
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if CONFIG_CLOCK_STM32_MCO2_SRC_SYSCLK
|
|
|
|
#define MCO2_SOURCE LL_RCC_MCO2SOURCE_SYSCLK
|
|
|
|
#elif CONFIG_CLOCK_STM32_MCO2_SRC_PLLI2S
|
|
|
|
#define MCO2_SOURCE LL_RCC_MCO2SOURCE_PLLI2S
|
|
|
|
#elif CONFIG_CLOCK_STM32_MCO2_SRC_HSE
|
|
|
|
#define MCO2_SOURCE LL_RCC_MCO2SOURCE_HSE
|
|
|
|
#elif CONFIG_CLOCK_STM32_MCO2_SRC_PLLCLK
|
|
|
|
#define MCO2_SOURCE LL_RCC_MCO2SOURCE_PLLCLK
|
|
|
|
#endif
|
|
|
|
|
2022-06-28 16:44:58 +02:00
|
|
|
/* Macros to fill up multiplication and division factors values */
|
|
|
|
#define z_pllm(v) LL_RCC_PLLM_DIV_ ## v
|
|
|
|
#define pllm(v) z_pllm(v)
|
|
|
|
|
|
|
|
#define z_pllp(v) LL_RCC_PLLP_DIV_ ## v
|
|
|
|
#define pllp(v) z_pllp(v)
|
|
|
|
|
|
|
|
#define z_pllq(v) LL_RCC_PLLQ_DIV_ ## v
|
|
|
|
#define pllq(v) z_pllq(v)
|
|
|
|
|
|
|
|
#define z_pllr(v) LL_RCC_PLLR_DIV_ ## v
|
|
|
|
#define pllr(v) z_pllr(v)
|
|
|
|
|
2022-03-23 15:34:16 +01:00
|
|
|
#ifdef STM32_SYSCLK_SRC_PLL
|
2022-04-22 11:37:28 +02:00
|
|
|
void config_pll_sysclock(void);
|
|
|
|
uint32_t get_pllout_frequency(void);
|
drivers/clock_control: stm32 common pll src support(g0,g4,l4,l5,wb,wl)
This commit adds support to select pll outputs as peripheral clock
sources to the stm32 common driver.
With this commit they are only available on
STM32G0, STM32G4, STM32L4, STM32L5, STM32WB, and STM32WL.
Support for STM32F2, and STM32F4, which also have p,q,r dividers,
is not enabled in this commit.
Also, stm32_clock_control_get_subsys_rate is extended to return
the configured frequency in case they are enabled, otherwise 0.
Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-06-28 20:12:41 +02:00
|
|
|
uint32_t get_pllsrc_frequency(void);
|
2022-03-23 15:34:16 +01:00
|
|
|
#endif
|
2017-04-18 14:24:04 +02:00
|
|
|
void config_enable_default_clocks(void);
|
2017-01-23 17:45:42 +01:00
|
|
|
|
2021-02-08 14:18:55 +01:00
|
|
|
/* function exported to the soc power.c */
|
|
|
|
int stm32_clock_control_init(const struct device *dev);
|
|
|
|
|
2018-09-14 19:43:44 +02:00
|
|
|
#endif /* ZEPHYR_DRIVERS_CLOCK_CONTROL_STM32_LL_CLOCK_H_ */
|