Commit graph

1,343 commits

Author SHA1 Message Date
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
Martin Hoff
ba1d267c62 soc: silabs: siwx91x: transform nwp soc files into a driver
The goal of this patch is to switch from the nwp.c and nwp.h soc files
to the new nwp driver. During this transition, we also renamed
CONFIG_WISECONNECT_NETWORK_STACK to CONFIG_SILABS_SIWX91X_NWP which are
a better naming to let the user knows that the network coprocessor files
will be added to the compilation.

The switch from a soc file to a driver device introduce a notion of nwp
device that allows us to check for good initialization and ressources
allocation.

Before this patch, it is not possible to know if the nwp have booted
successfully or not. We can now check if the device driver is ready
or not before trying to do operation related to the nwp.

Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
2025-10-17 11:17:30 +02:00
Ben Marsh
bb8e8e9c91 drivers: flash: stm32_{o|x}spi: Add Microchip-specific special case
Commit 76740ae added a special case to the STM32 QSPI driver to support
Microchip QSPI flash ICs, such as the SST26VF series,
which use the PP_1_1_4 opcode in PP_1_4_4 mode.

This commit adds the same special case to the STM32 OSPI and XSPI drivers.

Signed-off-by: Ben Marsh <ben.marsh@helvar.com>
2025-10-16 17:12:06 +03:00
Ben Marsh
633e9c75a2 drivers: flash: stm32_{o|x}spi: Add ULBPR support
Commits 72370b2 and ff34d57 added the requires-ulbpr
(Unlock Block Protection Register) property to the devicetree binding
for devices controlled by the STM32 QSPI peripheral, and support for
this property to the STM32 QSPI driver.
Some QSPI flash ICs (e.g. Microchip SST26VF series) require this
command to be sent before writing/erasing is possible.

This commit adds the same support to the STM32 OSPI and XSPI drivers.

Signed-off-by: Ben Marsh <ben.marsh@helvar.com>
2025-10-16 17:12:06 +03:00
Khoa Nguyen
cf66b0cb65 drivers: flash: Add support Renesas MRAM driver
Add support Renesas MRAM driver for RA devices

Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
2025-10-15 11:47:07 -04:00
Andrzej Głąbek
c3469a6764 drivers: flash_mspi_nor: Take into account MSPI controller packet limit
Use information provided in the dts node for the MSPI controller
regarding maximum amount of data that can be transferred in one
packet and split the requested transfers if necessary.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2025-10-15 15:37:40 +03:00
Pieter De Gendt
6728e78576 Revert "shell: Add user data argument to shell_set_bypass"
Revert a change that broke the stable API function shell_set_bypass.
This reverts commit 6b876dba1ba61b659b1b2d4c3ccd0ac41bd56027.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-10-13 18:12:42 -04:00
Ben Marsh
2a0fb72c6a drivers: flash: stm32_qspi: Fix special behaviour for Microchip QSPIs
Commit 539928d introduced a special behaviour for Microchip QSPI flash
memories into the STM32 QSPI flash driver, to handle the fact that these
memories use the PP_1_1_4 opcode (32H) for the PP_1_4_4 operation
(usually 38H).

The special Microchip-specific behaviour introduced in that commit sets
the address mode for a QSPI 1-1-4 write operation to 4 address lines,
rather than 1 address line, when the write command is configured as
SPI_NOR_CMD_PP_1_1_4. If the write command is configured as
SPI_NOR_CMD_PP_1_4_4, nothing is done and the operation will not succeed.

This behaviour is a bit backwards, as it results in a QSPI flash memory
configured in 1-1-4 write mode using 4 address lines (1-4-4 operation).
It should be the other way round, so that a QSPI flash memory configured
in 1-4-4 mode uses 4 address lines (1-4-4 operation).

This commit changes the Microchip-specific special behaviour to set the
opcode for the specified write mode, rather than using a different write
mode to that which is configured in order to use a valid opcode. This
means that a QSPI flash memory configured in 1-4-4 mode, or without the
writeoc DT property set (defaults to 1-4-4 for quad mode), will operate
in 1-4-4 mode. 1-1-4 mode is unsupported, as before.

Also update the Kconfig option description for
CONFIG_USE_MICROCHIP_QSPI_FLASH_WITH_STM32 to remove references to the
Global Block Protection Unlock instruction - this was added at the same
time as the Microchip-specific special behaviour for the 1-1-4 / 1-4-4
opcode but is distinct from this and is not affected by
CONFIG_USE_MICROCHIP_QSPI_FLASH_WITH_STM32.

