Commit graph

24538 commits

Author SHA1 Message Date
Declan Snyder
513b1645e0 drivers: mcux_os_timer: Refactor ISR
Refactor ISR by:
1) making a helper function to put the tickful calculation in, to reduce
   an indentation level and cognitively separate this case while reading
2) Rewrite the calculations to simplify them. More info on that below.

Math changes:
- In the ISR, there was a variable called "now" which represented the
current cycle count of the timer. last_count was updated using a
calculation based on the number of elapsed ticks
and the hardware cycles per second value. However, this is
redundant because mathematically, this is equivalent to "now". So the
variable can just be set to now.
Proof is that the previous calculation was (in programming language):
(1) last_count = last_count + elapsed_ticks * CYC_PER_TICK
So let's rewrite this as the following to be clear about the different
values we are talking about here (in math language):
(2) count[t] = count[t-1] + elapsed_ticks * CYC_PER_TICK
We calculated elapsed ticks in the function as:
(3) elapsed_ticks = (now - last_count) / CYC_PER_TICK
(4) elapsed_ticks = (now - count[t-1]) / CYC_PER_TICK
Rearranging (2), we see
(5) elapsed_ticks = ( count[t] - count[t-1] ) / CYC_PER_TICK
Substituting this into (4), we get:
(6) ( count[t] - count[t-1] ) / CYC_PER_TICK =
			(now - count[t-1]) / CYC_PER_TICK
Doing simple algebra, you can see we result with:
(7) count[t] = now
So therefore, we can simplify the programming expression to
(8) last_count = now

- The other change is regarding the calculation of the next tick match
  value for tickful kernel mode. The previous calculation was doing:
(1) next = now + CYC_PER_TICK
We know that last_count is equivalent to now, at this point in the code
with the first change:
(2) next = last_count + CYC_PER_TICK
And then, for some reason, we are adding yet another CYC_PER_TICK to
next if (next - now) < MIN_DELAY. The reason for that I do not
understand, but let's write that down:
(3) next - now < MIN_DELAY
Now rewrite (2) as (4) and (3) as (5):
(4) count[t+1] = count[t] + CYC_PER_TICK
(5) count[t+1] - count[t] < MIN_DELAY
And now we substitute (4) into (5):
(6) count[t] + CYC_PER_TICK - count[t] < MIN_DELAY
And simplify:
(7) CYC_PER_TICK < MIN_DELAY
So actually no runtime calculations are needed here, this is a
hardcoding. The reason for this calculation I don't know, but we can
simplify the code.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-08-22 06:52:42 +02:00
Declan Snyder
992f6fb774 mcux_os_timer: Refactor elapsed ticks calculation
There are a couple places where effectively the exact same calculation
is done. Refactor to share code to do this calculation to make it easier
to read, and explode the code to multiple statements to be even easier
to follow the calculation. Compiler will likely optimize the same way
when opt enabled. Rename dticks variable to be more explicit what that
means (elapsed ticks).

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-08-22 06:52:42 +02:00
Declan Snyder
d26f3b41b3 drivers: timer: mcux_os_timer: General refactor
Refactor to remove nesting and consolidate lines of code.

I also ran clang format but that actually did not change very much in
addition to what I had already changed manually.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-08-22 06:52:42 +02:00
Zhaoxiang Jin
115b0e0dc8 driver: regulator: Improve nxp vref driver.
1.Remove the code that sets the UTRIM register to 0,
because UTRIM is automatically loaded with a factory-trimmed
value, zeroing will affect the accuracy. Only need to clear
VREF UTRIM[TRIM2V1] at the initialization stage.

2. VREF does not have NXP_VREF_MODE_INTERNAL_REGULATOR mode,
the internal voltage regulator and chop oscillator are used
to suppress power supply noise and reduce voltage offset,
so remove the NXP_VREF_MODE_INTERNAL_REGULATOR mode.
there are only three modes in VREF, the first is the standby
mode (CSR[BUF21EN] = 0, CSR[HI_PWR_LV] = X), the second is
low power mode (CSR[BUF21EN] = 1, CSR[HI_PWR_LV] = 0), and
the third is high power mode (CSR[BUF21EN] = 1, CSR[HI_PWR_LV] = 1).

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2025-08-22 06:52:21 +02:00
Zhaoxiang Jin
eb27e42c16 drivers: regulator/pca9420: Correct wrong maximum index.
PCA9420 LDO1 range maximum index is 0x8U not 0x9U.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2025-08-22 06:52:21 +02:00
Peter Marheine
26ab6d858e soc: rp2350: support PWM channels >8
RP2350 adds four more PWM slices from the eight available on RP2040,
which are only broken out to package pins on RP2350B. This change fixes
the driver to support the correct number of slices on RP2350.

