Commit graph

425 commits

Author SHA1 Message Date
Francois Ramu 1c7c4506d8 drivers: clock_control of the stm32l0x or stm32l1x devices
Fix register bit field when clock source is MSI
on the stm32L0x or stm32L1x mcus
Use RCC_CR_MSIRGSEL bit field instead of not soc stm32wbx serie
That bit of the RCC CR is common to several stm32 mcus

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-03-14 08:56:19 -05:00
Carles Cufi af9a6a6924 drivers: clock_control: nrf: Fix missing dependency to mt
The temperature sensor used in the clock_control driver requires
multithreading, but this is not compatible with mcuboot builds with
multithreading disabled.

Fixes #41597.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-03-11 08:22:31 -06:00
Peng Fan f6b608798f clock_control: mcux_ccm: fix build warning for ARM64
Fix below warning:
"warning: cast from pointer to integer of different size"

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2022-03-10 12:57:37 -06:00
Peng Fan 827f472560 clock: mcux_ccm: support uart1/2/3
Add UART1/2/3 clock support, also update uart4 to read clock root
mux to get clock rate.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2022-03-10 12:57:37 -06:00
Peng Fan 06b8dc6790 nxp: imx: rename IMX_CCM_UART_CLK to IMX_CCM_UART4_CLK
The code is actually using uart4, so rename
IMX_CCM_UART_CLK to IMX_CCM_UART4_CLK

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2022-03-10 12:57:37 -06:00
Tomislav Milkovic 7f365f46b8 drivers: clock_control: clock_stm32_ll_h7: Fix PLL3 PQR output init
Due to typo in macro name, PLL3P, PLL3Q and PLL3R outputs
are never enabled

Signed-off-by: Tomislav Milkovic <tomislav.milkovic95@gmail.com>
2022-03-10 09:44:52 -05:00
Gerard Marull-Paretas 95fb0ded6b kconfig: remove Enable from boolean prompts
According to Kconfig guidelines, boolean prompts must not start with
"Enable...". The following command has been used to automate the changes
in this patch:

sed -i "s/bool \"[Ee]nables\? \(\w\)/bool \"\U\1/g" **/Kconfig*

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-09 15:35:54 +01:00
Andrzej Głąbek 70a9e2055c drivers: Remove undesirable irq_enable calls from nrfx driver shims
Shims for nrfx drivers should only connect the related IRQ handlers,
they should not enable the IRQs, as this could lead to a situation
where the interrupt handler is called before the driver had a chance
to properly initialize the peripheral and install the provided event
handler. nrfx drivers will enable the interrupts appropriately on
their own by calling the NRFX_IRQ_ENABLE macro which is implemented
in nrfx_glue.h as a call to irq_enable().
This commit fixes the above issue spotted in the following shims:
- dmic_nrfx_pdm
- clock_control_nrf
- i2s_nrfx

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-07 09:19:56 -06:00
Erwan Gouriou d74cb2a3df drivers/clock_control: stm32h7: Simplify SysClk freq computing
Instead of reading registers query the info on sysclock configuration
from existing configuration symbols.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-07 11:36:28 +01:00
Erwan Gouriou 2116606ce2 drivers/clock_control/stm32h7: Independent clocks configuration
Rework clock start up functions in order to allow configuration
and enabling of individual clocks.
This way, each clock defined with a "okay" status will be enabled
even if not part of the sysclock clock tree.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-07 11:36:28 +01: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
Erwan Gouriou 348070e4ea drivers/clock_control: stm32u5: Use LL API for LSESYS programming
Use LL API when possible.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-07 11:36:28 +01:00
Erwan Gouriou 5a1fe914ff drivers/clock_control stm32h7: Move RCC HW semaphore unlock
PLL3 setting should also be protected CFG_HW_RCC_SEMID.
Move semaphore unlock after we're done with PLL3.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-07 11:36:28 +01:00
Erwan Gouriou 87eba815dd drivers/clock_control: stm32h7: Complementary readability changes
- Factorize elementary clocks setup code.
- Put conditional logic on CONFIG_CPU_CORTEX_M4 outside init function

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-07 11:36:28 +01:00
Erwan Gouriou 12404f7668 drivers/clock_control: stm32h7: Make driver more readable
Re-arrange code using benefits of IS_ENABLED.
Change some #if to #ifdef when possible.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-07 11:36:28 +01:00
Erwan Gouriou a911b81a2e drivers/clock_control: stm32u5: Make driver more readable
Use benefits of IS_ENABLED.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-07 11:36:28 +01:00
Mikkel Jakobsen daeaf9b89a drivers: clock_control: add stm32h725 support
the stm32h725 has the same maximum clock frequencies as the stm32h723.

