Commit graph zephyr/drivers
Author SHA1 Message Date
Ayush Singh
e50eae5b01 drivers: rtc: ti_mspm0: Fix month and year
- According to the zephyr rtc_time struct docs:
  tm_mon = MON - 1
  tm_year = YEAR - 1900
- MSPM0 RTC registers expect the actual month (1 to 12) and year (0 to
  4095)
- So perform the expected conversion on both sides.
- Fixes test_y2k in `tests/drivers/rtc/rtc_api`.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2026-07-01 05:22:54 -04:00
minyuan xue
0f66ecd398 drivers: counter: add ameba counter driver
Add realtek ameba counter driver.

Signed-off-by: minyuan xue <minyuan_xue@realsil.com.cn>
2026-07-01 05:21:51 -04:00
Himanshu Seth
441d734e0a drivers: ethernet: microchip: Add G1 Ethernet Driver
Add G1 Ethernet driver for Microchip Ethernet Peripherals.

Signed-off-by: Himanshu Seth <himanshu.seth@microchip.com>
2026-07-01 05:21:40 -04:00
Himanshu Seth
900b43641b drivers: mdio: microchip: Add G1 MDIO Driver
Add G1 Mdio driver for Microchip MDIO Peripherals.

Signed-off-by: Himanshu Seth <himanshu.seth@microchip.com>
2026-07-01 05:21:40 -04:00
Jun Lin
043b965ecf drivers: timer: npcx: fix potential elapsed cycle underflow
Fix a potential underflow bug in npcx_itim_evt_elapsed_cyc32() that
occurs when cyc_evt_timeout is 1. The timer register is programmed with
MAX(cyc_evt_timeout - 1, 1), but the elapsed calculation used
cyc_evt_timeout - cnt2 - 1, causing an off-by-one mismatch.

When cyc_evt_timeout=1:
- Register is set to MAX(0, 1) = 1
- If read before first tick (cnt=1), elapsed = 1 - 1 - 1 = -1
- This underflows to 0xffffffff (~36 hours worth of cycles)

This can trigger a watchdog reset: the massive elapsed value causes
sys_clock_announce() to run all scheduled tasks in a tight loop,
starving the watchdog feeder.

Fix by mirroring the same MAX(cyc_evt_timeout - 1, 1) logic used when
programming the timer, ensuring the elapsed calculation matches the
actual start value.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2026-06-30 18:22:31 -04:00
Sylvio Alves
e65faf5d6e drivers: serial: esp32 lp_uart irq and optional flow control
Add interrupt-driven API support to the esp32 lp_uart driver and make
RTS/CTS hardware flow control optional, enabled only when the device
tree sets hw-flow-control. Add a loopback property that ties TX to RX
inside the peripheral for self-test without external wiring.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2026-06-30 18:22:25 -04:00
Sylvio Alves
98518707fa drivers: serial: esp32 lp_uart support on esp32c5 and esp32p4
Extend the esp32 lp_uart driver to the esp32c5 and esp32p4. On the
esp32p4 the LP UART signals are routed through the LP GPIO matrix and
the controller is clocked from the precise XTAL_D2 source instead of
the uncalibrated RC_FAST, so the baud-rate framing is reliable.

Relax the fixed-pin bindings, describe the lp_uart node pins on the
c5/c6/p4 HP and LP cores, and extend the echo_ulp sample. Update
hal_espressif for the esp32p4 LP GPIO matrix and clock-tree helpers.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2026-06-30 18:22:25 -04:00
Fin Maaß
d37c847222 drivers: ethernet: esp32: align dt structure
align the devicetree structure
with the recently added more generic
Synopsys ethernet driver, as the esp32
also uses the same IP from Synopsys, so we
can add support for the esp32 in that driver
easier.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-06-30 18:22:15 -04:00
S Swetha
d4e1a56873 drivers: interrupt_controller: intc_ioapic: Add x2APIC physical dest mode
This commit adds physical destination mode for IOAPIC interrupt delivery
on x2APIC platforms. Without this, interrupts were not routed to the
correct APIC ID, causing failures on platforms with non-zero APIC IDs.

On x2APIC platforms, the default RTE destination broadcasts to all
CPUs, but LDR is read-only and uses the cluster model, so interrupts
are not correctly delivered when the physical APIC ID is non-zero,
causing drivers to fail.

