Commit graph

18 commits

Author SHA1 Message Date
Johan Lafon 691b357b59 drivers: clock-control: st: add MCO support for H7 family
Create clock_stm32_ll_mco.h file to bring stm32_clock_control_mco_init,
mco1_prescaler, mco2_prescaler, MCO1_SOURCE and MCO2_SOURCE definitions
which were previously in clock_stm32_ll_common.{c,h}. This is done so that
stm32_clock_control_mco_init can be called from clock_stm32_ll_h7.c.

Also update Kconfig.stm32 and add new MCO sources to allow H7 support.

Signed-off-by: Johan Lafon <johan.lafon@syslinbit.com>
2023-07-20 10:46:34 +00:00
Erwan Gouriou 8b4407ab7c drivers: clock_control: stm32: Implement F412 PLL I2S Support
Add PLLI2S support within clock_control driver.
This implementation is compatible with "st,stm32f412-plli2s-clock"
binding.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-03-01 08:56:05 +01:00
Erwan Gouriou e04ff4c3db drivers: clock_control: stm32: Implement F4 PLL I2S Support
Add PLLI2S support within clock_control driver.
This implementation is compatible with "st,stm32f4-plli2s-clock"
binding.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-03-01 08:56:05 +01:00
Armin Brauns 219dd436d1 drivers/clock_control: stm32l4: allow enabling MCO output
This enables the MCO clock output pin to be configured through Kconfig on
stm32l4 devices.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-01-26 09:39:33 +00:00
Artur Lipowski c88e157c46 clock_control: stm32: Add extern C to allow including from C++.
The stm32_clock_control_init is needed for implementation of custom
pm_state_exit_post_ops.

Signed-off-by: Artur Lipowski <Artur.Lipowski@hidglobal.com>
2022-11-25 20:03:10 +01:00
Gerard Marull-Paretas 2043d921e0 drivers: clock_control: stm32: add missing headers
clock_stm32_ll_common.h was missing <stdint.h> and <zephyr/device.h>. It
turns out things worked because <zephyr/init.h> has a forward
declaration of struct device.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-19 16:01:28 +02:00
Pierre-Emmanuel Novac 0e510cc2a6 drivers/clock_control: stm32: Configure and enable PLL2
DT node "st,stm32f105-pll2-clock" already exists but was not actually used
and PLL2 was not being configured.
PLL2 is available on STM32F105/F107 and should be turned off after turning
off PLL and turned on before turning on PLL again since PLL2 can be
used as a source for PLL. Source for PLL2 is always HSE.

Signed-off-by: Pierre-Emmanuel Novac <piernov@piernov.org>
2022-09-09 16:28:15 -04:00
Pierre-Emmanuel Novac 7ac8dd87e4 drivers/clock_control: stm32: Configure MCO1 on STM32F1
MCO1 is also available on STM32F1 series (on top of STM32F4), allow
selection of MCO1 source with CLOCK_STM32_MCO1_SRC_* Kconfig parameters.
Available MCO1 sources are slightly different between STM32F4
(LSE, HSE, HSI, PLLCLK) and STM32F103 (HSE, HSI, PLLCLK/2, SYSCLK), and
STM32F105/F107 have a few more (EXT_HSE, PLL2CLK, PLLI2SCLK, PLLI2SCLK/2).
MCO1 on STM32F1 does not have a configurable divider (unlike STM32F4),
HAL call only configures source.
STM32F1 do not have MCO2.

Signed-off-by: Pierre-Emmanuel Novac <piernov@piernov.org>
2022-09-06 09:57:35 +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
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 d04802283b drivers/clock_control: stm32 common: Don't disable fixed clocks
Each clock should be configured individually by device tree,
don't disable them blindly.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02: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
Erwan Gouriou 0392127997 drivers/clock_control: stm32: Missing include in stm32 header
As this header declares a function that uses a cube defined structure
as argument, it should include the matching header.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-03-06 09:32:05 -05:00
Francois Ramu fc41846935 drivers: clock: stm32 clock control with low power modes
This will export the stm32_clock_control_init function
to restore the clocks after the low power modes.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-02-19 22:38:50 -05:00
Yaël Boutreux f6343ace8e drivers: clock_control: stm32: Modify file naming pattern
Change file naming pattern from BoardNameX_ll_clock.c to
clock_BoardNameX.c
File containing LL functions will have the "_ll_" naming
scheme (such as clock_stm32_ll_common.c and .h)

Signed-off-by: Yaël Boutreux <yael.boutreux@st.com>
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Alexandre Torgue <alexandre.torgue@st.com>
2019-04-26 02:56:20 -07:00
Renamed from drivers/clock_control/stm32_ll_clock.h (Browse further)