Commit graph

13 commits

Author SHA1 Message Date
Gerard Marull-Paretas 357b362824 include: add missing sys/time_units.h include
Some files using time_units.h API did not include it, e.g. for
sys_clock_hw_cycles_per_sec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
Thomas Stranger eb44da9879 drivers/clock_control: stm32 g0, g4, l4, remove get_pllout_frequency()
After replacing STM32_SRC_PLLCLK by the STM32_SRC_PLL_x sources
this function is no longer needed and are therefore removed.

Also, those functions returned a wrong frequency.
They should have used get_pllsrc_frequency() instead of get_pll_source()
to get the input frequency.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-04 16:41:24 +02:00
Thomas Stranger ddf3f2d735 drivers/clock_control: stm32 common allow pll also when it is not sysclk
The SOC specific implementations of the clock_stm32_ll_common driver
included the PLL specific functions only when PLL was selected as sysclock.

This commit changes the condition from "STM32_SYSCLK_SRC_PLL"
to "defined(STM32_PLL_ENABLED)".
As a result the pll could also be used as peripheral clock source
in case it is not the sysclock.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-04 16:41:24 +02:00
Thomas Stranger 15430252bf 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-07-04 16:41:24 +02:00
Thomas Stranger c112afa6a7 drivers/clock_control: stm32 common move pllx defines to common header
All these series share the same defines, and while they are not used
by all socs of the common-driver, this is not exptectd to lead to
any conflict.
By moving the defines they can also be used in clock_stm32_ll_common.c

Additionally, the stm32g0 pll_div define was renamed to pllm
in order to match the other series.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-04 16:41:24 +02:00
Erwan Gouriou 09217865ce drivers/clock_control: stm32_common: Implement clock source selection
Similarly to what was done on U5 and H7 clock_control drivers, enable
device clock source selection.
This is done by:
-providing implementation for clock_control_configure().
-updating clock_control_get_rate() to support various possible clock
sources (SYSCLK, PLLCLK, LSE, LSI, HSI, HSE).
-providing enable_clock() to verify requested clock source exists and
is enabled.
-adding LSI and LSE device tree based initialization to
set_up_fixed_clock_sources().

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-05-10 18:42:30 +02:00
Gerard Marull-Paretas fb60aab245 drivers: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all drivers to the new
prefix <zephyr/...>. Note that the conversion has been scripted, refer
to #45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 19:58:21 +02:00
Benedikt Schmidt 86469b1d0b drivers: clock_control: Make LSE driving configurable
Make the LSE driving capability configurable for the STM32 series.
Fixes #44737.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2022-04-29 16:11:34 +02:00
Erwan Gouriou c4ff7d1e19 drivers/clock_control: stm32_common: Add elementary PLL configuration step
Introduce a set_up_pll configuration function and make PLL configuration
an elementary step of the whole system clock configuration.

To implement this new, function make use of the existing series specific
files which allows series specific configuration when required.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou ceb8579854 include/drivers/clock_control: stm32: Add XXX_ENABLED and XXX_FREQ
Add STM32_FOO_ENABLED and STM32_FOO_FREQ to STM32 fixed clocks:
HSI, HSE, MSI(S), CSI, LSI, LSE..

Replace STM32_LSE_CLOCK by STM32_LSE_FREQ and when possible
replace by new STM32_LSE_ENABLED when making sense.

Fix STM32_PLL3_FOO_ENABLE to STM32_PLL3_FOO_ENABLED

Additionally, add STM32_PLL_FOO_ENABLED definitions.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-07 11:36:28 +01:00
Alexandre Bourdiol 482198bf79 drivers: clock_control: stm32: enable PWR clock unconditionally
Enable PWR clock unconditionally for L4, L5 and U5
like it is done on other stm32 series

Fixes #37781

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-08-19 08:51:10 -05:00
Erwan Gouriou 2691541ad2 drivers/clock_controller: stm32: Prepare for dts based configuration
To allow transition to device tree based clock configuration on
stm32 targets, rework clock_control driver to use intermediate
STM32_ macros initially defined as the equivalent Kconfig macros
for now.
Propagate the change in all code using these macros.

The reason to introduce these new macros instead of configuring
Kconfig flags using dt kconfigfunctions is that we'll need
to be able to inform users that Kconfig flags are deprecated
once the whole family conversion is done, to encourage
out of tree users to adopt this new configuration scheme.

Note: For now STM32H7 series and code is excluded.
This is the same for some series specific code such as
PLL mul/div for L0/L1 and XTRE prescaler on F1 series.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-04-27 11:53:37 +02:00
Alexandre Bourdiol 6e5b0d01f5 drivers: clock_control: add STM32WL support
Add STM32WL support to clock_control driver

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-02-19 22:39:24 -05:00
Renamed from drivers/clock_control/clock_stm32l4_l5_wb.c (Browse further)