Commit graph

1,525 commits

Author SHA1 Message Date
Sylvio Alves
6d5754978c drivers: flash: esp32: preserve volatile qualifier in IPM callback
Preserve the volatile qualifier when casting the shared memory pointer
in flash_cpu01_receive_cb() to avoid dropping volatile semantics during
inter-processor communication.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2025-12-17 13:57:38 -05:00
Holt Sun
97f497155b drivers: flash: mcux_flexspi: fix cache unused variable warning
Preserve original write length for DCACHE_InvalidateByRange()
Guard declaration of `size` with CONFIG_HAS_MCUX_CACHE to avoid
unused-variable warnings when cache is disabled
Add pointer validity checks before cache invalidation

Signed-off-by: Holt Sun <holt.sun@nxp.com>
2025-12-17 10:58:30 +02:00
Martin Gysel
c42c8a4da4 drivers: flash: stm32 ospi: do not invalidate bet at end of loop
This modification prevents the bet pointer from being nulled at the end
of the loop, which would otherwise render the search for a suitable
erase type ineffective. It also optimize the loop as it omits
unnecessary operations.

Without this change, the erase size defaults to one sector. If the chip
defines fewer than JESD216_NUM_ERASE_TYPES (=4) erase types, this
behavior still works, as the resulting command will correspond to a
sector erase operation. However, if the chip defines all erase types,
the resulting command will be the one specified in the erase type. But
since bet is nulled, the erase size will incorrectly default to the
sector size.

Signed-off-by: Martin Gysel <me@bearsh.org>
2025-12-16 10:17:41 -06:00
Erwan Gouriou
7de3e6acdd drivers: flash: flash_stm32_xspi: Allow flash driver init in ram load
Current driver protections prevent to initialize driver when run as from
an external application running from ext flash. Aim is to avoid performing
full driver initialization of the NOR flash controller the application
is read from.
But this problem is actually only valid when application is running in XIP
mode (read in memory mapped mode at run time).

In ram load mode, since there is no direct activity from the application
on the NOR device, nothing prevents the ext flash driver to be used fully.
Hence, we should allow the controller initialization to happen, with some
adjustments. Mostly, what we need is to:
- skip the hal init
- abort memory mapping afterwards to let the jedec reading happen.

Remove conditions around `stm32_xspi_is_memorymap()` and
`stm32_xspi_abort()` which can finally be useful in various cases.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2025-12-16 10:08:43 -06:00
Mario Paja
ccdf98acd8 drivers: remove on-stack copying of dma cfg on stm32 drivers
This change removes the on-stack copying and instead
uses a pointer to the configuration to  avoid unnecessary
stack usage

Signed-off-by: Mario Paja <mariopaja@hotmail.com>
2025-12-10 10:33:50 +00:00
Marek Matej
5f3f4e7285 drivers: flash: Fix flash host type for CI builds
This fixes the APPCPU synthetic builds.

Signed-off-by: Marek Matej <marek.matej@espressif.com>
2025-12-09 22:38:02 -05:00
Mathieu Choplain
3546e73cda drivers: flash: stm32_ospi: cleanup STM32H5-related quirks
STM32H5 series now uses the dedicated `flash_stm32_xspi` driver instead.
Remove all quirks related to H5 in the STM32 OSPI driver.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2025-12-09 11:13:27 +01:00
Pieter De Gendt
3695b2c0ca shell: Add user data argument to shell_set_bypass
Allow passing some context to the shell bypass callback function by
providing a void pointer user data argument.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-12-08 09:39:05 -05:00
Sreeram Tatapudi
5ecf248ba3 drivers: infineon: Drop cat1 from the files names
Drop cat1 from the file names to enable reuse by other
category devices as well

Signed-off-by: Sreeram Tatapudi <sreeram.praveen@infineon.com>
2025-12-07 21:19:38 -05:00
Camille BAUD
a2a7463ec0 drivers: flash: Introduce BFLB flash controller
Introduce Bouffalolab Flash Controller with support for bank 1

Signed-off-by: Camille BAUD <mail@massdriver.space>
2025-12-02 15:23:13 -05:00
Marek Matej
4c62fee6eb drivers: flash: esp32: flash access supervisor
Add support to access flash from remote CPU cores.

