Commit graph zephyr/drivers/flash
Author SHA1 Message Date
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
Erwan Gouriou
434ca35827 drivers: flash: stm32_xspi: Minor cleanup
Move around some code before driver instanciation

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2026-02-20 14:58:58 +01:00
Erwan Gouriou
c40651be07 drivers: flash: stm32_xspi: Rework code relating to some properties
Some DT properties where used directly in the code w/o being put in
instatiable device structs (cfg, data).
Move them in these structs and access it from there.

Change definition of STM32_XSPI_RESET_GPIO to DT_ANY_INST

While I'm at it, simplify use of DT macros, replace
DT_NODE_HAS_PROP(DT_INST(0, st_stm32_ospi_nor), foo)
by DT_INST_NODE_HAS_PROP(0, foo).

Remove DT_XSPI_IO_PORT_PROP_OR, which is unused.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2026-02-20 14:58:58 +01:00
Erwan Gouriou
8790a72cd3 drivers: flash: stm32_xspi: Remove DT sfdp-bfp support
While there was a small related piece of code in the driver,
it is not handled in the code.
Remove the related code and make clear in the binding that this property
is not supported.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2026-02-20 14:58:58 +01:00
Erwan Gouriou
eca099fd7f driver: flash: stm32_xspi: Add Kconfig symbol for DMA
Having a dedicated Kconfig symbol will make things easier for next steps.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2026-02-20 14:58:58 +01:00
Petr Buchta
68b153831a drivers: flash: mcux_c40: fix partition parent lookup
Use DT_GPARENT() so that protection entries are generated for
partitions under the fixed-partitions node, even when an extra
intermediate node is present. This ensures the C40 protection table
is correctly derived from the flash<x> partitions.

Signed-off-by: Petr Buchta <petr.buchta@nxp.com>
2026-02-20 07:05:50 +01:00
Petr Buchta
42d9b9ed0a drivers: flash: guard flash_shell against NULL api
Handle the case where the chosen zephyr,flash-controller device has
no flash API (api == NULL). This prevents flash_shell from
dereferencing a NULL api pointer and hard-faulting when no usable
default flash device is available.

Signed-off-by: Petr Buchta <petr.buchta@nxp.com>
2026-02-20 07:05:50 +01:00
Jordan Yates
88fa1e2c94 flash: spi_nand: initial generic driver
Initial generic driver for SPI-NAND devices that expose the ONFI
parameter page. Does not support advanced features such as continuous
reads, software ECC, or optional power down modes.

Configuration comes from devicetree in order to support other modules,
but is validated against the loaded ONFI data at boot.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2026-02-20 07:05:32 +01:00
Manojkumar Konisetty
e2bb8efb9a drivers: flash: Add Infineon PSOC4 flash driver and CMakeLists
- Implement flash read, write and erase APIs.
- flash rows are automatically erased during Cy_Flash_WriteRow()
  operation.
- Implement erase by writing the erased value (0xFF) to maintain
  compatibility with the Zephyr flash API.i

Signed-off-by: Manojkumar Konisetty <manoj@aerlync.com>
Signed-off-by: Sayooj K Karun <sayooj@aerlync.com>
2026-02-17 13:18:35 -06:00
Manojkumar Konisetty
d48b688dcb drivers: flash: Add Flash Kconfig for PSOC4 series
- Introduce FLASH_INFINEON_PSOC4 to enable the flash driver for the
  Infineon PSoC4 family.
- This option selects required flash capabilities.

Signed-off-by: Manojkumar Konisetty <manoj@aerlync.com>
Signed-off-by: Sayooj K Karun <sayooj@aerlync.com>
2026-02-17 13:18:35 -06:00
Mathieu Choplain
a11688fab5 drivers: *: stm32: don't check if clock device is ready
If the clock device (i.e., RCC) failed to initialize, we have bigger
problems than trying to call clock_control_{off,on,configure} on it.
Don't bother checking to save some footprint.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-02-13 18:59:16 +00:00
Etienne Carriere
2093b9be13 drivers: flash: stm32_*spi: remove unused *SPI_FLASH_MODULE() macros
Remove unused OSPI_FLASH_MODULE(), QSPI_FLASH_MODULE() and
XSPI_FLASH_MODULE() macros.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2026-02-13 12:36:46 +01:00
Tim Pambor
176a880666 drivers: flash: simulator: support multiple instances
Rework flash simulator to use per-instance configuration,
replacing single global state and enabling support for
multiple independent simulator instances.

Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2026-02-11 10:39:29 +01:00
Johannes Schuler
ec94191d70 drivers: flash: stm32u5/stm32l5 rdp
Implement readout protection for the STM32U5 / STM32L5 series.
Move the stm32u5 / stm32l5 flash register manipulation in
flash_stm32_option_bytes_write() to be called by the
flash_stm32_set_rdp_level().

