Commit Graph

1027 Commits

Author SHA1 Message Date
Tomáš Juřena
0f760ed64c drivers: clock: stm32c0: Add an option to enable CRS for HSI48
Allows enabling the Clock Recovery System (CRS) for HSI48 to achieve
the expected accuracy for USB transfers. Uses USB SOF packet by default.

Signed-off-by: Tomáš Juřena <jurenatomas@gmail.com>
2025-07-23 17:27:24 +01:00
Parthiban Nallathambi
6bef297052 drivers: clock: conditional compile ulpclk udiv divider
although udiv is represented in clock tree of L series, this is
not really present or controllable from SYSCTL registers. Enable
udiv only if present in dts.

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
2025-07-21 07:25:50 -04:00
Camille BAUD
dbd85ae677 drivers: Add header file with common functions for BFLB
This moves the couple functions that are and will be all over
the various clock operations for all platforms.

Signed-off-by: Camille BAUD <mail@massdriver.space>
2025-07-19 15:30:45 -04:00
Declan Snyder
efdd8580ca soc: nxp: Flatten MCX SOCs
Turn MCX series into families.

Reasoning:
 1. The MCX SOCs are quite different from each other and having them all
    under one family in the HWMv2 hierarchy is fruitless because there
    are so many differences that it is confusing to try to introduce
    family-level code and configs since they would each only apply to a
    subset of the series. There is almost nothing that can be shared
    between all of them. Which is why there are comments in the MCX
    family files saying not to put anything in them. This is a technical
    waste.
 2. Therefore, turning all of them into families is almost 0 effort and
    makes sense. It will allow these different types of MCX to be
    further subdivided into series in the future as the MCX portfolio
    expands and such division will be necessary as new SOCs within each
    letter family are released.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-07-19 13:25:29 -04:00
Francois Ramu
c33d93d478 drivers: clock control for stm32h5 driver implements control_get_status
Add the control_get_status API function
to the stm32h5 clock_control driver

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2025-07-19 09:49:44 +02:00
Francois Ramu
a63683aa95 drivers: clock: stm32H5 clock control of the PLL in MemoryMapped mode
Do not disable the PLL clock if it sources the XSPI and if the external
flash is executing in Place. After mcuboot reset, the code is executed
on the external flash, through the xspi.
The CONFIG_STM32_APP_IN_EXT_FLASH is set and will avoid re-config
of the PLL which is sourcing the XSPI peripheral. When eXecuting in Place
on this external NOR, it must not disable its own clock source (PLL).

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2025-07-19 09:49:44 +02:00
Gaetan Perrot
3ff4d051ca drivers: clock_control: Remove unused 'sys' argument
The 'sys' argument in clock_control_renesas_ra_get_rate() is unused and
has been removed to clean up the implementation.

This also aligns with the function's actual behavior and eliminates
misleading validation logic.

Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
2025-07-10 16:00:52 -05:00
IBEN EL HADJ MESSAOUD Marwa
e1248eff82 drivers: clock_control: set voltage scaling before PLL
Move the call to prepare_regulator_voltage_scale()
before PLL setup in clock_stm32_ll_h7.c.

This ensures the voltage regulator is configured
to the appropriate voltage scale before increasing
the system clock frequency via PLLs.
Without this change, the system configuration
may be out of spec.

Signed-off-by: IBEN EL HADJ MESSAOUD Marwa <marwa.ibenelhadjmessaoud-ext@st.com>
2025-07-10 15:49:59 -05:00
Khaoula Bidani
618044ed78 drivers: clock_control: fix PLL input frequency
Correct PLL input frequency calculation to consider
HSI clock divider in clock_stm32_ll_h7.c file.
For sake of simplicity, use PLLSRC_FREQmacro that
already considers the HSI clock divider when applicable.

Signed-off-by: Khaoula Bidani <khaoula.bidani-ext@st.com>
2025-07-09 09:44:25 -05:00
Raffael Rostagno
26818ee100 drivers: clock_control: esp32c6: Fix clock init at JTAG reset
Peripheral clocks are currently not being disabled for JTAG reset
condition, which causes driver init failures when debugging the SoC
with JTAG. Fix by disabling all clocks for this reset type.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2025-07-04 15:49:17 -05:00
Pisit Sawangvonganan
b8a8173c1f drivers: kconfig: fix typo
Utilize a code spell-checking tool to scan for and correct spelling errors
in `Kconfig` files within the `drivers` directory.
Additionally, incorporates a fix recommended by the reviewer.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2025-07-01 10:58:54 -10:00
Imran Sajjad
63ebb75083 soc: imxrt: mimxrt1011 i2s clock fix
Fix for compiling i2s drivers on the NXP mimxrt1010_evk board.
For mimxrt1011, the defines kCLOCK_Sai2... are not defined as the sai2
peripheral does not exist. Trying to compile gives error. Fixed by adding
check for device tree node around code that uses the defines. Also added
same for sai1 and sai3. Thanks @lucien-nxp, @ZhaoxiangJin from NXP.