Under CONFIG_X2APIC, use runtime APIC ID detection to route interrupts
directly to the current CPU. The existing xAPIC code remains unchanged.

Signed-off-by: S Swetha <s.swetha@intel.com>
2026-06-30 18:22:00 -04:00
Erwan SZYMANSKI
5ef4eaea55 drivers: ethernet: eth_stm32_hal_common: cleanup clang-format
Pass the file in clang-format to clean it up

Signed-off-by: Erwan SZYMANSKI <erwan.szymanski@st.com>
2026-06-30 18:21:43 -04:00
Erwan SZYMANSKI
c8340837d8 drivers: ethernet: eth_stm32_hal_common: multi instances support
Adapt the driver to support Ethernet controller multi instances.
This adaptation is aligned with Zephyr method used for other
drivers.
Now, for each MAC node in DT targetting this driver, a probe
will be processed while a single one was done before.

Signed-off-by: Erwan SZYMANSKI <erwan.szymanski@st.com>
2026-06-30 18:21:43 -04:00
Erwan SZYMANSKI
6908e87bde drivers: ethernet: eth_stm32_hal_common: switch REF_CLK macro to generic
The STM32 ETH HAL for STM32MP13 will be corrected in the following PR:
https://github.com/zephyrproject-rtos/hal_stm32/pull/366

As we want to have a "instance agnostic" approach on each Ethernet
controller device reference, we need to avoid to point on ETH1, ETH2
or more generally ETHx registers. This is up to the HAL to handle it.

Signed-off-by: Erwan SZYMANSKI <erwan.szymanski@st.com>
2026-06-30 18:21:43 -04:00
Erwan SZYMANSKI
b9dc330f6d drivers: ethernet: eth_stm32_hal_common: remove unused random MAC
To prepare the multi instances implementation of eth_stm32_hal
drivers, singletons implementations are cleaned.
Removes this portion of code handling the
zephyr,random-mac-address DT property because it is unused and
managed directly in the framework now.

Signed-off-by: Erwan SZYMANSKI <erwan.szymanski@st.com>
2026-06-30 18:21:43 -04:00
Erwan SZYMANSKI
aa991e8330 drivers: ethernet: eth_stm32_hal: Rework static buf, desc and phy
To prepare the support of the second Ethernet port, need to
remove some static declarations of phy_dev, dma_buf or dma_desc
present in the original code.
The best option here is to pass more elements in
eth_stm32_hal_dev_cfg and eth_stm32_hal_dev_data to better
handle it in v1 and v2 APIs.

When multi instance will be completed, we will have to get
the ressources owned by each eth device reference, this is the
reason of this implementation.

Important: for SoC reference supporting multiple Ethernet ports
(this is the case for the STM32MP13), some HAL functions
prototypes differs. This is what is managed in the original
driver by using STM32_ETH_ARGS macro. We complete this by
implementing ETH_STM32_HAL_GET_CB_DEVDATA macro. The goal of
this one is to point either on the right dev_data reference
in multi instance API case, or to point on a static dev_data
reference if singleton API is used.

Signed-off-by: Erwan SZYMANSKI <erwan.szymanski@st.com>
2026-06-30 18:21:43 -04:00
Laura Carlesso
4fbf56d6cb drivers: flash: update infineon SMIF driver
Correct serial memory qspi init to skip serial memory setup
when not explicitly needed, to avoid SMIF init in XIP mode.
The full fix for this issue will be finalized with issue 112066.

Signed-off-by: Laura Carlesso <laura.carlesso@infineon.com>
Signed-off-by: Davide Di Lello <Davide.Dilello@Infineon.com>
2026-06-30 18:21:29 -04:00
Laura Carlesso
a00c17fbfd drivers: flash: add infineon RRAM driver
Added RRAM driver support.

Signed-off-by: Davide Di Lello <Davide.Dilello@Infineon.com>
Signed-off-by: Laura Carlesso <laura.carlesso@infineon.com>
2026-06-30 18:21:29 -04:00
Fabrice DJIATSA
05e3f0a644 drivers: adc: stm32: skip buffer check in stream mode
In streaming mode the application does not supply a buffer in the
adc_sequence; sample data is written into a buffer allocated from the
RTIO mempool inside the ISR. Skip the sequence buffer size validation
in start_read() when CONFIG_ADC_STREAM is enabled, which otherwise
fails with a spurious -ENOMEM "Provided buffer is too small" error.

