Commit graph

687 commits

Author SHA1 Message Date
Aymeric Aillet fe02e32f86 drivers: clock: Rename renesas ra driver
Need this rename to be able to target this driver
in the "Renesas RA" maintainer area.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2024-01-29 11:32:46 +01:00
Francois Ramu 29b0cd4278 drivers: clock_control: stm32h5 driver input vco range
Set the correct VCO input range for the PLL frequency
with each bit PLL1RGE of the PLL1CFGR register
This get_vco_input_range is similar to the stm32h7 one.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2024-01-26 15:55:42 +00:00
Ian Morris 5fd3f658ff drivers: clock_control: clock_control_ra.c: protect register fix
Protection for clock control and power mode registers was not being
re-enabled.

Signed-off-by: Ian Morris <ian.d.morris@outlook.com>
2024-01-22 09:47:43 +00:00
Gerard Marull-Paretas 8edd33bf27 drivers: clock_control: litex: add missing include
Drivers uses custom IO read/write API defined in soc.h.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-01-19 15:13:53 +00:00
Ian Morris 640e70c9ce drivers: clock_control: clock_control_ra.c: clock divider fix
The clock divider value is not being applied as the address of the
register to which it is being written is incorrect. A check of all RA MCU
datasheets confirms that, in all cases, the SCKDIVCR register is at an
offset of 0x20 (and not 0x21).

Signed-off-by: Ian Morris <ian.d.morris@outlook.com>
2024-01-18 20:08:36 +01:00
Daniel DeGrasse a5ef1a296a drivers: clock_control: mcux_syscon: add definition for DMIC clock
Add definition for DMIC clock source to LPC SYSCON clock control driver.
This constant allows drivers to get the DMIC bit clock frequency.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2024-01-17 14:43:52 +01:00
Lucas Tamborrino 11fc182315 soc: esp32: refactor esp32_net
SOC_ESP32_NET is now SOC_ESP32_APPCPU, following espressif's
naming convention in the same manner as ESP32S3 app cpu.

SOC_ESP32_APPCU is now a subset of SOC_SERIES_ESP32.

This commit also changes the necessary files, samples and tests
for bisect purposes.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2024-01-13 00:22:24 +00:00
Dawid Niedzwiecki 164e4b6fa3 clock_control: stm32f4: add PLLR division factor
Some STM32F4xx chips have an R division factor in PLL. Add possibility
to configure that.

Even though the output from the R division is not used, it can be
increased to reduce power consumption.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2024-01-08 12:33:36 +01:00
Alexander Kozhinov d6ebf1efa8 drivers: clock_control: clock_stm32_ll_h7.c
Reduce code-complexity of stm32_clock_control_init() function, which is
used and exists for both M4/M7 cores.
Replace dublicated code by proper preprocessor guarding.
This change shall reduce code-errors and copy-paste errors since same
functional code is present only once now.
Identify even more common code

Signed-off-by: Alexander Kozhinov <ak.alexander.kozhinov@gmail.com>
2024-01-08 11:49:04 +01:00
Erwan Gouriou 3f61150d0a drivers: clock_control: stm32wba: set regu voltage after clk configuration
Call to set_regu_voltage() is required also after the clock configuration
has been performed.


Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2023-12-22 09:53:33 +01:00
TOKITA Hiroshi 32276bc2c1 drivers: clock_control: ra: fix initialization of the clock_hw_cycles
We should set the z_clock_hw_cycles_per_sec as the value of
the system clock frequency.

There was a mistake in referencing the clock source set before
initialization.
I corrected it to reflect the clock value after initialization.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-12-22 09:52:50 +01:00
Laurentiu Mihalcea 52deadd420 clock_control: imx_ccm: Add support for i.MX93's SAI clocks
This commit introduces support for querying
i.MX93's SAI clocks.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2023-12-20 11:15:13 +01:00
TOKITA Hiroshi 99a9b995d3 drivers: clock_control: rpi_pico: Configure GPOUT/GPIN pins
Configure GPOUT/GPIN pin for external clock in/out via GPIO.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2023-12-20 11:14:24 +01:00
Andrei-Edward Popa ea1cafbee7 drivers: clock_control: Added clock driver for Raspberry Pi Pico
Added clock driver for Raspberry Pi Pico platform