Signed-off-by: Johannes Schuler <jschuler@testo.de>
2026-02-10 22:18:43 +01:00
Firas Sammoura
3bab28349f drivers: flash: npcx: add qspi_npcx_fiu_mutex_is_locked function
Add a helper function to check the lock status of the QSPI-FIU
bus controller mutex. This is useful for debug assertions and
verifying exclusive access in high-level drivers.

Signed-off-by: Firas Sammoura <fsammoura@google.com>
2026-02-10 13:30:14 -06:00
Etienne Carriere
90915fc715 drivers: flash: stm32_*spi: remove ARG_UNUSED() where useless
Remove ARG_UNUSED() where not needed in STM32 QSPI/XSPI drivers.

No functional changes.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2026-02-10 15:11:28 +01:00
Etienne Carriere
7c90d75a73 drivers: flash: stm32_*spi: duplicated IOMEM registers base address
IOMEM interface base address is stored in both device configuration
and device data structures. Remove the occurence in the config data
that is used only for trace messages.

No functional changes.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2026-02-10 15:11:28 +01:00
Thomas Decker
a88a01c901 drivers: flash: stm32_xspi: Remove hard-coded XSPI2 dependency
Check the used XSPIx peripheral before calling the corresponding function
instead of hard-coded calling the LL_PWR_EnableXSPIM2() and
LL_SBS_EnableXSPI2SpeedOptim() during flash_stm32_xspi_init(...).

Signed-off-by: Thomas Decker <decker@jb-lighting.de>
2026-02-09 13:30:52 +01:00
Tim Pambor
1b4555b575 drivers: flash: shell: print partitions from all partition tables
If a device has multiple flashes, likely it has multiple partition tables.
This change updates the `flash partitions` command to print all partitions
for all partition tables, instead of just one partition table.

Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2026-02-06 13:57:08 +01:00
Hau Ho
d6ce5eabcb drivers: flash: Add support for flash driver on RX140 SoC
Add support for flash driver on RX140 SoC

Signed-off-by: Hau Ho <hau.ho.xc@bp.renesas.com>
2026-02-06 11:09:14 +01:00
Albort Xue
23cdd0f374 drivers: flash: flexspi_nor: Update page program LUT for 4-byte addressing
When 4-byte addressing is enabled, update the page program LUT entry
to use the appropriate 4-byte page program command (SPI_NOR_CMD_PP_4B).

For octal mode (1S-8S-8S), select the correct page program command
based on address width:
- Use SPI_NOR_CMD_PP_1_8_8_4B for 32-bit addressing
- Use SPI_NOR_CMD_PP_1_8_8 for 24-bit addressing

This ensures the flash controller uses the correct command sequence
for page programming operations in both standard and octal modes with
extended addressing.

Signed-off-by: Albort Xue <yao.xue@nxp.com>
2026-02-03 14:27:07 -06:00
Albort Xue
8dd7b20f84 drivers: flash: spi_nor: Add octal page program command definitions
- 1-1-8 and 1-8-8 page program commands for 3-byte addressing
- 1-1-8 and 1-8-8 page program commands for 4-byte addressing

Signed-off-by: Albort Xue <yao.xue@nxp.com>
2026-02-03 14:27:07 -06:00
Ha Duong Quang
12ae881233 drivers: flash: add NXP S32 XSPI flash hyperRAM driver for K5
add NXP S32 XSPI flash hyperRAM driver for K5

Signed-off-by: Ha Duong Quang <ha.duongquang@nxp.com>
2026-02-03 08:20:27 -06:00