Commit graph

1,525 commits

Author SHA1 Message Date
Vincent Tardy
9439366997 soc: stm32: fix issue about k_work_q used by soc and flash driver
In driver file flash_stm32wba_fm.c, rename ble_ctrl_work_q
to ble_ctle_work_q and make ble_ctle_work_q non-static
in SoC code

Signed-off-by: Vincent Tardy <vincent.tardy@st.com>
2026-03-24 10:52:29 -05:00
Francois Ramu
93f702a4b4 drivers: flash: stm32 xspi driver with HPDMA transfer
Enables the HPDMA on stm32 xspi flash transfer on the stm32H7rs series

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2026-03-23 14:57:56 -05:00
Tim Pambor
59ca2288d5 flash: spi_nand: support bad block management
Add support for bad block management in SPI NAND flash devices.
This includes functions to check if a block is bad and to mark
a block as bad. The bad block marker is stored in the OOB area of
the first page of each block.

Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2026-03-23 12:31:30 -05:00
Sudarshan Jagannathan
f4cad414ce drivers: flash: stm32: style guidelines compliance changes
Applying clang-format to changed files to ensure compliance
with Zephyr coding style guidelines.

Signed-off-by: Sudarshan Jagannathan <sudarshan.jagannathan@st.com>
2026-03-23 12:29:40 -05:00
Sudarshan Jagannathan
367a4b4619 drivers: flash: stm32: Add Kconfig to allow unaligned flash_write ops
Add Kconfig option to accept unaligned addresses and/or lengths for
flash_write for stm32 devices. Use with caution after understanding
target platform flash implementation details. Op may fault if used
without forethought

Signed-off-by: Sudarshan Jagannathan <sudarshan.jagannathan@st.com>
2026-03-23 12:29:40 -05:00
Fabio Baltieri
60721101fc drivers: flash: stm32: fix llvm warning
Fixes:

zephyrproject/zephyr/drivers/flash/flash_stm32_ex_op.c:348:3: warning:
label followed by a declaration is a C23 extension [-Wc23-extensions]
  348 |                 int rv2;
      |                 ^

when compiling with llvm.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2026-03-23 08:48:22 -04:00
Khoa Nguyen
b75084e339 drivers: flash: Update Renesas RA MRAM to support mapped-partition
Previously, nv-flash nodes were used as the flash controller and
contained APIs. But currently, to support mapped-partitions
and allow MCUboot to run on RA8x2 devices, this MRAM driver need
to correct the node that used for flash controller.

Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
2026-03-23 10:19:12 +01:00
Mohit Talwar
c7616308e6 drivers: flash: nrf_rram: add alignment validation for write and erase
The nrf_rram_write() and nrf_rram_erase() functions were missing
input validation for address and length alignment.

nrf_rram_write() did not verify that addr and len are multiples of
WRITE_LINE_SIZE (16 bytes), allowing unaligned writes to succeed
when they should return -EINVAL.

nrf_rram_erase() did not verify that addr and len are multiples of
PAGE_SIZE (4096 bytes), allowing unaligned erases to succeed when
they should return -EINVAL.

Add alignment checks to both functions to correctly reject invalid
operations as required by the flash API contract.

Assisted-by: Claude:claude-sonnet-4-6

Fixes #102511

Signed-off-by: Mohit Talwar <talwarmohit2005@gmail.com>
2026-03-23 10:19:02 +01:00
Quy Tran
dcf50a895a boards: renesas: rx: Add flash support on RX14T boards
Add flash partition on FPB-RX14T and MCB-RX14T boards

Signed-off-by: Quy Tran <quy.tran.pz@renesas.com>
2026-03-23 10:16:41 +01:00
Jamie McCrae
cdc480afb6 dts: nordic: nrf54h20/nrf9280: Update to use zephyr,mapped-partitions
Updates the dts nodes switch partitions to use the new
zephyr,mapped-partition compatible.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-03-20 09:54:59 -05:00
Erwan Gouriou
fec56d3076 soc: stm32: common: Add xspi manager
Implement a device driver for XSPI manager.
This allows to define the xspi controllers configuration that should
be applied towards the xspi IO ports:
- Muxed
- Swapped
- ...