Signed-off-by: Imran Sajjad <imran.sajjad@iconfitness.com>
2025-06-30 15:19:24 -05:00
Sylvio Alves
60cd83e6f2 clock: esp32c6: enable and calibrate digital regulators
Enable the RTC-domain and main digital regulators early in clock init,
then load and program the factory/runtime calibrated bias values for
high-power and low-power regulators into the PMU. This ensures the
correct voltage/current settings for stable, low-noise clock operation
in active, modem and sleep modes.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2025-06-27 18:27:15 -05:00
Raymond Lei
581e7ff2aa drivers: spi: nxp: flexiospi spi_loopback test failed on flexio spi
Several reason cause loopback test failed:
a) FlexIO input frequency is not correct, on RT11xx, input freq is 24M,
while max baud rate can reach 1/4 of input freq, so it can only support
6Mbps.
b) Flexio shift register depend on correct timer output to triggger TX
and RX, if timer comparison value is not accurate, RX error happens on
high baud rate. This is the reason why test fails on RT1060.

also fix a error on FlexIO clock ID calculation.

Signed-off-by: Raymond Lei <raymond.lei@nxp.com>
2025-06-27 09:05:47 -10:00
Erwan Gouriou
48dc588636 clock_controller: stm32n6: Remove AXISRAM3/4/5/6 clocks handling
Now that they are handled through their dedicated driver, remove
clock activation for AXISRAM3/4/5/6 (which was useless anyway as
RAMCFG part was missing).

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2025-06-27 09:01:52 -10:00
Pieter De Gendt
8e2405207e drivers: clock_control: Place device APIs in linker sections
Use DEVICE_API macro to place driver API instances into a linker section.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-06-27 10:09:32 -05:00
Tony Han
a8cf696748 drivers: clock_control: microchip: sckc: optimize get_rate, get_status
Optimize sckc_get_rate() to be called without configurations in
parameter, the selection of slow clock of the timing domain directly
comes from the register.
Optimize sckc_get_status() with return value "CLOCK_CONTROL_STATUS_ON",
slow clock is always on either driven by the RC oscillator or by the
32.768 kHz crystal oscillator.

Signed-off-by: Tony Han <tony.han@microchip.com>
2025-06-27 09:42:36 +02:00
Qiang Zhao
2d06a90865 firmware: scmi: add set_rate api
add scmi_clock_set_rate function to set rate,
and assign it to set_rate api

Signed-off-by: Qiang Zhao <qiang.zhao@nxp.com>
2025-06-26 22:11:04 -05:00
David Jewsbury
0285cf4235 drivers: clock_control: update nrf2 lfosc_get_accuracy
Move lfosc_get_accuracy away from common library as
not all devices need this function.

Signed-off-by: David Jewsbury <david.jewsbury@nordicsemi.no>
2025-06-26 14:13:54 +02:00
David Jewsbury
49b0f1abb8 drivers: clock_control: refactor nrf_auxpll driver to nrf2
Refactor of previous clock_control_nrf_auxpll.c to use
the nrf2 clock control API

Signed-off-by: David Jewsbury <david.jewsbury@nordicsemi.no>
2025-06-26 14:13:54 +02:00
Julien Racki
d418512473 drivers: clock_control: stm32: Fix STM32MP13 gate clock disable
The STM32MP13 clock control has set and clear registers
for the clocks. So clearing the set register won't have any effect.
Instead, we should write on the clear register.

Signed-off-by: Julien Racki <julien.racki@st.com>
2025-06-26 14:07:25 +02:00
Etienne Carriere
4bce536cc6 drivers: clock_control: stm32: release Backup Domain access refcount
Fix STM32 WBA and H7 clock drivers to release the reference counter
added to access LSE configuration controllers once the clock is
configured. Keeping such an unbalanced access request is no more
needed since SoC functions manage reference counting of access requests.

Fixes issue 90942.

Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
2025-06-26 12:43:17 +02:00
Etienne Carriere
8da20047cc drivers: clock_control: stm32: refcounter for Backup domain accesses
Use recently added SoCs functions to request access to SoC backup
domain resources These function use a reference counter to track these
request and ensure the resources are accessible as long as at least a
consumer requires access.

By the way, correct stm32_hsem.h header file inclusion that requires
brackets (<>) delimiters, not double quotes, as per convention on header
location.