Signed-off-by: Andrei-Edward Popa <andrei.popa105@yahoo.com>
Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2023-12-20 11:14:24 +01:00
Kevin ORourke fbfd36e81e drivers: clock_control: stm32: Add HSE CSS support
Add support for enabling the clock security system, which can detect
failures of the HSE clock.

Includes tests for nucleo_h743zi and nucleo_g474re.

Signed-off-by: Kevin ORourke <kevin.orourke@ferroamp.se>
2023-12-13 13:56:43 +01:00
Jerzy Kasenberg f1e7a0dd6c drivers: clock_control: smartbond: Fix rc32k calibration
If RC32K oscillator was on during startup, calibration
work was never going to actually calibrate this oscillator.
It happen because lpc_clock_state.rc32k_started was only set when
oscillator was turned on after if was turned off.

Now lpc_clock_state.rc32k_started is also set when rc32k is already
started (possible during boot).

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
2023-12-12 15:03:17 +01:00
Declan Snyder 3ec0f3a462 drivers: clock_control: Support NXP_ENET
Support ENET peripheral clock in MCUX SIM and CCM_REV2 driver

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-12-11 09:50:58 +01:00
Declan Snyder 20af909df5 drivers: nxp_enet: Do clock init from zephyr
Need to do the ENET module-level clock initialization from zephyr
instead of MCUX HAL, because now there are multiple zephyr drivers with
different init priorities that rely on the module being clocked. MDIO
must be initialized before the ENET MAC, and the MAC driver currently
calls ENET_Init from the HAL to initialize the clock, but MDIO needs the
module clock enabled first on some platforms. So replace the MAC init
with ENET_Up from the HAL, which doesn't include clock init, then do
clock init from a higher priority sys init based on the parent
compatible.

Also, add support for enet clock ungating with clock_control_on on ccm
driver do this with current platforms supported.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-12-11 09:50:58 +01:00
Declan Snyder 809e936c5e drivers: clock_control_mcux_ccm: Add ENET PLL clk
Add subsys value for ENET PLL / ENET Ref clk to CCM Driver

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-11-28 14:34:02 -06:00
Declan Snyder 4a8d9a1ef3 drivers: clock_control: mcux_ccm: Add ENET clock
Add ENET clock value to the CCM clock decoder
for both RT10XX and RT11XX CCM versions.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-11-28 14:34:02 -06:00
Mykola Kvach 5461917952 drivers: clock: rcar: Add r8a779f0 support
Add support of r8a779f0 cpg driver.
r8a779f0 soc has its own clock tree.
Gen4 SoCs common registers addresses have been added in header.

Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2023-11-25 08:50:47 -05:00
Marcio Ribeiro 468890d70f drivers: clock_control: clock_control_esp32 assert remotion
No longer necessary assert removal

Signed-off-by: Marcio Ribeiro <marcio.ribeiro@espressif.com>
2023-11-23 10:02:05 +01:00
Ian Morris 18c4574786 drivers: clock_control: clock_control_ra.c: main oscillator select fix
Due to a typo it is not possible to select the main oscillator (MOSC) as a
clock source for an RA Microcontroller. This patch resolves the issue.

Signed-off-by: Ian Morris <ian.d.morris@outlook.com>
2023-11-22 14:57:23 +00:00
Henrik Brix Andersen c0c8952739 shell: do not enable subsystem/driver shell modules by default
Do not enable subsystem/driver shell modules by default and stop abusing
CONFIG_SHELL_MINIMAL, which is internal to the shell subsystem, to decide
when to enable a driver shell.

The list of shell modules has grown considerably through the
years. Enabling CONFIG_SHELL for doing e.g. an interactive debug session
leads to a large number of shell modules also being enabled unless
explicitly disabled, which again leads to non-negligible increases in
RAM/ROM usage.

This commit attempts to establish a policy of subsystem/driver shell
modules being disabled by default, requiring the user/application to
explicitly enable only those needed.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-11-20 09:21:40 +01:00
Andriy Gelman 0d1fa268bb drivers: clock_control: Add PWM clock device
Adds a clock control device for a PWM node, allowing the PWM
to be controlled using the clock control API.

It is a similar idea to the device driver in linux:
linux/Documentation/devicetree/bindings/clock/pwm-clock.yaml

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-11-20 09:18:44 +01:00
Mulin Chao 76b0aab6cc soc: arm: npcx: fix clock reference of APB4/FIU1 buses
This CL fixes the clock reference of APB4/FIU1 buses by introducing new
Kconfig options.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2023-11-16 06:50:57 +00:00
Charles Dias de51fca769 drivers: clock_control: define clock freq for STM32H7B0
Define max SYSCLK and AHB clock frequencies as 280 MHz, max APB
frequency as 140 MHz, and enable semaphore clock.