Signed-off-by: Marek Matej <marek.matej@espressif.com>
2025-12-02 16:13:52 +00:00
Sumit Batra
404556e36c drivers: flash: Add MCUX C40 flash controller driver
Add flash controller driver for the on-chip C40 flash controller
The driver is backed by the MCUX C40 HAL and implements
read/erase/program, page layout, and an optional protection policy
that can lock well-known regions (IVT/MCUboot) derived from devicetree.

Key details:
- Selects FLASH_HAS_DRIVER_ENABLED / FLASH_HAS_EXPLICIT_ERASE /
FLASH_HAS_PAGE_LAYOUT.
- Runs erase/program from SRAM when XIP by relocating both the shim and
the MCUX HAL source if CODE_DATA_RELOCATION_SRAM=y.
- Optional protection pass at init (FLASH_MCUX_C40_APPLY_PROTECTION),
which aligns windows to sector boundaries and applies lock/unlock
using the HAL. This is useful on XIP systems to keep IVT/bootloader
ranges read-only; can be disabled if a bootloader or security policy
manages protection instead.

Files:
- drivers/flash/flash_mcux_c40.c (new)
- drivers/flash/CMakeLists.txt (+zephyr_code_relocate when needed,
Compliance fixes)
- drivers/flash/Kconfig.mcux (enable flash driver, reloc & protection)
- modules/hal_nxp/mcux/mcux-sdk-ng/drivers/drivers.cmake

Signed-off-by: Sumit Batra <sumit.batra@nxp.com>
2025-12-02 16:12:51 +00:00
Nikodem Kastelik
ad1e5ac253 nordic: update and align to nrfx 4.0.1
New nrfx release contains major rework of nrfx drivers
instantiation making it easier to integrate with dts nodes.
Now, nrfx driver instances can no longer be `const`
because they contain driver runtime state.
Additionally, all nrfx drivers return `errno` error codes
instead of deprecated `nrfx_err_t`.

Signed-off-by: Nikodem Kastelik <nikodem.kastelik@nordicsemi.no>
2025-11-27 14:45:17 +01:00
Sreeram Tatapudi
a039b94f48 drivers: flash: Infineon: Add QSPI Flash driver for PSE84
Add QSPI Flash driver for PSE84 (based on the serial-memory asset)

Signed-off-by: Sreeram Tatapudi <sreeram.praveen@infineon.com>
2025-11-25 20:23:14 -05:00
Fabrice DJIATSA
56d44d9261 drivers: flash: stm32_h7: invalidate data cache after flash write
STM32H7 platforms now enable cache management by default.
To ensure data coherency after flash writes, invalidate cache
lines to the region written.
This prevents stale data and ensures proper memory visibility.

Signed-off-by: Fabrice DJIATSA <fabrice.djiatsa-ext@st.com>
2025-11-21 12:01:41 +01:00
Fabrice DJIATSA
a788c77a52 drivers: flash: stm32_xspi: extend HAL DMA EX support to STM32N6X
add SOC_SERIES_STM32N6X dependency with USE_STM32_HAL_DMA_EX
to enable building applications that use XSPI with DMA
configuration.

Signed-off-by: Fabrice DJIATSA <fabrice.djiatsa-ext@st.com>
2025-11-20 17:14:21 +00:00
Andrzej Głąbek
68fab5fd2c drivers: flash: nrf_qspi_nor: Fix compilation with QER set to NONE
This is a follow-up to commit d1abe40fb0.

Function `qspi_wait_while_writing()` (and also `qspi_rdsr()` that is
called by it) is now always required for `qspi_erase()`, so it can no
longer be under `#if !IS_EQUAL(INST_0_QER, JESD216_DW15_QER_VAL_NONE)`.

Also definition of `dev_config` in `configure_chip()` needs to be moved,
as for QER set to NONE, it is not used and causes a compilation warning.