Signed-off-by: Fabrice DJIATSA <fabrice.djiatsa-ext@st.com>
2026-06-30 11:54:37 -04:00
Etienne Carriere
5ac025caa8 drivers: ethernet: stm32: Clean MAC address size assertions
Remove the assertion in eth_stm32_hal_v1.c recently introduce between byte
array sizes storing MAC address value. It was useless since both byte
array sizes are based on NET_ETH_ADDR_LEN macro. Moreover the assertion
may produce a build warning as reported (and fixed) in eth_stm32_hal_v2.c
by commit 0ee22dc998 ("drivers: ethernet: stm32: fix clang error").

Factorize the 2 build assertions in eth_stm32_hal2.c with an explicit
comment why it's used.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2026-06-30 11:54:09 -04:00
Etienne Carriere
b0b25c35c9 drivers: use <> to include Zephyr headers instead of ""
Use <> operator to include a Zephyr header file instead of "" that
is intended to local header files, not header files relative to
specifically defined search paths.

This change was made running the sed shell command below:
$ sed -i -E 's/#include "zephyr\/([^"]+)\.h"/#include <zephyr\/\1.h>/g' \
    `grep -rsl "#include \"zephyr/" drivers/`

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2026-06-30 06:49:18 -04:00
Guillaume Gautier
af71b820a7 drivers: spi: stm32: fix h7 stuck in interrupt
This commit deploys a workaround for errata 2.21.3 from ES0491 (and similar
for other H7 SoCs).
This prevent the SPI interrupt to fire when SPI is disabled, by disabling
the EOT and TXP interrupt before disabling the SPI.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2026-06-30 06:49:00 -04:00
The.Thanh Nguyen
1741ac46e3 drivers: udc: fix udc_renesas_ra mutiple instances issue
Update to use the device instance's private message queue instead
of the singleton global message queue.

Signed-off-by: The.Thanh Nguyen <the.nguyen.yf@renesas.com>
2026-06-30 06:48:16 -04:00
Khai Cao
ba4c5bfc48 drivers: crc: fix issue CRC16 ITU_T is not accepted
Fix issue CRC16 ITU_T is not accepted by Renesas RA driver.

Signed-off-by: Khai Cao <khai.cao.xk@renesas.com>
2026-06-30 06:48:07 -04:00
Zhaoxiang Jin
0b736efc05 drivers: otp: add NXP OTPC eFuse driver
Add a read-only Zephyr OTP driver for the NXP OTPC eFuse controller
found on MCX N SoCs. Only otp_read is implemented; fuse programming is
not supported. The OTP API is byte addressed while the controller reads
32-bit words; the driver handles unaligned offsets and lengths
internally.

Read verified on real hardware on frdm_mcxn236, frdm_mcxn947, mcxn947 evk,
and mcxn547 evk

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2026-06-30 06:47:59 -04:00
Hongquan Li
40c00ce2c5 drivers: sdhc: ambiq: fix R2 response word ordering
Fix R2 (CID/CSD) response ordering for the Ambiq SDHC driver.

The Ambiq HAL packs 136-bit R2 responses as a big-endian 128-bit
value with bits 127:96 in ui32Resp[0].  Zephyr's SD stack expects
cmd->response[3] to hold the highest 32 bits, matching the SDHCI
register layout used by other SDHC drivers.  The existing memcpy
therefore placed the response words in reverse order, causing
sdmmc_decode_csd() to read sector_count and block_size as zero.

Replace the memcpy with a conditional copy that reverses the word
order for R2 responses and clears the unused response words for
all other response types.

Fixes #111443

Signed-off-by: Hongquan Li <hongquan.li@processmission.com>
2026-06-30 06:47:19 -04:00
Ryan McClelland
b9c925c8e6 drivers: counter: native_sim: add capture emulator
The native_sim counter driver did not implement the counter capture API,
so the capture path could not be exercised on native_sim / in CI. There
was also no software way to inject a capture edge, unlike gpio_emul which
provides gpio_emul_input_set() for emulating GPIO events.

Implement the capture API in the native_sim counter driver and add a
test-only backend, analogous to gpio_emul:

- counter_capture_emul_input_set()/_get() (+ _dt variants) in the new
  include/zephyr/drivers/counter/counter_capture_emul.h drive/read an
  emulated capture input level. On a configured, enabled and matching
  edge the capture callback is invoked synchronously with the current
  counter value, honoring single-shot vs continuous mode.
- Supported edges are declared in devicetree via rising-edge/falling-edge
  boolean properties and enforced in capture_configure(), mirroring
  GPIO_EMUL_INT_CAPS.

The counter_capture test is reworked so the edge trigger is provided by a
small "trigger source" interface (trigger_src.h) with two CMake-selected
backends: gpio_src.c (GPIO loopback on real hardware) and
counter_capture_emul_src.c (emulated input on native_sim). The test body,
edge/single-shot/continuous coverage and assertions are unchanged. A
native_sim overlay and integration platform are added so the suite runs
on native_sim.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2026-06-30 06:46:41 -04:00
Jordan Yates
deb92718cc flash: remove select FLASH_PAGE_LAYOUT from drivers
Remove `select FLASH_PAGE_LAYOUT` from any flash drivers doing so, as
this is an option to enable an API into the flash driver, not something
the flash driver itself needs.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2026-06-29 22:18:24 -04:00
Michael Zimmermann
e10af22991 tree-wide: replace usages of k_work_q thread with thread_id
The `thread` field is not initialized, if it's being animated via
k_work_queue_run instead of k_work_queue_start.

Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
2026-06-29 22:17:45 -04:00
Fin Maaß
60f93b475d ethernet: dwc_mac: 1000: add hardware checksum offloading
add support for hardware checksum offloading for the
dwc_ether_mac10_100_1000_universal core.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-06-29 14:04:40 -05:00
Fin Maaß
0e6098bd3d drivers: ethernet: dwc_mac: 1000: frag pointer in struct dwmac_priv
put the grag pointer inside the cached struct dwmac_priv.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-06-29 14:04:40 -05:00
Andrej Butok
e11ab6c65f reset: nxp_mrcc: add support for MCXL family
- The MRCC reset registers use different instance and field
  names across MCX families.
  Add a set of abstraction macros that select the correct
  names based on the SoC family,
  allowing the driver to build for the MCXL family in addition to
  the existing MCX SoCs.

- Enables the RESET driver by default on the MCXL family when an
  nxp,mrcc-reset node is enabled in devicetree.

Signed-off-by: Andrej Butok <andrey.butok@nxp.com>
2026-06-29 14:03:39 -05:00
Andrej Butok
0d1983ce3f crc: nxp_lpc: add clock control support
Add optional clock control to the NXP LPC CRC driver so the CRC
peripheral clock is enabled during initialization when a clocks
property is present in devicetree.

Signed-off-by: Andrej Butok <andrey.butok@nxp.com>
2026-06-29 14:03:39 -05:00
Philipp Steiner
01e00a5ae1 drivers: ethernet: stm32: skip HAL restart on link down
Handle PHY link-down callbacks by clearing the network carrier and
returning before changing MAC/HAL state. Keep the HAL stop/config/start
sequence for link-up events where speed or duplex may have changed.

Signed-off-by: Philipp Steiner <philipp.steiner1987@gmail.com>
2026-06-29 13:58:09 -05:00
Romain Jayles
1bcb3de8a6 soc: st: stm32wbax: add PM S2RAM support
Add STM32WBAx suspend-to-RAM support and hook the SoC-specific
implementation into the build when CONFIG_PM_S2RAM is enabled.

Select the custom S2RAM marking capability and add the STM32WBAx S2RAM
support source file.

Update the suspend-to-RAM path to clear the hardware standby flag as early
as possible after resume. Use standby_entered as a software indicator to
track whether standby was effectively entered and cleared, so resume
handling only restores radio state when needed.

Signed-off-by: Romain Jayles <romain.jayles@st.com>
2026-06-29 13:50:45 -05:00
Vincent Tardy
55d081e0e2 soc: stm32wbax: use static direct IRQ registration for radio irq
Replace runtime dynamic IRQ registration
with static direct IRQ registration.