Since its configuration has impact on final application location and
implies the deactivation of xspi clocks, it should be run only at fsbl
stage and not later.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2026-03-20 20:46:57 +09:00
Erwan Gouriou
7df2d0e20b drivers: flash: stm32_xspi: Fix XPIM presence conditional check
There is no such thing as XSPIM1/XSPIM2 and not all XSPIM compatible
devices declare HAL_XSPIM_IOPORT_1/2.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2026-03-20 20:46:57 +09:00
Braeden Lane
cda17113e2 drivers: flash: infineon_pdl: enforce write block alignment
The PSOC4 flash driver accepted unaligned write offsets and sizes,
using a read-modify-write path to handle sub-row writes. This
violated the flash API contract, as the driver advertises
write_block_size=256 via devicetree.

Additionally, the Infineon HAL function Cy_Flash_WriteRow() requires
row-aligned addresses and exactly CY_FLASH_SIZEOF_ROW bytes of data.
The R-M-W path was passing unaligned addresses to the HAL, which
would reject them, but the driver was not checking the return value
and silently reported success after failed writes.

Add write alignment validation for both offset and size. Remove the
dead read-modify-write code path. Add missing error checking on
Cy_Flash_WriteRow() return value in the write loop, consistent with
the erase function.

Handle caller-provided data buffers that are not 4-byte aligned by
staging each row through a local aligned buffer before calling
Cy_Flash_WriteRow(), which requires a uint32_t-aligned source
pointer. When the source is already aligned, it is passed directly
with no copy overhead.

Signed-off-by: Braeden Lane <Braeden.Lane@infineon.com>
2026-03-19 17:09:42 -05:00
Guillaume Gautier
1ab0cb53d9 drivers: flash: stm32c5: add flash support for stm32c5
Adds the support of Flash API for STM32C5.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2026-03-19 11:39:33 +00:00
Duy Nguyen
025402e981 flash: renesas: rx: Add flash type config for RX26T MCU
Add new configuration to support flash type config on RX26T

Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
2026-03-19 15:27:18 +09:00
William Markezana
d547042bf9 drivers: bflb: extend shared drivers with BL70XL SoC support
Add CONFIG_SOC_SERIES_BL70XL to preprocessor conditionals across
existing Bouffalo Lab drivers that share register-compatible code
paths with BL60x/BL70x:

- cache: L1C flush-enable workaround applies to BL70XL
- flash: XIP address defines, L1C wrap, QPI JEDEC ID support
- gpio: BL70XL includes, fix BIT() usage for pin set/clear
- i2c: clock source calculation
- serial: UART clock divider, guard UART1 (BL70XL has only UART0)
- spi: GLB address and FIFO size, clock calculation
- syscon: efuse SAHB clock selection
- input: IR receiver pin mapping and clock divider

Signed-off-by: William Markezana <william.markezana@gmail.com>
2026-03-18 17:40:26 -05:00
Missael Maciel
c092468dc1 drivers: flash: flash_mcux_flexspi_nor: Add support for memory W25Q256
Memory W25Q256 support added into flash driver. If someone
uses this memory, the driver will configured into 4-bytes
address mode which will cause issues with the bootROM for
some NXP's RTs/RW microcontrollers.

Signed-off-by: Missael Maciel <davidmissael.maciel@nxp.com>
2026-03-18 15:26:53 -05:00
Francois Ramu
6e87d2e225 driver: flash: stm32 xspi driver with abstraction on port naming
Name the XSPI 1/2 depending on the stm32 series. It could be mixed between
XSPI or OCTOSPI depending on the module HAL.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2026-03-18 15:21:14 -05:00
Axel Le Bourhis
d20e9a9484 drivers: flash: mcux: disable cache clear on mcxw70
On mcxw70, the flash cache is managed by the underlying driver from
hal_nxp. The method used in the soc_flash_mcux driver is not suitable
for this platform, and should be disabled.

Signed-off-by: Axel Le Bourhis <axel.lebourhis@nxp.com>
2026-03-18 08:37:20 -05:00
Pascal Linder
63b26574ba drivers: flash: simulator: Add extended operations
NAND flash translation layers require the flash extended operations API
for bad block management. Add it here without implementation to test an
FTL on the flash simulator.

Signed-off-by: Pascal Linder <pascal.linder@zuehlke.com>
2026-03-18 08:36:45 -05:00
Tim Pambor
765895861e drivers: flash: Add bad block management API extensions
Add extended operations to the flash API to support marking blocks
as bad and checking if a block is bad. This is necessary for
NAND flash devices, which can have bad blocks that need to be managed.