Tested by confirming that PWM can correctly be configured on GPIO 44 of
RP2350B.

Signed-off-by: Peter Marheine <peter@taricorp.net>
2025-08-22 03:32:16 +02:00
Tim Lin
9cf0d669e5 drivers/espi: ite: Use structured evt_data for PVT, PVT2, and PVT3 events
Replace direct assignment of evt.evt_data with structured access via
espi_evt_data_pvt. This change separates the incoming evt_data into
type and data fields.

This update alse includes support for handling PVT, PVT2, and PVT3
events using the structured event data.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2025-08-21 20:11:42 +02:00
Rory Piper
ea1245eb92 drivers: flash_stm32h7: Fix REAL_FLASH_SIZE_KB size
For devices other than the stm32h745/747/755/757 that use
dual-core cortex-M4/cortex-M7, do not multiply flash
controller size by 2. Single-core stm32h7x devices define
their flash-controllers dtsi as a single area, not two banks.
Use the presence of the bank2-flash-size prop to determine if
this is a dual-core stm3h7x or not.

Signed-off-by: Rory Piper <rory.piper@signal-fire.com>
2025-08-21 20:11:19 +02:00
Arthur Gay
4008f5c9c2 drivers: disk: sdmmc_stm32: Add API to retrieve SD card CID register
Introduce a new API function in the sdmmc_stm32 driver that allows
applications to access the Card Identification (CID) register of the
SD/MMC card. This functionality, already available in the SPI-based SD
and MMC subsystems, was previously missing from the STM32 SDMMC driver.

This enhancement enables use cases such as verifying the correct SD card
during manufacturing, ensuring that OEMs use the specified SD card, and
preventing mismatches.

Signed-off-by: Arthur Gay <arthur.gay@marshmallow.kids>
2025-08-21 18:42:26 +02:00
Tanguy Raufflet
697fe436e9 drivers: i2c: Kconfig.stm32: enable combined interrupt for STM32MP2
According to the STM32MP2 reference manual, the I2C controller uses
a single interrupt line for all events (EV + ERR), so the combined
interrupt must be enabled for the STM32MP2 series.

Signed-off-by: Tanguy Raufflet <tanguy.raufflet@savoirfairelinux.com>
2025-08-21 18:41:59 +02:00
Tanguy Raufflet
457d1ca58f drivers: clock_stm32_ll_mp2: add i2c clock
Add I2C clocks rate reading to the STM32MP2 clock driver.

Signed-off-by: Tanguy Raufflet <tanguy.raufflet@savoirfairelinux.com>
2025-08-21 18:41:59 +02:00
Tanguy Raufflet
bec960356c drivers: gpio: stm32: add gpioz support for the STM32MP2
Add support for GPIOZ in the STM32 GPIO driver.

Signed-off-by: Tanguy Raufflet <tanguy.raufflet@savoirfairelinux.com>
2025-08-21 18:41:59 +02:00
Tanguy Raufflet
6325b73739 drivers: pinctrl: stm32: add gpioz pinctrl support for STM32MP2
The STM32MP2 series needs gpioz pinctrl support to be able to use
the GPIOZ pins.

Signed-off-by: Tanguy Raufflet <tanguy.raufflet@savoirfairelinux.com>
2025-08-21 18:41:59 +02:00
Sylvio Alves
34eb58c043 espressif: fix Kconfig style issues
Fix Kconfig style issues in Espressif files.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2025-08-21 18:41:52 +02:00
Jake Greaves
ba4bb91b1b drivers: serial: STM32U5 series lpuart
Allow LPUART to function and wakeup the device from STOP modes

Signed-off-by: Jake Greaves <jake.greaves@analog.com>
2025-08-21 17:13:36 +02:00
Sven Ginka
410ce46578 drivers: ethernet: vsc8541: fix init
added missing config.

Signed-off-by: Sven Ginka <s.ginka@sensry.de>
2025-08-21 17:06:21 +02:00
Guillaume Gautier
78fa4f0142 drivers: clock: n6: prevent clock configuration if NO_SEL is used
For STM32N6, when a device clock source is defined with NO_SEL, do not
configure it.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-08-21 17:05:57 +02:00
Kevin Wang
618b6b46a5 tests: drivers: dma: Update board config and overlay for adp_xc7k_ae350
1. Add config and overlay file in test scatter_gather for adp_xc7k_ae350
   and adp_xc7k_ae350_clic to support the test case.
2. Modify the config file in test chan_blen_transfer and loop_transfer
   because the tests do not support the NOCACHE memory configuration,
   the DCACHE configuration needs to be disabled.