Fixes issue 90942.

Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
2025-06-26 12:43:17 +02:00
Jamie McCrae
98c5b1c1fa drivers: clock_control: nrf: Fix bleeding Kconfig
Fixes a Kconfig bleeding through to every device

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-06-25 15:57:24 -10:00
Thao Luong
720d4c61a9 drivers: clock_control: Add support for RA8P1
Add additional clocks to support for RA8P1.

Signed-off-by: Thao Luong <thao.luong.uw@renesas.com>
2025-06-25 15:56:20 -10:00
Bjarki Arge Andreasen
bb319603fd drivers: clock_control: nrf: add support for HFCLK24M
Add support for the HFCLK24M clock to the clock_control_nrf
device driver.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2025-06-25 14:07:20 +02:00
Jiafei Pan
df0304ae09 drivers: clock_control: mcux_ccm: add flexcan clock support
Enable FlexCAN clock support on imx8mp.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2025-06-25 09:52:56 +02:00
Youssef Zini
03d3075dc8 drivers: clock_control: add uart clock handling
Add clock bindings for UART/USART (1-9) peripherals in the
`stm32mp2_clock.h`.
Add UART/USART clocks rate reading to the STM32MP2 clock driver.

Signed-off-by: Youssef Zini <youssef.zini@savoirfairelinux.com>
2025-06-24 15:37:57 -05:00
Lucien Zhao
585a85ac55 drivers: clock_control: support rt700 getting sai clock
There are multi sai instance shared on clock source on
cm33_cpu0, clock driver don't need index parameter, so
modify clock driver to adapt clock driver.

Signed-off-by: Lucien Zhao <lucien.zhao@nxp.com>
2025-06-24 15:35:07 -05:00
Laurentiu Mihalcea
1f483b37ea drivers: clock_control: mcux_ccm: support QM/QXP's ESAI/AUD_PLL1 clocks
Add support for gating/ungating IMX8QM/IMX8QXP's ESAI clocks and the
AUD_PLL_DIV_CLK0 clock used as source for ESAI's EXTAL.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2025-06-24 09:13:45 +02:00
Benjamin Cabé
1e27c46015 drivers: clock_control: npcm: add missing const qualifiers
Ensure that the various configuration and conversion tables are marked
as const to save on RAM usage.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-21 13:14:39 +02:00
Benjamin Cabé
1c1ec64ab6 drivers: clock_control: npcm: fix clock_control_off
Align code with the comment :) There apparently was a copy-paste issue
from the clock_control_on code.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-21 13:14:39 +02:00
Camille BAUD
46b5d05ae1 drivers: clock_control: Introduce bl60x clock driver
This introduces a clock_control driver for bl60x

Signed-off-by: Camille BAUD <mail@massdriver.space>
2025-06-21 10:40:20 +02:00
Declan Snyder
877fa975cc spi_nxp_lpspi: Remove MCUX branding
Since the LPSPI drivers no long use MCUX at all, remove the MCUX
branding, to avoid confusion. In the future if an implementation uses
the MCUX SDK driver, it should specifically be called by MCUX in the
name.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-06-18 17:51:19 -04:00
Benjamin Cabé
ebfcd24132 drivers: clock_control: ambiq: add missing break statement
add missing break statement so that CLOCK_CONTROL_AMBIQ_TYPE_LFXTAL case
is handled correctly.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-17 17:46:41 +02:00
Youssef Zini
9bc78cfee4 drivers: clock_control: add mp2 clock driver
Add the stm32mp2 clock driver to the clock_control subsystem. The driver
is a reduced version of the generic stm32 clock driver.

Signed-off-by: Youssef Zini <youssef.zini@savoirfairelinux.com>
2025-06-17 08:20:33 +02:00
Youssef Zini
7f23ce2967 dts: clock_control: add mp2 rcc binding
Introduce DeviceTree binding for the STM32MP2 RCC clock controller,
enabling support for STM32MP2-specific clock configuration in Zephyr.
Update Kconfig.stm32 to add a dependency on STM32MP2 configuration,
allowing the use of STM32 LL RCC features when targeting STM32MP2
devices.
Add header for STM32MP2 per peripheral clock definitions.

Signed-off-by: Youssef Zini <youssef.zini@savoirfairelinux.com>
2025-06-17 08:20:33 +02:00
Khaoula Bidani
6ac4b20e2b drivers: clock_control: Add STM32U3XX clock support
add clock support for STM32U3X SoC series.

Signed-off-by: Khaoula Bidani <khaoula.bidani-ext@st.com>
2025-06-16 13:59:38 -04:00
Alvis Sun
2027d97dac drivers: clock_control: add validation for SYS_CLOCK_HW_CYCLES_PER_SEC
Check whether the value of SYS_CLOCK_HW_CYCLES_PER_SEC is valid.