Signed-off-by: Pascal Linder <pascal.linder@zuehlke.com>
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2026-03-18 08:36:45 -05:00
Jamie McCrae
f22592cbc5 tree: Replace FIXED_PARTITION_* macro usage with PARTITION_*
Replaces usage of these deprecated macros with ones that support
fixed and mapped partition compatibles. Also includes an update to
hal_espressif which also (rightly or wrongly) has zephyr specific
code in it

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-03-17 18:24:52 -04:00
Fin Maaß
ae6a48b1bf drivers: flash: spi_nor: add dt dependencies for SPI_NOR_SFDP
Add dependencies for the dt props for the
SPI_NOR_SFDP choice.
Also removes the no no longer needed build asserts.

Nice benefit is, that we fallback to SPI_NOR_SFDP_RUNTIME,
if the required dt props for the other options are not set.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-03-16 07:22:58 +01:00
Fabrice DJIATSA
f731bd0b00 drivers: flash: mspi: avoid HAL macro conflicts
Rename FLASH_SIZE(inst) to FLASH_SIZE_INST(inst) and
FLASH_PAGE_SIZE(inst) to FLASH_PAGE_SIZE_INST(inst) in
flash_mspi_nor_sfdp.h to avoid redefinition conflicts with
STM32 HAL headers (stm32l562xx.h and stm32l5xx_hal_flash.h).

Note: Several HAL STM32 files use this macro naming convention;
this issue is not specific to STM32L5.

Signed-off-by: Fabrice DJIATSA <fabrice.djiatsa-ext@st.com>
2026-03-16 07:22:43 +01:00
Sylvio Alves
c64a74e711 espressif: adapt to hal_espressif IDF master sync
Adapt all Espressif SoC and driver code to the updated
hal_espressif module synced with IDF master branch.

Main changes:
- clock control: delegate peripheral clock gating to HAL
  layer using new clock/reset APIs
- SPI/GDMA: adapt to restructured DMA HAL with new channel
  allocation and configuration interfaces
- ethernet: add RMII clock configuration and PHY management
- GPIO: simplify using direct HAL function calls
- flash: adapt to updated SPI flash HAL interfaces
- linker scripts: update IRAM/DRAM mappings for new HAL
  object files
- DTS: fix ESP32-S2 PSRAM dcache1 address to match actual
  MMU mapping region (0x3f800000 DRAM1 instead of 0x3f500000
  DPORT which lacks 8-bit access capability)
- west.yml: update hal_espressif revision

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2026-03-13 11:38:18 +01:00
Raul Hernandez
4bfba93475 drivers: flash: rpi_pico: add optional untranslated read support
Add an opt-in Kconfig option to use the RP2350 untranslated XIP alias
for flash reads. This ensures the flash API can still access physical
partitions when Address Translation has remapped the primary window.
It otherwise introduces no changes for existing applications.

Signed-off-by: Raul Hernandez <raul.hernandez@spaceface.dev>
2026-03-13 09:13:37 +01:00
Firas Sammoura
4e74254c6e drivers: flash: npcx: fix parameter name in qspi_npcx_fiu_uma_block docs
Update the @param documentation for qspi_npcx_fiu_uma_block to match the
actual function signature, changing lock to lock_en.

Signed-off-by: Firas Sammoura <fsammoura@google.com>
2026-03-12 21:25:51 +01:00
Seyoung Jeong
fa0ed03c5b drivers: flash: simulator: fix buggy per-instance erase capability
The simulated flash driver incorrectly applied the no_explicit_erase
capability. It was overriding Kconfig settings with a missing Devicetree
property, which caused RAM-like configurations to wrongly report needing
explicit erases before writes.

This commit fixes the initialization macro to correctly check the DT
instance property no-explicit-erase, while properly falling back to the
global CONFIG_FLASH_SIMULATOR_EXPLICIT_ERASE Kconfig.

A new runtime test is also added to properly verify this capability.

Fixes #100352
Fixes #100400