Signed-off-by: Kevin Wang <kevinwang821020@google.com>
2025-08-21 15:58:35 +02:00
Kevin Wang
06bec271d9 drivers: dma: atcdmac300: Upgrade atcdmac driver to support series device
1. Upgrade the ATCDMAC driver to make it compatible with multiple
   ATCDMAC series drivers.
2. Rename the driver from ATCDMAC300 to ATCDMACX00.

Signed-off-by: Kevin Wang <kevinwang821020@google.com>
2025-08-21 15:58:35 +02:00
Ayush Singh
ef9baf67e7 drivers: clock_control: mspm0: Check SOC for HFCLK
- The function DL_SYSCTL_setHFCLKSourceHFCLKIN is not defined for
  MSPM0L11XX and MSPM0L13XX.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2025-08-21 15:46:28 +02:00
Thomas Altenbach
7436b9dd85 drivers: flash: flash_stm32_qspi: Add support for cs-high-time
This commit adds support for the new cs-high-time devicetree property.
The QUADSPI_DCR_CSHT is now configured according to the value indicated
in the devicetree, for both single and dual flash modes.

Signed-off-by: Thomas Altenbach <altenbach.thomas@gmail.com>
2025-08-21 15:46:12 +02:00
Thomas Altenbach
b147d78c2f drivers: flash: stm32_qspi: Use sample shift also in single flash mode
The QSPI 1/2 sample shift (SSHIFT) was only enabled in dual flash mode.
This feature is useful to guarantee that data is ready at the sampling
moment, even if the signals are a bit delayed due to PCB constraints.
Therefore, it should be enabled when possible (only supported in STR
mode).

Signed-off-by: Thomas Altenbach <altenbach.thomas@gmail.com>
2025-08-21 15:46:12 +02:00
Guillaume Gautier
308e219ea5 drivers: pwm: stm32: use kernel clock instead of dedicated function
Now that the timer kernel clocks are defined in device tree, use the
clock get API to fetch the clock frequency instead of calculating the
value in the driver.
Removes the now unused function get_tim_clk.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-08-21 13:06:58 +02:00
Guillaume Gautier
2ab5452b32 drivers: counter: stm32: use kernel clock instead of dedicated function
Now that the timer kernel clocks are defined in device tree, use the
clock get API to fetch the clock frequency instead of calculating the
value in the driver.
Removes the now unused function counter_stm32_get_tim_clk.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-08-21 13:06:58 +02:00
Guillaume Gautier
4ccef2d443 dts: arm: st: wba: add support for timer kernel clock
Add support for timer kernel clock for STM32WBA.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-08-21 13:06:58 +02:00
Guillaume Gautier
525227e28a dts: arm: st: u5: add support for timer kernel clock
Add support for timer kernel clock for STM32U5.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-08-21 13:06:58 +02:00
Guillaume Gautier
7c44ebe493 dts: arm: st: h7: add support for timer kernel clock
Add support for timer kernel clock for STM32H7.

Define a new property for the timer prescaler in the RCC binding of H7.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-08-21 13:06:58 +02:00
Guillaume Gautier
1614da68c7 dts: arm: st: h5: add support for timer kernel clock
Add support for timer kernel clock for STM32H5.

Define a new RCC binding for H5 with the timer prescaler property (timpre).

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-08-21 13:06:58 +02:00
Guillaume Gautier
142f62a911 drivers: clock: stm32: add support for timer kernel clock
Add initial support for timer kernel clock for STM32.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-08-21 13:06:58 +02:00
Rafal Dyla
8876a3bbd2 modules: hal_nordic: nrfs: Disabling subscription
- Code optimization for platforms which don't use subscription feature
in the temperature service.
- Test adaptation to code changes

Signed-off-by: Rafal Dyla <rafal.dyla@nordicsemi.no>
2025-08-21 11:08:09 +02:00
Tomasz Bursztyka
347fb0a75a drivers: pwm: Use DEVICE_API relevantly on mspm0 driver
It was missing thus it was not possible to get a valid answer
from DEVICE_API_IS().

Signed-off-by: Tomasz Bursztyka <tobu@bang-olufsen.dk>
2025-08-21 06:52:34 +02:00
Ren Chen
80d5ecc148 drivers: spi: it51xxx: move interrupt flags check to compile time
as title.

Signed-off-by: Ren Chen <Ren.Chen@ite.com.tw>
2025-08-21 06:51:59 +02:00
Ren Chen
8563510dfd driver: spi: it51xxx: enable spi clock only when spi transaction
This commit disables spi clock during idle to reduce power
consumption.

Tested with: reduce current cons. by around 0.08mA on it515xx_evb

Signed-off-by: Ren Chen <Ren.Chen@ite.com.tw>
2025-08-21 06:51:59 +02:00
Derek Snell
6d748db7c7 drivers: mipi_dbi: nxp_lcdic: add DMA_ADDR_ADJ_NO_CHANGE
Update dma_block_config for memory to peripheral transfers.