Signed-off-by: Vincent Tardy <vincent.tardy@st.com>
2026-06-29 13:50:16 -05:00
Krzysztof Chruściński
1f81ef30d8 drivers: debug: nrf_etr: Add defensive measures
Even though overflow is detected and data is not processed until data
stream is synchronized, it is still possible that data stream is
corrupted. If system is overloaded (multiple cores writing in parallel
to the STM), it is possible that some data will be lost and it goes
unnoticed. It can be detected by decoding unexpected STP opcode
(e.g. DATA64) or if logging message is invalid.

Add defensive measures which attempts to catch such discrepancies and
drop the message and trigger re-synchronization:

- drop message if unexpected log level is used
- drop message if hexdump data flag is not aligned with a message
length
- trigger re-synchronization if unexpected STP opcode is found
- trigger re-synchronization if STP demultiplexer returns error

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2026-06-29 13:48:33 -05:00
Krzysztof Chruściński
713ecddb9a drivers: debug: nrf_etr: Improve overflow handling
Improve handling of the ETR buffer overflow. If there is a significant
number of data generated, it is possible that the ETR buffer is
multiple time overwritten. Previously, that case was not detected and
there were crashes due to corrupted data after re-synchronization.
Now, on every TBM FULL event write index is incremented. This allows
to track relation between write and read index and proper
re-synchronization.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2026-06-29 13:48:33 -05:00
Krzysztof Chruściński
e44b0026bb drivers: debug: nrf_etr: Cleanup and remove unused data
There is no need to call any handler when STP decoder is back in
sync. Removing redundant code. Additionally, do not try to
process the frame if synchronization loss was just detected.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2026-06-29 13:48:33 -05:00
Krzysztof Chruściński
bca09fa822 debug: mipi_stp_decoder: Add option to detect unexpected stream content
Extend callback to return a bool which indicates if decoded data is
valid. It may be valid from STP protocol perspective but decoded data
may be unexpected which indicates that data stream is corrupted. If
callback indicates invalid data decoder changes state to out of sync
and starts searching for ASYNC.

Adapted test and debug_nrf_etr module which is using the decoder with
stream from the ETR buffer.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2026-06-29 13:48:33 -05:00
Jacob Schloss
8911e54345 drivers: rtc: rv3032: Merge EEPROM command into burst
EEPROM command may be sent in same transaction as EEADDR and EEDATA

Signed-off-by: Jacob Schloss <jacob.schloss@suburbanmarine.io>
2026-06-29 13:47:42 -05:00
Jacob Schloss
0e413744cf drivers: rtc: rv3032: Lock before read
Protect RMW operation by locking early

Signed-off-by: Jacob Schloss <jacob.schloss@suburbanmarine.io>
2026-06-29 13:47:42 -05:00
Jacob Schloss
9c5505769e drivers: rtc: rv3032: Remove unused
Remove unused vars for test build failure.

Signed-off-by: Jacob Schloss <jacob.schloss@suburbanmarine.io>
2026-06-29 13:47:42 -05:00
Jacob Schloss
ecc4b80a14 drivers: rtc: rv3032: Clear EEF before EERD
Clear EEF before setting EERD, so if the EEF clear fails we don't need
 to also clear EERD, just need to release the semaphore.
Clearing EEF is safe.

mfd_rv3032_enter_eerd can no longer be called more than once in a row
since it takes a lock, so don't read the status of EERD, just set it.

Signed-off-by: Jacob Schloss <jacob.schloss@suburbanmarine.io>
2026-06-29 13:47:42 -05:00
Jacob Schloss
441af829e6 drivers: rtc: rv3032: Fix semaphore unlock
Fix semaphore unlock

Signed-off-by: Jacob Schloss <jacob.schloss@suburbanmarine.io>
2026-06-29 13:47:42 -05:00
Jacob Schloss
2ff4bae8d8 drivers: rtc: rv3032: Initialize BSM in MFD
Refactor RV3032 initialization by configuring Vbackup config in MFD.
Assign PMU/BSM bit at init.
Move trickle-resistor-ohms / trickle-charger-mode to MFD dts node.
Add semaphore lock to mfd_rv3032_update_status since it is a RMW.
Poll EEBUSY at startup to allow for fast start when it is not a POR.
Check EEF flag after EEPROM write.
Adjust I2C poll times for all-byte update and single byte update.
Add function to write single eeprom reg to allow faster poll time.
Use single byte eeprom update for PMU and clock out to skip writing
 eeprom when current settings are correct.