Signed-off-by: Seyoung Jeong <seyoungjeong@gmail.com>
2026-03-12 14:04:38 -05:00
Fin Maaß
60185e40c3 drivers: flash: spi_nor: remove redundant runtime check
The check for the layout size, when CONFIG_SPI_NOR_SFDP_DEVICETREE
is enabled, is already done with build asserts during build
(inside PAGE_LAYOUT_GEN). We don't need to check a second
time.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-03-12 14:01:56 -05:00
Marcelo Roberto Jimenez
5dbdf9b44c drivers: flash: flash_shell.c: Use the SHELL_HELP macro
This patch uses the new SHELL_HELP() macro in this file.

Signed-off-by: Marcelo Roberto Jimenez <marcelo.jimenez@gmail.com>
2026-03-12 13:58:44 -05:00
Marcelo Roberto Jimenez
04108d8870 drivers: flash: flash_shell.c: Fix parsing of "flash read"
The parsing of the number of bytes to read in the read command was being
done in hexadecimal, causing unexpected behavior.

Now the number can be interpreted in decimal or hexadecimal if prefixed
with 0x.

Signed-off-by: Marcelo Roberto Jimenez <marcelo.jimenez@gmail.com>
2026-03-12 13:58:44 -05:00
Marcelo Roberto Jimenez
cb2382d25b drivers: flash: flash_shell.c: Requires device on destructive ops
This patch avoids the use of the default device on destructive
operations like erase and write. Allowing it might have catastrophic
results like erasing parts or the whole of the application itself.

Signed-off-by: Marcelo Roberto Jimenez <marcelo.jimenez@gmail.com>
2026-03-12 13:58:44 -05:00
Jiafei Pan
663904a2c9 drivers: flash_mcux_flexspi_nor: update for Cortex-A Core support
Make the driver to be ARM64 compatible to support Cortex-A Core.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2026-03-12 11:33:24 +01:00
Atilla Filiz
9c14845fce drivers: flash: spi_nand: ignore ECC errors on the parameter page
The parameter page is not ECC protected, but can return ECC errors under
some conditions. These errors should be ignored so drivers can
initialize.

Signed-off-by: Atilla Filiz <atilla@fi-tech.be>
2026-03-10 14:21:04 -05:00
Khai Cao
e08cbc77e0 drivers: flash: select MPU_ALLOW_FLASH_WRITE for Renesas RA MRAM
MRAM programs via direct memory-mapped writes, which the ARM MPU
blocks unless MPU_ALLOW_FLASH_WRITE is enabled. Fixes a Data Access
Violation on ra8x2 when running the flash common test suite.

Signed-off-by: Khai Cao <khai.cao.xk@renesas.com>
2026-03-10 09:39:10 +01:00
Albort Xue
864269e27c drivers: flash: mcux_flexspi_nor: use IP read path
When IPED encryption is enabled, AHB-mapped reads can hang.

Switch flash_flexspi_nor_read() to use FlexSPI IP read
transactions and handle unaligned requests with aligned
chunk reads plus memcpy to the caller buffer.

This removes the SoC-specific workaround and avoids
hangs in encrypted regions.

Signed-off-by: Albort Xue <yao.xue@nxp.com>
2026-03-10 09:35:59 +01:00
Tim Pambor
a5edb9aa2c flash: spi_nand: support reset operation
Add support for reset extended operation to clear all volatile register
settings. Notably, ECC enable and block protection registers are not
reset by a soft reset.

Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2026-03-06 10:00:03 +01:00
Tien Nguyen
c353ec046c drivers: flash: update to support Renesas RZ/T2L
- Get unit number and memory size from devicetree
- Renesas RZ/T2L uses at25sf128a flash chip which differs from RZ/T2M
  and RZ/N2L supported previously. The Write Status Command may write
  incorrect data to Status Register or Configuration Register on this
  chip. Remove this code to make the driver common for other SoCs.

Signed-off-by: Tien Nguyen <tien.nguyen.zg@renesas.com>
2026-03-06 09:54:52 +01:00
Tien Nguyen
4558034d7f driver: flash: Initial flash support for Renesas RZ/A2M
Initial flash support for Renesas RZ/A2M