Signed-off-by: Charles Dias <charlesdias.cd@outlook.com>
2023-11-15 10:02:06 +01:00
Chekhov Ma 5078265213 Revert "drivers: mcux_ccm: add support for lpuart on imx93"
This reverts commit d963900dbd.
Since i.MX 93 is supported by mcux_ccm_rev2, remove i.MX 93 support
from mcux_ccm driver.

Signed-off-by: Chekhov Ma <chekhov.ma@nxp.com>
2023-11-13 10:51:12 -06:00
Chekhov Ma 4e99da8599 imx93: change ccm driver to "imx-ccm-rev2"
i.MX93 share similiar register layout with i.MX RT11xx. Change ccm driver
to align with i.MX RT11xx, and make it easier to enable other drivers.

Signed-off-by: Chekhov Ma <chekhov.ma@nxp.com>
2023-11-13 10:51:12 -06:00
Declan Snyder c83037cece drivers: clock_control_mcux_syscon: Add MRT subsys
Add code to handle MRT subsys clock to LPC syscon driver

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-11-10 10:40:54 +01:00
Laurentiu Mihalcea ea99578b76 soc: xtensa: imx8: Enable clock control on i.MX8QM/QXP
This commit enables clock control on the i.MX8QM and QXP boards.
This is achieved through the following changes:
	1) The "reg" property is no longer marked as required
	for the "nxp,imx-ccm" binding. This is necessary because
	in the case of i.MX8QM and i.MX8QXP the clock management
	is done through the SCFW, hence there's no need to access
	CCM's MMIO space (not that you could anyways).

	2) The DTS now contains a scu_mu node. This node refers
	to the MU instance used by the DSP to communicate with
	the SCFW.

	3) The CCM driver needs to support the LPUART clocks
	(which will be the only IP that's supported for now)
	and needs to perform an initialization so that the
	NXP HAL driver knows which MU to use to communicate
	with the SCFW.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2023-11-09 18:21:05 +01:00
Erwan Gouriou d06c93f24c drivers: clock_control: stm32wba: Apply VOS range 2 when sysclock = 16MHz
When sysclock is 16MHz, we're allowed to used VOS range 2.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2023-11-08 15:12:21 +00:00
Aaron Ye 6722544f1e drivers: clock_control: Add Ambiq clock_control driver.
This commit adds Ambiq clock_control driver support.

Signed-off-by: Aaron Ye <aye@ambiq.com>
2023-11-07 09:42:25 +01:00
Henrik Brix Andersen 5d5249d85b drivers: can: unify spelling of CAN Flexible Data-rate abbreviation
Unify spelling of CAN Flexible Data-rate abbreviation to "CAN FD" instead
of "CAN-FD". The former aligns with the CAN in Automation (CiA)
recommendation.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-11-01 11:17:17 +00:00
TOKITA Hiroshi 1741b3a356 drivers: clock_control: Add clock driver for Renesas RA series
Add initial support for Renesas RA clock generation circuit.

It returns a fixed value to simplify the first commit to get the UART
working now.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-11-01 10:56:46 +00:00
Marc Desvaux 72aee4b90b drivers: clock_control: stm32: add an option to enable CRS for HSI48
for nucleo_stm32g0b1 board.
the HSI48 clock is the clock used by default for the USB controller,
however its default tolerance is not enough for the USB specification,
leading to some random errors depending on many factors, including the
upstream HUB or host.

this commit adds an option in the device tree to enable the STM32 Clock
recovery system (CRS) using USB SOF packet reception as a reference,
which brings the HSI48 within the required accuracy for USB transfers.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Marc Desvaux <marc.desvaux-ext@st.com>
2023-10-26 09:47:48 +02:00
Erwan Gouriou c5408ab51c drivers: clock_control: stm32: Use hclk freq for flash latency computation
Flash is clocked with HCLK, while CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC
reflects SYSCLK. HCLK = SYCLK / AHB prescaler.
When dealing with flash latency, use HCLK instead of SYSCLK.

This changes reverts a abusive change done in an old commit (efd8ee465c)

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2023-10-03 15:19:12 +01:00
Erwan Gouriou b99651df24 drivers: clock_control: stm32: Set flash latency before increasing clocks
Latency should be set before HCLK clock increase. Not doing so can result
in broken behavior.
For instance, at startup, MSI is @4MHz on L4 series.
If MSI is required to be configured at 48 MHz for future use a USB clock,
this will be done in set_up_fixed_clock_sources(). If flash latency is
not correctly set at this point fetching flash will fail..

Move flash latency configuration before setting up fixed clocks.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2023-10-03 15:19:12 +01:00
Guillaume Gautier 85fa6746de drivers: clock_control: stm32u5: enable backup access before enabling lsi
LSI needs write access to backup domain to be enabled.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-09-29 10:33:42 +02:00
Sylvio Alves bdda8ac48e soc: esp32s3: add esp32s3_appcpu for AMP support
Adds esp32s3_appcpu SoC and update default esp32s3 SoC
to support AMP feature.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-09-27 12:07:21 +02:00
Jatty Andriean e364a095a6 drivers: clock_control: Add PLL fracn for STM32U5
Based on RM0456, each PLL in the STM32U5 has the
capability to work either in integer or fractional mode.
In this update, the fractional mode can be enabled
by setting the fracn value in the device tree.

Signed-off-by: Jatty Andriean <jandriea@outlook.com>
2023-09-26 15:06:56 +02:00
Fabio Baltieri 0e765a9ef8 clock_control: mcux_ccm: include zephyr/arch/cpu.h
Add an explicit include of zephyr/arch/cpu.h before fsl_clock.h so that
the Zephyr cpu definitions are parsed before the hal ones.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-09-20 17:25:44 +01:00
Max van Kessel 5670bad505 drivers: clock: stm32: overdrive after sysclock
According to the reference manual the overdrive should be enabled after
setup of the sysclock (HSE or HSI) and enabling the PLL (PLLON).
The flash latency should be enabled after the PLL has been turned on,
but before switching the system clock to the PLL.

Signed-off-by: Max van Kessel <max_van_kessel@msn.com>
2023-09-13 11:37:05 +02:00
Declan Snyder 97c2ef6666 drivers: clock_control_mcux_syscon: add sctimer
Add SCTIMER key to syscon clock control

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-09-12 09:23:46 +02:00
Guillaume Gautier 5f260591d8 drivers: clock_control: stm32wba: remove unneeded semaphore
Remove semaphore used for the setting of the LSE.
It is not used for STM32WBA.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-08-30 11:28:44 +01:00
Guillaume Gautier 4a46163055 drivers: clock_control: stm32wba: enable backup domain for lsi clock
LSI clock configuration for STM32WBA is located in backup domain.
The backup domain needs to be enabled before the LSI can be enabled.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-08-30 11:28:44 +01:00
Gerard Marull-Paretas 9c961571a2 modules: cmsis: move glue code to modules/cmsis
The CMSIS module glue code was part of arch/ directory. Move it to
modules/cmsis, and provide a single entry point for it: cmsis_core.h.
This entry header will include the right CMSIS header (M or A/R).

To make this change possible, CMSIS module Kconfig/CMake are declared as
external, allowing us to add a new Zephyr include directory.

All files including CMSIS have been updated.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-08-24 13:20:21 +02:00
Mulin Chao 5c7ab5c2bf driver: clock_control: npcx: add support for npcx4 series
This CL introduces new clock architectures in npcx4 series and wraps
clock configurations of different series by device tree files.

For example, the PWDWN_CTLx reg initialization relies on `pwdwn-ctl-val`
prop of pcc DT node now.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2023-08-24 10:42:33 +01:00
Jerzy Kasenberg 7a9744e169 drivers: clock_control: smartbond: Add calibration
RCX and RC32K oscillators are not precisely trimmed.
This code allows to measure actual frequency of those two
oscillators.

Device tree binding were extended to specify calibration
interval. This interval (in seconds) is used to periodically
call work that will perform oscillator frequency measurement.

For XTAL32K settle time can be provided in device tree.
After this time (depending on actual oscillator used)
XTAL32K is assumed to be stable and low power clock driven by
XTAL32K is considered OK for precise usage in bluetooth.

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
2023-08-22 12:16:16 +02:00
Daniel Leung 51ff4ced59 clock_control: renames shadow variables
Renames	shadow variables found by -Wshadow.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-10 08:14:12 +00:00