Add a test case that will ensure the driver can be built successfully
with `quad-enable-requirements = "NONE"`.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2025-11-19 06:53:20 -05:00
Pieter De Gendt
bb19a9bdb7 drivers: flash: shell: Use timing functions for speed tests
Use the timing functions to increase the accuracy of the flash speed
measurements.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-11-19 06:52:08 -05:00
John Batch
62ca912c47 modules: hal_infineon: DMA cmake lists update
Updates DMA includes from the modules needed for DMA PDL based driver
implementation.
Cleans up cmake to use only USE_INFINEON_DMA Kconfig option to select
dma files from PDL/HAL.

Signed-off-by: John Batch <john.batch@infineon.com>
2025-11-18 17:49:09 -05:00
Josuah Demangeon
1b87ec87ef style: drivers: apply coding style on CMakeLists.txt files
Apply the CMake style guidelines to CMakeList.txt files in drivers/.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2025-11-17 13:48:03 -05:00
Ruijia Wang
d4ae43e25f drivers: xspi: fix device config failure in XIP mode
Add bus idle wait after clock rate query to ensure AHB transactions
complete before device configuration. This prevents XSPI_SetDeviceConfig
from failing due to ongoing AHB access detection in XIP environments.
The issue occurs because clock_control_get_rate() triggers AHB
transactions that complete asynchronously, causings subsequent device
configuration to fail due to its bus status checking.

Signed-off-by: Ruijia Wang <ruijia.wang@nxp.com>
2025-11-14 15:27:26 +02:00
Adam Zotow
40816a81a5 drivers: flash: stm32 qspi: Make delayed data sampling configurable
The QSPI delayed data sampling (SSHIFT) is enabled by default. This
feature is configurable in both XSPI and OSPI drivers. Align with
these drivers and make the feature configurable for QSPI too.

Signed-off-by: Adam Zotow <azo@trackunit.com>
2025-11-14 15:26:31 +02:00
Etienne Carriere
b0ccb2295f drivers: stm32: use STM32_CLOCK_INFO_BY_NAME() and friends
Use STM32_CLOCK_INFO(), STM32_DT_INST_CLOCK_INFO(),
STM32_CLOCK_INFO_BY_NAME() and STM32_DT_INST_CLOCK_INFO_BY_NAME()
helper macros in STM32 drivers.

Using these macros ensure the clock division factor is properly
populated according to DT information. Prior these changes some
drivers only got the bus and bits position information and missed
the clock division information which is fine only when this division
factor information is 0.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2025-11-14 15:26:17 +02:00
Mathieu Choplain
21b2283fc5 drivers: *: stm32: use series-agnostic STM32 LL headers
Use the series-agnostic STM32 LL headers from the STM32Cube HAL module
instead of series-specific ones in STM32 drivers.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2025-11-14 12:19:48 +02:00
Albort Xue
e6efe0f217 drivers: flash: Optimize mcux_flexspi_nor erase for unaligned operations
Improve erase efficiency by using a hybrid approach that combines block
and sector erase operations.
The new implementation:
- Erases unaligned sectors at the start until block-aligned
- Erases whole blocks in the middle protion
- Erases remaining sectors at the end.

Signed-off-by: Albort Xue <yao.xue@nxp.com>
2025-11-13 20:42:39 -05:00
Utsav Munendra
c696414f8f driver: flash_mspi_nor: Allow specific read/write IO modes and frequencies
The driver currently provides no way to use Dual IO Read and Single IO
for the rest of the commands currently, and would erroneously use
Single IO PP command in Dual IO mode. This PR fixes and adds
support for that.

Signed-off-by: Utsav Munendra <utsavm@meta.com>
2025-11-13 20:37:44 -05:00
Utsav Munendra
eae12761e1 drivers: flash_mspi_nor: Remove bool tracking of target IO mode
Remove the Boolean tracking of MSPI IO mode as we can now rely on
tracking the entire dev config applied to the MSPI device, multiple
of which will exist in later commits.

Signed-off-by: Utsav Munendra <utsavm@meta.com>
2025-11-13 20:37:44 -05:00
Utsav Munendra
abd35f88a7 drivers: flash_mspi_nor: Flash control commands to use their own configs
Also in preparation for allowing control command frequency to be
different from the read/write frequency and initialization frequency.