Signed-off-by: Ben Marsh <ben.marsh@helvar.com>
2025-10-13 09:37:21 -04:00
Dawid Niedzwiecki
406675da24 drivers: flash: andes_xip: rename define
Rename the PAGE_SIZE to avoid conflicts.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2025-10-10 20:49:55 -04:00
Pieter De Gendt
4fa4329a16 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-10-10 12:53:55 -04:00
Andre Heinemans
8760db3016 drivers: flash: flexspi_mx25um51345g: fix erase chip lut entry
The DDR LUT entry for ERASE_CHIP was configured with an incorrect
kFLEXSPI_Command, resulting in the erase operation not being executed.

Signed-off-by: Andre Heinemans <andre.heinemans@nxp.com>
2025-10-08 12:04:52 +02:00
Andre Heinemans
6a714d55d9 drivers: flash: flexspi_mx25um51345g: get max speed from dts
The maximum speed should be configured individually for each board
since it depends on the layout and the controller's flexspi capabilities.

Signed-off-by: Andre Heinemans <andre.heinemans@nxp.com>
2025-10-08 12:04:52 +02:00
Andre Heinemans
e774d82cbe drivers: flash: flexspi_mx25um51345g: fix DDR dummy cycles
In the DDR LUT, the dummy cycles were not defined for READ_STATUS_REG
and had a wrong value for READ.
The default amount of dummy cycles on this chip are 20 (0x14).
This means the LUT should contain the value of 0x28 (0x14*2) for DDR
at these entries.

Signed-off-by: Andre Heinemans <andre.heinemans@nxp.com>
2025-10-08 12:04:52 +02:00
Martin Jäger
866dff0eb0 drivers: flash: stm32g0: Implement set|get_rdp_level API
Allows to set readout protection bits for this series at runtime.

Signed-off-by: Martin Jäger <martin@libre.solar>
2025-10-07 22:56:52 -04:00
Martin Jäger
faf661e907 drivers: flash: stm32g0: Implement option_bytes_write|read API
Implementation based on STM32G4 series.

This is a preparation to enable reading and writing the RDP bits.

Signed-off-by: Martin Jäger <martin@libre.solar>
2025-10-07 22:56:52 -04:00
Alvis Sun
6664958107 drivers: flash: npcx: support GDMA operation for NPCXn and NPCKn
1. Introduced GDMA support for efficient data transfer in the
NPCX FIU QSPI driver.
2. Refactor flash driver mutex handling to enhance concurrency safety,
preventing other threads from preempting erase/write operations during
UMA until mutex release.

Signed-off-by: Alvis Sun <yfsun@nuvoton.com>
Signed-off-by: Tom Chang <CHChang19@nuvoton.com>
Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2025-10-03 12:51:55 +03:00
Alberto Escolar Piedras
e5d6e0ce24 drivers flash_simulator_native: Set flash file to close on exec
If the process does an exec() (or fork, or..) all descriptors are kept
open by default, unless O_CLOEXEC is set when opening them.
This is usefull for stdin/out/err so that new process is connected to
them, but it is very rare for it to be usefull for any other descriptor.

In general this leads to descriptors being kept open unnecessarily,
which either will block other process from getting them (for example
if the child survives the parent but it does something else).
Or for a "leak" which unnecessarily uses descriptors and memory in the
child process.

Let's ensure we do not leak it for this component as we do not need it.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-10-02 22:00:02 +02:00
Declan Snyder
570b445a61 drivers: Convert to use SPI macro without delay parameters
Convert all drivers and other consumers to use SPI macros without the
delay parameters.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-10-01 14:39:36 +03:00
Andrzej Głąbek
828bde8213 drivers: flash_mspi_nor: Add support for CONFIG_MULTITHREADING=n
Add possibility to use the driver in configurations with disabled
multithreading. It may be useful in bootloaders, for example.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2025-09-26 13:23:34 +02:00
Fin Maaß
48e5cda802 drivers: flash: spi_nor: use DEV_CFG in spi_nor_write_protection_set
use DEV_CFG in spi_nor_write_protection_set

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-09-23 12:06:02 -04:00
Fin Maaß
e9ed34fbbc drivers: flash: spi_nor: simplify checks for write_protect
simplify checks for write_protect

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-09-23 12:06:02 -04:00
Fin Maaß
f08f63c93a drivers: flash: spi_nor: allow ulbpr be optimized away
allow the requirement for ulbpr be optimized away
by the compiler, if no instance uses it.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-09-23 12:06:02 -04:00
Fin Maaß
43db13d11f drivers: flash: spi_nor: remove redundant write enable/disable
write enable already happens in the write/erase loop
before every write and erase. It is done in the loop,
because it is self cleaning after erase and write.
That is also the reason we don't need to disable it,
as it is automatically disabled after each write and erase.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-09-23 12:06:02 -04:00
Amneesh Singh
8953f0b086 drivers: flash: jesd216: improve mode support checks
The only information for 4s-4d-4d, 8s-8s-8s and 8d-8d-8d in the basic flash
parameter table is in DWORD20 with one byte for each of the aforementioned
modes. This one byte is split into two fields that contain that mode's
maximum operation speed with and without data strobe. Unsupported fields
have the value of 0xF. For the mode to be supported, at least one of the
two fields must not be 0xF, so we check the byte against 0xFF.

