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
|
|
|
|
2022-10-18 18:09:33 +02:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include <zephyr/device.h>
|
|
|
|
|
2021-03-05 16:28:57 +01:00
|
|
|
#include <stm32_ll_utils.h>
|
|
|
|
|
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)
|
|
|
|
|
2023-02-28 15:52:36 +01:00
|
|
|
#define z_plli2s_m(v) LL_RCC_PLLI2SM_DIV_ ## v
|
|
|
|
#define plli2sm(v) z_plli2s_m(v)
|
|
|
|
|
2023-02-28 11:40:14 +01:00
|
|
|
#define z_plli2s_r(v) LL_RCC_PLLI2SR_DIV_ ## v
|
|
|
|
#define plli2sr(v) z_plli2s_r(v)
|
|
|
|
|
2022-11-16 10:48:40 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2022-06-28 21:50:20 +02:00
|
|
|
#if defined(STM32_PLL_ENABLED)
|
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
|
2022-09-03 14:22:41 +02:00
|
|
|
#if defined(STM32_PLL2_ENABLED)
|
|
|
|
void config_pll2(void);
|
|
|
|
#endif
|
2023-02-28 11:40:14 +01:00
|
|
|
#if defined(STM32_PLLI2S_ENABLED)
|
|
|
|
void config_plli2s(void);
|
|
|
|
#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);
|
|
|
|
|
2022-11-16 10:48:40 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-09-14 19:43:44 +02:00
|
|
|
#endif /* ZEPHYR_DRIVERS_CLOCK_CONTROL_STM32_LL_CLOCK_H_ */
|