Signed-off-by: Derek Snell <derek.snell@nxp.com>
2025-08-21 01:43:50 +02:00
Jake Greaves
e247cc3d9c drivers: counter: stm32: config rtc prescaler from DT
Handle RTC prescaler options inside RTC counter driver

Signed-off-by: Jake Greaves <jake.greaves@analog.com>
2025-08-20 18:46:47 +02:00
Jake Greaves
20d9780f61 drivers: rtc: STM32U5XX rtc scalers
Allow RTC prescalers to be configurable via dts

Signed-off-by: Jake Greaves <jake.greaves@analog.com>
2025-08-20 18:46:47 +02:00
Terry Geng
7210087cbc drivers: spi: spi_pico_pio: Implement DMA support for 4-wire operation
This commit largely mirrors the approach of implementing DMA in the pl022
driver.

Signed-off-by: Terry Geng <terry@terriex.com>
2025-08-20 18:46:31 +02:00
Henrik Brix Andersen
816f6cbd99 drivers: retained_mem: retained_mem_zephyr_ram: flush d-cache if enabled
Flush the data cache if cache management is enabled. Flushing the data
cache is required to ensure data retention across system resets.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2025-08-20 16:31:52 +02:00
Pieter De Gendt
08336629c1 drivers: display: mcux_elcdif: Optional start on init
After 8495e30726 some display controller
drivers failed to start. Make the start optional and enabled by default if
there are frame buffers allocated by the driver.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-08-20 16:31:09 +02:00
Camille BAUD
eab94972ed drivers: uart: Update bflb uart driver for BL70x
BL70x almost equal BL60x here

Signed-off-by: Camille BAUD <mail@massdriver.space>
2025-08-20 16:30:48 +02:00
Camille BAUD
d68418c068 drivers: clock_control: Add BL70x clock control
Adds clock_control driver for BL70x

Signed-off-by: Camille BAUD <mail@massdriver.space>
2025-08-20 16:30:48 +02:00
Camille BAUD
41ab7ec622 drivers: pinctrl: Update bflb pinctrl for bl70x
BL70x = BL60x here

Signed-off-by: Camille BAUD <mail@massdriver.space>
2025-08-20 16:30:48 +02:00
Camille BAUD
ea06ab3e93 drivers: syscon: Add condition for BL70x
BL70x = BL60x in this case

Signed-off-by: Camille BAUD <mail@massdriver.space>
2025-08-20 16:30:48 +02:00
Camille BAUD
0ab46a6d9c drivers: clock_control: Add BL61x clock control
Adds clock_control driver for BL61x

Signed-off-by: Camille BAUD <mail@massdriver.space>
2025-08-20 13:45:26 +02:00
Camille BAUD
14c449986e drivers: pinctrl: Add BL61x pinctrl
This adds pinctrl support in the bflb driver for BL61x

Signed-off-by: Camille BAUD <mail@massdriver.space>
2025-08-20 13:45:26 +02:00
Camille BAUD
61e79b32e6 drivers: syscon: fix headers used in BFLB efuse driver
Fixes wrong headers

Signed-off-by: Camille BAUD <mail@massdriver.space>
2025-08-20 13:45:26 +02:00
Jamie McCrae
db8f991c77 kconfig: Use $(...) instead of ${...} for getting variables
Updates this to comply with the Zephyr Kconfig recommendations

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-08-20 12:05:41 +02:00
BUDKE Gerson Fernando
77070941fa dts: phy: Add clock-reference prop in stm32u5-otghs-phy
The OTG_HS PHY from stm32u5a5xx device require the correct reference
clock frequency selction in SYSCFG_OTGHSPHYCR. The current default is
hard coded to 16Mhz (which matches the development board crystal).
However, a custom board my require a different crystal and then the
USB will not work. This add a required field in the
st,stm32u5-otghs-phy binding to force user to select the correct
clock reference. The current nucleo_u5a5zj_q baord was updated to
reflect the mandatory field.

Signed-off-by: BUDKE Gerson Fernando <gerson.budke@leica-geosystems.com>
2025-08-20 12:05:24 +02:00
Pieter De Gendt
f1b4c7c992 drivers: ethernet: nxp_imx_netc: Fix LAA bit location
The Locally Administered Address (LAA) bit should be set on the first
octet of the MAC address.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-08-20 09:29:14 +02:00
Adrian Gielniewski
163526b2fc drivers: Do not use deprecated OpenThread instance pointer.
Implementation should use a dedicated function to get OpenThread
instance instead of using the deprecated pointer from context.

Signed-off-by: Adrian Gielniewski <adrian.gielniewski@nordicsemi.no>
2025-08-20 09:28:10 +02:00