Signed-off-by: Amneesh Singh <a-singh7@ti.com>
2025-09-23 12:02:06 -04:00
Almir Okato
786c9fb35e flash: espressif: erase region before writing if encryption enabled
Ensuring flash region has been erased before writing to avoid
inconsistences and force expected erased value (0xFF) into
flash when erasing a region when Hardware Flash Encryption is
enabled
This is handled on this implementation because MCUboot's state
machine relies on erased valued data (0xFF) readed from a
previously erased region that was not written yet, however when
hardware flash encryption is enabled, the flash read always
decrypts whats being read from flash, thus a region that was
erased would not be read as what MCUboot expected (0xFF).

Signed-off-by: Almir Okato <almir.okato@espressif.com>
2025-09-19 17:57:07 -04:00
Albort Xue
7b561f7605 drivers: flash: flash_mcux_flexspi_nor: Adjust bit field check sequence.
Adjust the bit field check sequence for "en4b" to support some flash
devices that offer multiple mechanisms for entering 4-byte address
mode.

Signed-off-by: Albort Xue <yao.xue@nxp.com>
2025-09-18 13:51:28 -04:00
Swift Tian
4432b6d0b0 drivers: flash: mspi: fix compile warning in is25 driver
Fix warning when no cache handling enabled.

Signed-off-by: Swift Tian <swift.tian@ambiq.com>
2025-09-17 11:16:09 +01:00
Riadh Ghaddab
a4f5d9fb31 drivers: flash: nrf_rram: add support for RRAM throttling
Some applications need to throttle RRAM writes to handle peak current
management.
Add CONFIG_NRF_RRAM_THROTTLING_DATA_BLOCK which defines the maximum
chunk length that can be written at once.
Add CONFIG_NRF_RRAM_THROTTLING_DELAY which configures the sleep delay in
microseconds after each write.

Signed-off-by: Riadh Ghaddab <riadh.ghaddab@nordicsemi.no>
2025-09-12 18:32:23 +02:00
Andre Heinemans
45abb7215c drivers: nxp: flash_mcux_flexspi: fix id check on octal spi
The jedec-id cannot be read after flash device is set to octal mode.
Fixed by moving the jedec-id comparison to
flash_flexspi_nor_check_jedec() which already reads the jedec-id when
flash device is still in single spi mode.

Signed-off-by: Andre Heinemans <andre.heinemans@nxp.com>
2025-09-12 18:30:44 +02:00
Andre Heinemans
7a2ba69a54 drivers: flash_mcux_flexspi_nor: take write-block-size from dts
Some devices supported by this driver do not have a write-block-size
of 1 such as the mt35xu01gbba. This value is assigned in the dts and can
be used instead.

Signed-off-by: Andre Heinemans <andre.heinemans@nxp.com>
2025-09-11 18:08:09 +01:00
Etienne Carriere
694eaf43b1 drivers: flash: restore stm32 xspi mutex on memory mapping
Fix stm32 XSPI driver to restore the bus command concurrent access
protection that was mistakenly removed on memory mapping operation
by commit e5620e07c9 ("drivers: flash: stm32 xspi flash read with
memcopy when executing").

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2025-09-11 09:53:36 +02:00
Andrzej Głąbek
9223235a49 drivers: flash_mspi_nor: Fix XIP_DEV_CFG_MASK definition
This is a follow-up to commit cafa288197.

Bit masks should use the bitwise OR operator, not the logical one...

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2025-09-10 22:37:04 -04:00
Andrzej Głąbek
77f00f06bb drivers: flash_mspi_nor: Add support for DDR in mx25u family
When Octal IO mode is to be used with DDR in mx25u family chips,
bit 1 instead of 0 must be set in the Configuration Register 2 at
address 0.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2025-09-10 13:02:01 +02:00