Signed-off-by: Tien Nguyen <tien.nguyen.zg@renesas.com>
2026-03-06 09:54:31 +01:00
Francois Ramu
ecc8af4a08 drivers: flash: stm32u3 erase with BKER reset on single bank 512K
On the stm32U3 with 512K of flash in a single bank,
reset the BKER bit of the FLASH_CR register.
See RefMan Table Flash module organization"
Note "2. When DUALBANK is set to 0 in the option bytes,
for 512-Kbyte single-bank STM32U375/385 devices,
the flash is addressed as a single bank,
and the page numbers are continuous from 0 to 127.
Set BKER = 0 to select bank 1."

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2026-03-03 13:30:50 +01:00
Francois Ramu
b844fb6d7f drivers: flash: stm32u3 flash erase or program on voltage scale1
On the stm32U3 series, erase/program operation requires
the voltage range is set to range 1.
This is done before loop on erase/write and the initial voltage
range is restored afterwards.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2026-03-03 13:30:50 +01:00
Francois Ramu
8167e1c5d9 drivers: flash: stm32u3 flash page layout
On the stm32U3, like it is on the stm32U5 series,
gives the exact nb of pages of 4KB depending on the flash size.
For the page layout, the nb of pages does not depends on the
DUALBANK option byte.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2026-03-03 13:30:50 +01:00
Vincent Tardy
dee7f1d701 drivers: flash: stm32wba: add Flash Module initialization
Add FM_Init() function call in the Flash driver initialization
to initialize the Flash Module.
This function is introduced by the STM32Cube_FW_WBA_V1.8.0
release.

Signed-off-by: Vincent Tardy <vincent.tardy@st.com>
2026-03-03 11:15:26 +01:00
Khoa Nguyen
cd95e8e5a5 drivers: flash: Update interrupt number assign to support RA0
Update interrupt number assign for soc_flash_lp to support RA0

Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
2026-03-02 10:48:45 +01:00
David Jewsbury
eb318914c2 drivers: flash_mspi_nor: Add DMA transfer mode selection
Add CONFIG_FLASH_MSPI_NOR_DMA_DATA_XFER and
CONFIG_FLASH_MSPI_NOR_DMA_CONTROL_XFER as Kconfig options for MSPI
NOR Flash driver. These options are used to select whether data and
control transfers should be performed using DMA or PIO modes.

Update flash_mspi_nor to store choices and apply them accordingly:
use data-xfer-mode for read/write data transfers, and control-xfer-mode
for command/register/configuration traffic. This selection is due to DMA
transfer's having a larger setup overhead so is less beneficial for
short control transfers.

Signed-off-by: David Jewsbury <david.jewsbury@nordicsemi.no>
2026-02-27 15:30:31 +01:00
Peter Wang
8a0b4d715a boards: nxp: frdm_mcxa577: enable flash driver
enable flash driver for frdm_mcxa577
tested tests/drivers/flash/common/

Signed-off-by: Peter Wang <chaoyi.wang@nxp.com>
2026-02-27 08:00:30 +01:00
Jordan Yates
08f9b85d3d flash: simulator: PM support
Add support for the PM API to the flash simulator. This enables testing
the PM behaviour of higher level libraries that use PM in CI to ensure
there are no missing/excessive calls to `pm_device_runtime_put` by the
library. For example:

```
ZTEST(library_pm, test_pm_calls)
{
    const struct device *flash = DEVICE_DT_GET_ONE();

    zassert_equal(0, pm_device_runtime_usage(flash));
    some_complex_flash_user();
    zassert_equal(0, pm_device_runtime_usage(flash));
}
```

Signed-off-by: Jordan Yates <jordan@embeint.com>
2026-02-26 10:35:44 +01:00
Adam BERLINGER
da95dcdbd2 driver: flash_stm32_xspi: Remove HSLV configuration
HSLV now handled by stm32_iocell driver and board device tree.
LL_PWR_EnableXSPIM2 called already in SoC initialization:
soc/st/stm32/stm32h7rsx/soc.c

Signed-off-by: Adam BERLINGER <adam.berlinger@st.com>
2026-02-20 10:32:44 -08:00
Erwan Gouriou
e5d5f3eee7 drivers: flash: stm32_q/o/xspi: Add default to reset_gpios_duration
Make use of a default 1ms value to reset_gpios_duration.
Do not put default to dt prop reset-gpios-duration since it should remain
optionnal.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2026-02-20 14:58:58 +01:00
Erwan Gouriou
f2ed2791f3 drivers: flash: stm32_xspi: Instantiate driver initialization
Now several drivers instances could be enabled at the same time.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2026-02-20 14:58:58 +01:00