Signed-off-by: Utsav Munendra <utsavm@meta.com>
2025-11-13 20:37:44 -05:00
Utsav Munendra
8bc4a92397 drivers: flash_mspi_nor: Track last applied MSPI config
Instead of just tracking in a bool whether the MSPI device is in
Standard MSPI vs. QPI/OPI config, track the entire MSPI config which was
last applied. This makes it easier later to track more than two configs
to apply based on the next command to transceive.

Signed-off-by: Utsav Munendra <utsavm@meta.com>
2025-11-13 20:37:44 -05:00
Utsav Munendra
41988ae62f drivers: flash_mspi_nor: Simplify perform_xfer function
Remove unnecessary function argument, makes later commits also simpler.

Signed-off-by: Utsav Munendra <utsavm@meta.com>
2025-11-13 20:37:44 -05:00
Daniel DeGrasse
5575d3b238 drivers: flash: flash_mspi_nor: indicate support for flash page layout
Flash MSPI NOR driver already has support for flash page layout, but did
not select the Kconfig symbol indicating so. Add the selection so
drivers can use the page layout api.

Signed-off-by: Daniel DeGrasse <ddegrasse@tenstorrent.com>
2025-11-06 16:28:58 -05:00
Liam Ogletree
9b4cc182ae drivers: flash: Fix devicetree API typo in AT25XV021A flash driver
Fix typos in the driver instantiation macro, which leads to page_size
and timeout_erase defaulting to 0 regardless of whether the
devicetree instance has the read-only property or not.

DT_INST_NODE_PROP_OR() -> DT_INST_PROP_OR()

Signed-off-by: Liam Ogletree <liam.ogletree@cirrus.com>
2025-11-05 15:37:04 -05:00
Allen Zhang
82f419de74 drivers: flash: Fixed the typo in clear_flash_caches
elif should be else

Signed-off-by: Allen Zhang <chunfeng.zhang@nxp.com>
2025-10-30 11:54:03 -04:00
Allen Zhang
86b346e097 drivers: flash: Added clear_flash_caches function for MCXW2XX
MCXW2XX ROMAPI provide the function FLASH_CacheClear to clear the cache.
The SMSCM is not supported on MCXW2XX platform.

Signed-off-by: Allen Zhang <chunfeng.zhang@nxp.com>
2025-10-30 15:15:35 +02:00
Khoa Nguyen
bde6bdd168 drivers: flash: Fix Kconfig style for Renesas RA Flash-HP Kconfig
Fix Kconfig style for Renesas RA Flash-HP Kconfig

Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
2025-10-28 11:48:44 +02:00
Guillaume Gautier
004c613e25 drivers: stm32: replace MODIFY_REG HAL macro by stm32_reg_modify_bits
For all STM32 drivers and SoC, replace the MODIFY_REG macro (defined in
the STM32 HAL) by stm32_reg_modify_bits defined in Zephyr.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-10-24 08:58:25 -07:00
Guillaume Gautier
44415b5af8 drivers: stm32: replace READ_BIT HAL macro by stm32_reg_read_bits
For all STM32 drivers and SoC, replace the READ_BIT macro (defined in
the STM32 HAL) by stm32_reg_read_bits.
Fixes some cases where the return value was tested like a boolean
despite not being one.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-10-24 08:58:25 -07:00
Ruijia Wang
e8bb85ee69 drivers: xspi: add NXP xspi driver
Add mcux xspi driver suppport. Add the flash and psram driver support
based on xspi driver.

Signed-off-by: Ruijia Wang <ruijia.wang@nxp.com>
2025-10-24 08:56:59 -07:00
Khoa Nguyen
7d438adcf7 drivers: flash: Initial support Flash-LP driver for Renesas RA
Initial support Flash-LP driver for Renesas RA

Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
Signed-off-by: Phi Tran <phi.tran.jg@bp.renesas.com>
2025-10-24 11:31:43 +02:00
Dawid Niedzwiecki
283365a496 drivers: flash: andes_xip: update include
Include a new andes_csr.h file instead of soc_v5.h.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2025-10-23 15:59:11 -04:00
Fabin V Martin
0bd56429d3 drivers: flash: microchip: add flash g1 driver
Add flash driver for Microchip NVMCTRL g1