Add a k_sem around eeprom operations to protect a future case where
several MFD children are accessing eeprom at same time.

Signed-off-by: Jacob Schloss <jacob.schloss@suburbanmarine.io>
2026-06-29 13:47:42 -05:00
Mathieu Choplain
79b83188a6 drivers: usb: common: stm32: gate PHY interface drivers using Kconfig
Create two Kconfig options which are used to gate compilation of the
PHY interface drivers, previously done using logic in CMake listfiles.

The first option uses the "HAS_xxx" style and is "selected" on series with
a quirk requiring turning off the ULPI clock when using the embedded FS PHY
whereas the other follows the regular driver style, but has a series gate
to prevent compilation on wrong targets (which could occur since the
compatible it checks for is vendor-agnostic).

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-06-29 13:46:32 -05:00
Marvin Gnad
eb9c31a992 drivers: spi: spi_mcux_ecspi: derive SCLK idle level from CPOL
The NXP ECSPI represents clock polarity with two separate fields:
channelConfig.polarity (SCLK_POL), the active polarity, and
channelConfig.clockInactiveState (SCLK_CTL), the level SCLK idles at
between bursts. spi_mcux_configure() set polarity from the CPOL bit but
left clockInactiveState at the kECSPI_ClockInactiveStateLow default
applied by ECSPI_MasterGetDefaultConfig().

As a result, transfers to CPOL=1 devices (SPI modes 2 and 3) ran with an
inconsistent clock: the active polarity was inverted as requested while
the idle SCLK level stayed low. Drive clockInactiveState from the same
CPOL bit so the idle level matches the configured mode.

Signed-off-by: Marvin Gnad <marvin.gnad@gmail.com>
2026-06-29 11:31:27 +02:00
Ayush Singh
86f2b3eaea drivers: rtc: ti_mspm0: Improve dow and dom writing
- Back to back writes to counter/calendar registers such as SEC, MIN,
  HOUR, DAY, MON, YEAR need to be avoided since writes to calendar
  registers take 2 to 3 RTCCLK cycles to take effect.
- The implementation here is taken from TI mspm0 sdk driverlib [0]

[0]: e66677c8c8/mspm0/source/ti/driverlib/dl_rtc_common.c (L38)

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2026-06-29 11:30:50 +02:00
Neil Chen
c589afda1c dts: arm/nxp: Update mcxa344 and mcxaxx6 pwm clock
1. Add SYSTEM_CLK support in mcux_syscon driver
2. Update mcxa344 and mcxaxx6 pwm clock to SYSTEM_CLK

Signed-off-by: Neil Chen <cheng.chen_1@nxp.com>
2026-06-29 11:30:29 +02:00
Jakub Zymelka
3cbb7c0e39 drivers: nrf_rram: hoist RRAMC write-mode programming to nrf_write()
Move the configure/de-configure pair from rram_write() up to nrf_write(),
where SYNC_LOCK guarantees exclusive access for the duration of the
whole API call. The hardware write mode is then programmed exactly
once per flash_write()/flash_erase() in the standalone (non-radio-sync)
path, regardless of how many chunks the throttling loop produces.

Behaviour for non-secure (TF-M) builds is unchanged: RRAMC config is
still programmed by TF-M at boot and never touched here.

Signed-off-by: Jakub Zymelka <jakub.zymelka@nordicsemi.no>
2026-06-29 09:16:40 +02:00
Jakub Zymelka
f223f34607 drivers: flash: nrf_rram: don't advance data pointer in erase emulation
When CONFIG_SOC_FLASH_NRF_THROTTLING is enabled, the chunking loop in
rram_write() unconditionally advances the source pointer by chunk_len
at the end of every iteration. This turns the originally-NULL pointer
into chunk_len, then 2*chunk_len, ... by the start of subsequent
iterations.

The bug only triggers when:

  - CONFIG_SOC_FLASH_NRF_THROTTLING=y
  - the erase length is greater than
    CONFIG_NRF_RRAM_THROTTLING_DATA_BLOCK * 16 (default 256 B)

Guard the data pointer advance with an explicit data != NULL check so
the erase emulation path stays on the memset() branch for every
chunk.

Signed-off-by: Jakub Zymelka <jakub.zymelka@nordicsemi.no>
2026-06-29 09:16:40 +02:00