Commit graph

1,525 commits

Author SHA1 Message Date
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
Andrzej Głąbek
835d77389c drivers: flash_mspi_nor: Add support for "supply-gpios" property
Add support for supplying power to the flash chip by activation of
a GPIO specified through the "supply-gpios" property. Implementation
of gpio_reset() is also slightly modified so that it is consistent
with soft_reset() and the new power_supply() and so that all these
functions can use a common routine that performs a reset recovery
delay.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2025-09-10 13:02:01 +02:00
Andrzej Głąbek
c2b537fb6c drivers: flash_mspi_nor: Remove undesirable initial Quad disabling
Using a GPIO reset for a flash chip that has a dual function pin
(RESET# or SIO3) and is to be used in Quad mode is rather a bad idea
and so is clearing of the Quad Enable bit at every initialization
of the flash driver, since this bit is usually non-volatile, so such
operation means unnecessary wearing of the flash chip. Soft Reset
should be use instead in such case.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2025-09-10 13:02:01 +02:00
Andrzej Głąbek
ff13d4062f drivers: flash_mspi_nor: Add Soft Reset
Add implementation of the most common Soft Reset routine (sequence of
reset enable instruction 0x66 and reset instruction 0x99).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2025-09-10 13:02:01 +02:00
Andrzej Głąbek
2fcb2158ae drivers: flash_mspi_nor: Complete handling of QER, add handling of OER
Complete implementation of quad_enable_set() by adding support for all
possible Quad Enable Requirements (QER) as specified by the SFDP JEDEC
standard (JESD216). Add also corresponding octal_enable_set() to handle
Octal Enable Requirements.

Also remove initial waiting from mxicy_mx25r_post_switch_mode() which
became unneeded, as now such waiting is done in cmd_wrsr() which is
called at the end of quad_enable_set().

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2025-09-10 13:02:01 +02:00
Andrzej Głąbek
cafa288197 drivers: flash_mspi_nor: Refactor handling of commands
- Use standard operation codes and parameters from SFDP for handling
  the used flash commands (allow to override some of them through dts
  with the `read-command`, `write-command`, and `rx-dummy` properties)
- Use all available erase types as specified by SFDP
- Allow using all IO modes
- Add support for switching to 4-byte addressing mode
- Use common functions for reading and writing of status registers
  and for enabling write operations
- Switch IO mode (between the target one and Single IO) in a common
  function that performs transfers and do it only when required for
  a given command
- Make checking of JEDEC ID at initialization optional

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2025-09-10 13:02:01 +02:00
Andrzej Głąbek
29bc5bf12c drivers: flash_mspi_nor: Get info from dts SFDP arrays
Get parameters for used flash commands and requirements for enabling
Quad and Octal modes from dts uint8-arrays containing data read from
SFDP tables for particular flash chips.
Also introduce `pre_init` quirk that allows alteration of the above
parameters or complementation of them in a specific way for particular
flash chip families.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2025-09-10 13:02:01 +02:00
Jordan Yates
455d948ed6 flash: nrf_qspi_nor: active dwell time
Asynchronously release the device after a small delay to minimise power
state transitions under multiple sequential API calls (e.g. NVS).

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-09-09 20:41:31 -04:00
Utsav Munendra
19988acd90 drivers: flash_mspi: Implement flash API get_size
Implement the Zephyr Flash Driver API for completeness.

Signed-off-by: Utsav Munendra <utsavm@meta.com>
2025-09-08 09:50:20 +02:00
Taras Zaporozhets
993b642f2e drivers: flash: sam0: Fix incorrect page write size
According to the datasheet, one page is made of 64 bytes
and one row is made of 4 pages, that is 256 bytes.
This MR fixes the incorrect page write size for sam0
and sets it to 64 bytes.

Signed-off-by: Taras Zaporozhets <zaporozhets.taras@gmail.com>
2025-09-06 10:35:25 +02:00
Tri Nguyen
1e25973c75 drivers: flash: Initial support QSPI Flash driver for Renesas RA6
Add QSPI Flash driver supports for Renesas RA6.

Signed-off-by: Tri Nguyen <tri.nguyen.wj@bp.renesas.com>
Signed-off-by: Thao Luong <thao.luong.uw@renesas.com>
Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
2025-09-05 12:26:44 +02:00
Diego Herranz
f1e72c4a75 drivers: flash: shell: fix KiB symbol spelling
It's Bytes rather than bits, and it's also Kibi (1024).

Signed-off-by: Diego Herranz <diegoherranz@diegoherranz.com>
2025-09-04 21:04:22 +02:00
Carles Cufi
267469b503 flash: spi_nor: Fix VLA error when building with clang
The following error is issued by clang when building with
SPI_NOR_SFDP_RUNTIME enabled:

error: fields must have a constant size:
'variable length array in structure' extension will never be supported
1379 | uint32_t dw[MIN(php->len_dw, 20)];

Instead, hardcode the array length to 20 32-bit words (it's instantiated
in the stack anyway).

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2025-09-03 21:21:27 +02:00
Erwan Gouriou
47de4d1d9e drivers: stm32: Make use of new GET_INSTANCE DMA macro
Use the new macro and factorize code when possible.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2025-09-03 11:03:31 +02:00
Erwan Gouriou
67d2281ffe drivers: stm32: Keep DMA stream offset handling internal to driver
In HAL based stm32 drivers, dma handling is done internally to HAL.
Though, in order to avoid a dma_config() call is done to ensure stream
will be set as busy in zephyr dma driver to avoid potential resource
sharing conflict.
This dma_config() call was done while taking into account
STM32_DMA_STREAM_OFFSET, which is wrong as it will prevent zephyr dma
driver to set the right stream as busy.
Fix this in impacted drivers.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2025-09-03 11:03:31 +02:00
Liam Ogletree
97752191f4 drivers: flash: Add support for Atmel AT25 SPI flash variant
The AT25XV021A variant is a flash variant of Atmel's AT25 family
that adds extra protections, requiring additional writes to the
device to program or erase data.

This commit adds a flash driver for AT25XV021A devices instead of
modifying (1) the existing AT45 SPI flash driver or (2) the
existing AT24/25 EEPROM driver because this variant poses
fundamental changes that affect all aspects of the driver.

Notably,
 - AT25XV021A includes a second status register, and the format
	and functions of the existing status register is
	changed from the existing drivers.
 - AT25XV021A requires executing page or chip erase commands
	before writing, making it incompatible with the
	existing AT24/25 EEPROM driver.
 - AT25XV021A adds a software protection layer that requires
	extra writes before executing program or erase commands.

Tested writing to and erasing from an AT25XV021A device. Tested
reading from an AT25XV021A device across page boundaries. Tested
chip erase function. Tested driver initialization from varying
initial hardware states.

Signed-off-by: Liam Ogletree <liam.ogletree@cirrus.com>
2025-09-02 21:40:07 +02:00
Erwan Gouriou
c7086c7e67 drivers: flash_stm32_xspi: Fix Dummy Cycles on MX66UM1G45G NOR at 200MHz
This commit is fixing configuration of mx66uw1g45g NOR when working
at 200MHz.
According to its specification, when running at 200MHz, this memory should
use a Number Dummy Cycles configuration of 20 (DC bits in CFGR2), which is
the device's default configuration.
Applying the 66MHz configuration as done today was preventing flash to run
at frequency higher than 100Mhz.

This commit doesn't solve the more generic problem of this driver which
is applying this 66MHz configuration universally, irrespective of the
frequency and the memory device, but fixes the configuration which was
reported broken today.

Providing a global change would require starting a clear split between XSPI
controller configuration an bus device configuration, which is what new
MSPI API intend to solve, so this will be tackled once this driver will be
available.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2025-09-02 15:54:56 +02:00
Francois Ramu
e5620e07c9 drivers: flash: stm32 xspi flash read with memcopy when executing
When the application is executed in external flash, the read operation
cannot be in indirect mode but with memcopy.
Note that writing or erasing the external flash being executed
is not possible during the execution.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2025-09-02 11:09:29 +02:00
Pieter De Gendt
8993a5ed10 drivers: flash: shell: Fix printing partitions without labels
Commit df0f74d491c851b3e7e970f898c5c2fc3aab5b80 added a shell command to be
able to print out the partitions. However the label property is optional.

Print both the name and label if available.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-09-01 23:27:28 +02:00