Signed-off-by: Mikkel Jakobsen <mikkel.aunsbjerg@escolifesciences.com>
2022-02-28 09:15:33 -06:00
Tomislav Milkovic b2231c9d85 drivers: clock_control: stm32h7: select max clock freq for STM32H7B3
STM32H7B3 supports max SYSCLK and AHB clock frequencies of 280 MHz,
and max APB frequency of 140 MHz

Signed-off-by: Tomislav Milkovic <tomislav.milkovic95@gmail.com>
2022-02-22 10:34:56 -05:00
Gerard Marull-Paretas aa431f636e drivers: nrf_clock_calibration: use DEVICE_DT_GET_OR_NULL
An optional reference to the temperature sensor can be obtained at
compile time, update implementation.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Jun Lin 6faa8fcd8d driver: clock_control: npcx: power down some modules by default
This commit sets the power down bit of the module SDP, UART3, UART4,
and I3C by default. The module's driver should take the responsibility
to clear it to turn on the power. It helps reduce the power consumption
when an application doesn't use these modules.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2022-02-21 21:55:16 -05:00
Joakim Andersson d8dd0ed912 drivers: clock_control: Remove unused header file
Remove unused header file nrf_gpio.h which is not used by the
clock control driver.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2022-02-01 11:31:36 +01:00
Hake Huang 086f6ea77a driver: clock: fix freq get error for clock audio
using the clock root api to get rate

fixing: #42179

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2022-01-28 10:06:53 +01:00
Wealian Liao 6d6c5e1155 drivers: npcx: Drop DRV_CONFIG/DRV_DATA usage
Stop using DRV_CONFIG/DRV_DATA macros and use dev->data and dev->config
instead.

Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
2022-01-28 10:06:05 +01:00
Wealian Liao 3565f71a72 drivers: npcx: Correct the macro parentheses
This corrects the following:
1. The priority of type cast is lower than member access. So don't need
the redundant parentheses.
2. The macro should be added to the parentheses.

Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
2022-01-28 10:06:05 +01:00
Hake Huang 0525ad3d46 clock: ccmv2: add SAI CCM clocks for RT11xx
add SAI CCMV2 clocks for RT11xx series

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2022-01-21 11:26:45 -06:00
Sylvio Alves eec068b8a5 soc: esp32c3: fix cpu vendor name
Build shows warning due to incompatible
CPU vendor name. This fixes it and applies
necessary changes in files.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-01-20 13:33:29 -05:00
Mahesh Mahadevan aeabe6c70c driver: clock: Update MCUX Syscon clock control driver
1. Update to add support for Flexcomm8-13.
2. Fix the clock control driver, the enclosing #define
   was incorrect.
3. Identify HS_SPI port using the appropriate Register
   define

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-01-19 13:35:09 -06:00
Gerard Marull-Paretas 5efb4610cf drivers: clock_control: esp32: constify device config access
`const` was missing from one device config access.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas ddf9fc4f9f drivers: clock_control: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Benedikt Schmidt 6c60664281 drivers: clock_control: stm32h7: systick activation
Do not enable systick in the clock control initialization of
a STM32H7.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2022-01-18 10:36:07 -05:00
Manojkumar Subramaniam ae0ce3a2b9 drivers: clock_control: stm32h7: Support SoC STM32H7A3XX / STM32H7A3XX-Q
clock requirement

Introduce a new group of clock setting to fit in this series of SoC

Signed-off-by: Manojkumar Subramaniam <manoj@electrolance.com>
2022-01-17 11:45:21 -05:00
Henrik Brix Andersen abaf7cc70d drivers: clock_control: lpc: syscon: add MCAN clock support
Add support for the LPC MCAN clock to the LPC SYSCON clock controller
driver.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-01-10 12:00:20 +01:00
Erwan Gouriou c4ae984a2d drivers/clock_control: stm32u5: Use LL API to set MSI as PLL srce
Recent changes in this function made the code now compatible
with the use of LL API to perform this configuration.
Use it to simplify the driver.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-01-05 14:59:34 -05:00
Erwan Gouriou 6787566e3d drivers/clock_control: u5: Add utility to set voltage scaling
Voltage scaling computation should be done in multiple cases.
Add a function that takes into account all cases.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-12-09 19:45:41 -05:00
Gennady Kovalev b49766f001 drivers: clock_control: More power supply modes for STM32H7
STM32H7 has different power supply modes but now Zephyr supports just LDO
and direct SMPS. This commit introduses POWER_SUPPLY_CHOICE configuration
parameter and add support for missed power supply modes.