Signed-off-by: Fabin V Martin <Fabinv.Martin@microchip.com>
2025-10-23 17:50:29 +02:00
Aksel Skauge Mellbye
440755bd9e soc: silabs: Move Kconfig symbols for HAL selection to HAL
The Kconfig symbols for selecting HAL content should be part
of the HAL module integration, not defined by the SoC. Split the
symbols between the Series 0/1 Gecko HAL and Series 2 SiSDK HAL
when moving them.

For now, the Series 0/1 HAL symbols retain their name, while new
names consistent with the symbols already defined in the module
integration layer are used for the Series 2 HAL.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2025-10-22 09:03:15 +02:00
Tien Nguyen
5341c88365 driver: flash: Add a macro to define the 32KB block size in spi_nor.h
Add a macro to define the 32KB block size in spi_nor.h

Signed-off-by: Tien Nguyen <tien.nguyen.zg@renesas.com>
2025-10-22 08:55:53 +02:00
Tien Nguyen
8359c4dbd9 driver: flash: initial support for Renesas RZ/A3UL, T2M, N2L
This driver is based on the XSPI driver for Renesas RZ/T2M and N2L,
and the SPIBSC driver for Renesas RZ/A3UL from the HAL.

Signed-off-by: Tien Nguyen <tien.nguyen.zg@renesas.com>
2025-10-22 08:55:53 +02:00
Marek Matej
45c9babce6 drivers: flash: esp32: Add asynchronous flash access using work queue
Direct flash access can cause exceptions when performed while the flash
memory is inaccessible or being modified — for example, when code is
executing from PSRAM. To avoid such invalid access, this change introduces
asynchronous flash operations that are executed from a safe runtime context
via a work queue. This ensures all flash accesses occur only when the flash
is valid and accessible.

Signed-off-by: Marek Matej <marek.matej@espressif.com>
2025-10-21 17:24:55 +03:00
Etienne Carriere
0e39d34998 drivers: flash: stm32: test HAL functions return value
Add missing test of some HAL fnuctions return value.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2025-10-21 14:15:59 +03:00
Ben Marsh
ce08f16a05 drivers: flash: stm32_{q|o|x}spi: Fix write unprotect logs
The STM32 QSPI, OSPI, and XSPI drivers support sending the ULBPR command
for flash ICs that require unlocking before writing to. This is done
conditionally based on the requires_ulbpr devicetree property.

Previously the driver would always log "Write Un-protected", even if a
write un-protect was not attempted. Fix this so that "Write Un-protected"
is only logged when a write un-protect is attempted and succeeds.

Signed-off-by: Ben Marsh <ben.marsh@helvar.com>
2025-10-21 14:14:48 +03:00
Gerard Marull-Paretas
f9cca217c3 drivers: flash: sf32lb_mpi_qspi_nor: add initial driver
Initial driver for the SF32LB MPI accessing QSPI NOR flash devices.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2025-10-20 14:23:43 -04:00
Gerard Marull-Paretas
ddc5810888 drivers: flash: spi_nor: add SPI_NOR_CMD_BE_32K_4B
Command was missing.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2025-10-20 14:23:43 -04:00
Tim Lin
0ea524e0ae drivers: flash: ite: Add ex_op support for flash target and address mode
Extend the IT51XXX M1K flash controller driver to implement the flash
extended operation (ex_op) API. This allows runtime selection of both
the flash device and the addressing mode:

Flash target selection:
- FLASH_IT51XXX_INTERNAL: on-chip SPI eFlash
- FLASH_IT51XXX_EXTERNAL_FSPI_CS0: external SPI flash on FSCE0#
- FLASH_IT51XXX_EXTERNAL_FSPI_CS1: external SPI flash on FSCE1#

Addressing mode selection:
- FLASH_IT51XXX_ADDR_3B: 3-byte (24-bit) addressing mode, supports
  flash devices up to 16MB capacity
- FLASH_IT51XXX_ADDR_4B: 4-byte (32-bit) addressing mode, required
  for devices larger than 16MB

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2025-10-20 11:23:25 -04:00