Signed-off-by: Alvis Sun <yfsun@nuvoton.com>
2025-06-16 14:13:55 +02:00
Bjarki Arge Andreasen
8a27773247 drivers: clock_control: nrf2: split configs per driver
Currently the config CLOCK_CONTROL_NRF2 is used as a GLOB
style config which includes all "NRF2" drivers and related
configs.

With NRF2, clocks are treated as individidual devices
with individual device drivers. This commit split the
CLOCK_CONTROL_NRF2 config into device specific configs
and ifdefs. With this, drivers are selected individually
based on devicetree state as is common for most devices
drivers, and dependencies like NRFS and specific NRFS
services are selected by the specific driver which nees it.

Checks for CLOCK_CONTROL_NRF2 are updated to check for
existance of the clocks instead.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2025-06-13 11:12:43 +02:00
Bjarki Arge Andreasen
979a565289 drivers: clock_control: nrf2: align with hw binding names
Currently there is a mismatch between the naming of the hardware and
the drivers targetting the hardware. nrf2_ is used instead of
the actual bindings names, like nrf2_audiopll instead of
nrfs_audiopll. This makes it hard to map drivers to the hardware
they are targetting.

There is historical reason for some of this, namely the same binding
name was used for different hardware, which is why nrf2_ was used
on newer platforms. This is no longer the case though, so drivers
and configs can be named according to the hardware without conflict.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2025-06-13 11:12:43 +02:00
Andrzej Głąbek
77a7cb3e4f drivers: clock_control_nrf: Prevent break from becoming dead code
When both NRF_CLOCK_HAS_XO_TUNE and NRF_CLOCK_HAS_PLL evaluate to 0,
one break statement can end up not associated with any case and become
dead code. Refactor a bit the related switch to avoid such situation.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2025-06-12 11:45:56 +02:00
Adam Kondraciuk
cc86ce7cdb drivers: clock_control: nrf: Add frequency parameter for K32SRC
Add frequency parameter for 32k sources.

Signed-off-by: Adam Kondraciuk <adam.kondraciuk@nordicsemi.no>
2025-06-12 11:32:59 +02:00
Aksel Skauge Mellbye
837b0d303a drivers: clock_control: siwx91x: Fix clock init
New versions of the Wiseconnect HAL require a clock manager init
function to be called as part of clock configuration.

Without this, the default reference clock isn't configured correctly
for use with peripherals.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2025-06-10 13:29:06 +02:00
Sai Santhosh Malae
6d5e217262 drivers: adc: siwx91x: ADC clock initialization for siwx91x
Clock driver changes required for initializing the ADC clock
for the siwx91x driver

Signed-off-by: Sai Santhosh Malae <Santhosh.Malae@silabs.com>
2025-06-10 12:07:33 +02:00
Benjamin Cabé
ec01159440 drivers: clock_control: wch_rcc: remove duplicate reg write
Removed a redundant register write to FLASH->ACTLR

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-09 15:03:20 -07:00
Benjamin Cabé
036a76a4cb drivers: clock_control: esp32c6: fix modem clock source selection
Properly default to MODEM_CLOCK_LPCLK_SRC_RC_SLOW in modem LP
clock source selection

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-09 14:49:38 -07:00
Benjamin Cabé
4524bdf9f5 drivers: clock_control: rpi_pico: fix frequency count typo
fixed what looked like a copy-paste error

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-09 08:56:33 +02:00
Rubin Gerritsen
f26a8c0eb1 drivers: clock_control: nrf2_lfclk: Remove LPRC source
This source is not yet supported. It will be added back
later.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2025-06-05 15:16:28 -05:00
Rubin Gerritsen
f0a433fc03 drivers: clock_control: nrf2_lfclk: Fix selecting lowest power clock
The application or drivers can request the LFCLK with a given
precision and accuracy.
The driver should select the clock source which has
the lowest power consumption and still satisfies the requested
accuracy and precision.

Before this commit, this was not the case.
Consider the case where the BICR has configured the system
to have LFXO with accuracy of 20 ppm.
The existing code would have ordered the clock options as following:
```
[0] = {LFLPRC, 1000 ppm},
[1] = {LFRC, 500 ppm},
[2] = {SYNTH, 30 ppm},
[3] = {LFXO_PIERCE, 20 ppm},
[4] = {LFXO_PIERCE_HP, 20 ppm}
```

**Example 1**: The user requests the clock with an accuracy of 30 ppm.
The existing code would request the power hungry "SYNTH".

**Example 2**: The user requests a clock with an accuracy of 500 ppm.
The existing code would request the LFRC which consumes more power than
the LFXO.

This commit fixes this issue by ordering the clock sources according
to power consumption.
For the examples above we user request would result in requesting the
20 ppm LFXO.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2025-06-05 15:16:28 -05:00