Signed-off-by: Gennady Kovalev <gik@bigur.com>

Fixes #40730.
2021-12-08 09:12:12 -05:00
Daniel DeGrasse 11e4690bdd drivers: clock_control: Add LPSR clock for EDMA
Adds ccm clock config for EDMA1 clock

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-08 08:40:06 -05:00
Daniel DeGrasse 4d4939c4e1 boards: mimxrt1060_evk_cm7: Enable DMA controller on RT1160 EVK
DMA controller is enabled and tested for cortex M7 core. The M7 core was
tested on the loop and channel link transfer tests.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-08 08:40:06 -05:00
Daniel DeGrasse b18aefdfd3 dts: rt685: enabled flexcomm15
the RT685 contains an additional flexcomm peripheral, that supports
only I2C. This commit adds this peripheral to the device tree,
and enables pins and clocks for flexcomm15.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-08 08:27:44 -05:00
Daniel DeGrasse b0dfda1584 drivers: pwm_mcux: Update MCUX pwm driver to use clock bindings
MCUX PWM driver used hardcoded clock source. update driver to use clock
bindings to determine PWM peripheral clock frequency.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-03 16:44:12 -06:00
Hake Huang 0e9d491f47 driver: clock: nxp-mcux add clock support for i2s
add mcux ccm clock setting for i2s

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2021-12-02 10:50:21 +01:00
Alexandre Bourdiol 102ac1ae36 drivers: clock_control: stm32u5: set voltage scaling VOS for MSIS
In case of MSIS selected as system clock source it is necessary
to set Voltage scaling (VOS) when freqency is greater than 24MHz

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-11-29 05:27:19 -05:00
Alexandre Bourdiol ffb6a31819 drivers: clock_control: stm32u5: keep reset values of MSI trimming
When MSI trimming values where set to 0,
and MSIS is used as system core clock and MSI > 4 MHz,
it causes uart to fail.
There is no need to set thoses trimming values.
So keep the default reset value. (keep ST Factory calibration)

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-11-29 05:27:19 -05:00
Alexandre Bourdiol 2d223bdc8f drivers: clock_control: stm32u5: rework MSIS as system clock source
Because on stm32u5 MSIS is the default clock after reset,
changing MSIS range means immediate frequency change.
Thus it is important to do it after flash latency change
in case of higher new frequency.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-11-29 05:27:19 -05:00
Manojkumar Subramaniam 86a6280ed7 drivers: clock_control: stm32h7: Add logic to handle SMPS config
Some STM32 SoC supports an internal SMPS

Signed-off-by: Manojkumar Subramaniam <manoj@electrolance.com>
2021-11-18 13:56:39 +01:00
Sylvio Alves 27e44acda1 clock: esp32: unify clock control for all espressif socs
This joins all clock control handling to same source
by using hal clock functions. It also brings ESP32C3
clock support.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-11-04 15:21:26 -04:00
Erwan Gouriou e19716e5c9 include/driver/clock_control: stm32: Remove STM32_PLL_PREDIV1
Make the code coherent with the comment:
purely remove STM32_PLL_PREDIV1.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-03 16:19:06 -04:00
Erwan Gouriou ace71a98a4 drivers/clock_control: stm32: Remove CLOCK_STM32_ Kconfig symbols
Remove deprecated Kconfig based STM32 clock configuration system.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-03 16:19:06 -04:00
Francois Ramu a1e7c4dbfa drivers: clock control disable AHB3 clock in stm32_clock_control_off
This commit is fixing the error on clock control for the AHB3
in the stm32_clock_control_off function.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-11-02 13:24:10 +01:00
Felipe Neves 1e328fe109 clock_control: esp32c3: added clock control
gating driver support for esp32c3 SoC family

Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-10-27 15:09:08 -04:00
Sylvio Alves 944b6d0486 soc: esp32: use same rom func prefix
This sets esp32 to use common rom functions
prefix among SoCs.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-10-21 10:55:45 -04:00