Commit graph zephyr/drivers/flash
Author SHA1 Message Date
Mateo Ivankovic
5593912fcb drives: flash: fix hard fault for MX25U12832FM2I02
Add JDEC case for Macronix MX25U12832FM2I02 to skip SFDP auto-parsing.
This forces 24-bit addressing instead of 32-bit addressing.
32-bit addressing resulted in hard faults where to board was not able
to start normally.
Tested on: phyCORE-RT1170

Signed-off-by: Mateo Ivankovic <mateo.ivankovic@inovex.de>
2026-10-28 22:52:04 -04:00
Yuho Choi
ccd34294d5 drivers: flash: flexspi_mx25um51345g: check DTR alignment before irq_lock
When running XIP, flash_flexspi_nor_write() locks interrupts before
programming the flash. In OPI DTR mode, which is the default, the
check for an even offset and length runs after irq_lock() and returns
-EINVAL without calling irq_unlock(). A single misaligned flash_write()
call therefore leaves interrupts disabled and hangs the system.

Do the alignment check before entering the critical section. While
moving it, fix the comment, which called the offset "write size", and
compare the masked values explicitly.

The check was added after irq_lock() in
commit daf6de7b99 ("drivers: flash: flexspi_mx25um513: enforce write
size limit in DTR mode").

Build-tested for mimxrt595_evk/mimxrt595s/cm33 with the default OPI DTR
mode; not tested on hardware.

Signed-off-by: Yuho Choi <oss.patchbox@gmail.com>
2026-10-28 22:50:22 -04:00
Jamie McCrae
db75409003 drivers: flash: Fix misplaced bleeding Kconfig option
Fixes a Kconfig appearing outside of the flash menu and even being
selectable when the flash Kconfig was not enabled

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-10-28 22:47:19 -04:00
Julien Racki
d7137bf4da drivers: flash: stm32: ospi: enter 4-byte mode after reading SFDP
The switch to 4-byte address mode was done while parsing the BFP, so the
remaining SFDP tables were read in 4-byte mode with a 3-byte address.
Enter 4-byte mode once all the tables have been read, and fail init if
the switch fails.

Signed-off-by: Julien Racki <julien.racki-ext@st.com>
2026-10-28 22:41:12 -04:00
Julien Racki
84073806f2 drivers: flash: stm32: ospi: use 4-byte erase opcodes in SPI mode
With four-byte-opcodes set, only the read and program opcodes were
converted. The SFDP erase opcodes (0x20, 0x52, 0xD8) were sent with a
32-bit address while the flash was in 3-byte mode, so the erase did not
execute. Convert them to 0x21, 0x5C and 0xDC too.

Signed-off-by: Julien Racki <julien.racki-ext@st.com>
2026-10-28 22:41:12 -04:00
Leo Li
5d06bbeb37 drivers: flash: spi_nor: avoid sleeping while resuming from DPD
System-managed PM resume leaves deep power-down from the idle
thread while wake interrupts are still masked. k_sleep() cannot
elapse there: it needs the system timer interrupt and must not
suspend the idle thread.

Keep the millisecond delay, but busy-wait when the caller cannot
yield. Initialization and other thread contexts still sleep.

Signed-off-by: Leo Li <leo.li@rakwireless.com>
2026-10-28 22:41:07 -04:00
Jaro Van Landschoot
84f6bea5a0 drivers: flash: flexspi_mx25um51345g: handle flash already in octal mode
The boot ROM can leave the flash in octal mode. Read the ID in octal
mode first and only send the SPI sequence that enables octal mode when
the flash does not answer with the Macronix manufacturer ID.

READ_ID_OPI was always the DTR sequence, which does not work in STR
mode. Add an STR sequence, selected like the other octal commands.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Jaro Van Landschoot <jaro.vanlandschoot@basalte.be>
2026-10-28 22:34:24 -04:00
Andrzej Głąbek
97b007ba6e drivers: flash_mspi_nor: Add option of runtime SFDP processing
Add an option of reading the SFDP data from flash chips and processing
it at runtime instead of requiring it to be provided in dts arrays.
Selection of the MSPI NOR flash instances for which the runtime SFDP
processing should be performed is done by setting the `use-runtime-sfdp`
property in their devicetree nodes.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2026-10-28 22:34:08 -04:00
Andrzej Głąbek
ff2cf7b5bd drivers: flash_mspi_nor: Fix misspelled Kconfig option name
MSPI_NOR_FLASH_LAYOUT_PAGE_SIZE -> FLASH_MSPI_NOR_LAYOUT_PAGE_SIZE

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2026-10-28 22:34:08 -04:00
Andrzej Głąbek
20736f9345 drivers: flash: jesd216: Extend JESD216_SFDP_4B_ADDR_DW bit definitions
Add more symbols for bits of the 1st DWORD of the 4-Byte Address
Instruction Table.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2026-10-28 22:34:08 -04:00
Andrzej Głąbek
67624fd022 drivers: flash_mspi_nor_sfdp: Take into account read/write IO modes
This is a follow up to commit c696414f8f.

When specific IO modes are configured in dts for read and/or write
operations, they should be used, instead of the `mspi-io-mode` value,
also in macros that prepare the default content for the command info
structure.

On this occassion, the used data rate enumeration values are corrected.
For example for the 1S-8D-8D mode now `MSPI_DATA_RATE_S_D_D` is used
instead of incorrect `MSPI_DATA_RATE_DUAL`.

Finally, as commit 8dd7b20f84 introduced
definitions for octal page program commands, those are also applied.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2026-10-28 22:34:08 -04:00
James Smith
a3d614e21e drivers: flash: rpi_pico: make the IRQ lock optional
Add FLASH_RPI_PICO_LOCK_IRQS, on by default under XIP, which locks
interrupts around the pico-sdk write and erase calls only when it is
set. An application linked to run entirely from RAM has no interrupt
handler executing from flash, so the IRQ lock blocks all interrupts for
the entire write/erase operation unnecessarily.

The IRQ lock was the driver's only mutual exclusion, so this change also
takes a semaphore in read, write and erase to allow only one flash
operation at a time. The semaphore compiles out under
CONFIG_MULTITHREADING=n.

Tested with an XIP app and an in-RAM app, and with CONFIG_MULTITHREADING
on and off.

Signed-off-by: James Smith <james@loopj.com>
2026-10-28 22:32:28 -04:00
James Smith
26bb93fba5 drivers: flash: rpi_pico: take flash geometry from devicetree
FLASH_SIZE and the read base come from CONFIG_FLASH_SIZE and
CONFIG_FLASH_BASE_ADDRESS, which arch/Kconfig defaults to 0 when XIP is
disabled. An application linked to run entirely from RAM therefore
reports a zero-sized flash, and rejects every read/write/erase.
RP2350 can already be linked this way.

This commit takes those values from the controller's soc-nv-flash node
in the devicetree instead. Values are unchanged under XIP.

Signed-off-by: James Smith <james@loopj.com>
2026-10-28 22:32:28 -04:00
Jędrzej Ciupis
c99d17a9df drivers: flash: stm32: align flash_ex_op retval for RDP
The current STM32 flash driver extended operations implementation does
not comply with the API documentation and returns non-zero values on
success. Align the RDP update function to return negative error code
on failure and 0 on success, following flash_ex_op() documentation.

Signed-off-by: Jędrzej Ciupis <jciupis@google.com>
2026-10-20 17:26:27 +02:00
Jason Yu
b94f991283 drivers: flash: mcux: fix ambiguous SOC_NV_FLASH_NODE lookup
The previous DT_CHILD(DT_DRV_INST(0), flash_0) requires every
flash controller to have its soc-nv-flash child at unit address 0.
Controllers whose flash child uses a different unit address (e.g.
flash@10000000 on kv5x) need DTS changes to satisfy this constraint.

Use COND_CODE_1 with DT_NODE_EXISTS to try DT_CHILD first; when
flash@0 does not exist, fall back to SOC_NV_FLASH_CHILD_NODE which
iterates status-okay children filtered by the soc-nv-flash
compatible.  This handles both multi-child controllers such as
mcxw70 (where flash@0 exists alongside flw@800000) and single-child
controllers with a non-zero unit address.

Fixes: #121282

Signed-off-by: Jason Yu <zejiang.yu@nxp.com>
2026-10-16 13:17:27 +02:00
Alessandro Manganaro
0cd58aaf29 drivers: flash: stm32wba_fm: Restore POST_KERNEL initialization
In case of BLE usage, flash driver initialization requires kernel
services to setup workqueue resources hence it must be executed
after kernel is alive.

OTP_STM32_NVM_PROGRAMMING_SUPPORT is disabled for STM32WBAX series
since it currently requires the flash driver to be initialized at
PRE_KENREL_1 initcall level.

Fixes: #120988

Signed-off-by: Alessandro Manganaro <alessandro.manganaro@st.com>
2026-10-15 14:27:44 +02:00
Camille BAUD
c703220307 drivers: flash: bflb: Fix various bugs
BL616CL limits were flipped
Robustness against libc/libgcc call in XIP
Fix one busy bit mode
IRQ lock when change offset
JEDEC ID algorithm

Signed-off-by: Camille BAUD <mail@massdriver.space>
2026-10-15 00:48:09 +02:00
David Jewsbury
34762e702e drivers: flash: nrf_mramc: fix normal mode writes by erasing before
Normal write mode corrupts a word that isn't erased first, even if
the write only clears bits. Erase non-erased words with the hardware
erase before writing. One ERASEWORD write erases the whole 16 byte
word.

Non-secure builds can't reach the MRAMC erase, so they write in
direct write mode instead.

Signed-off-by: David Jewsbury <david.jewsbury@nordicsemi.no>
2026-10-15 00:40:56 +02:00
Arun Padakanti
ecd593049f drivers: flash: silabs: implement get_size for SiWx91x
Wire the flash driver get_size callback for the SiWx91x SoC flash
driver. The value is cfg->size from devicetree, matching the bounds
used for read, write, and erase and consistent with other Silicon
Labs SoC flash drivers.

Signed-off-by: Arun Padakanti <arpadaka@silabs.com>
2026-10-14 13:47:16 +02:00
Dimitrios Kafetzis
e2f1cf623f drivers: flash: flash_hp_ra: restore the data flash blank check default
FLASH_RENESAS_RA_HP_CHECK_BEFORE_READING took its default from
erase-value-undefined on the flash1 node. The mapped-partition DTS
rework removed the flash1 label and moved the property to
data_flash_ctrl, so the option silently became n. Erased data flash then
reads back as undefined values instead of 0xff, and NVS fails to mount
with -EDEADLK. Read the property from data_flash_ctrl instead.

Tested by building on 11 RA boards; not run on RA hardware.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Dimitrios Kafetzis <dimitrioskafetzis@gmail.com>
2026-10-14 08:44:37 +02:00
Dharun krithik k
920074c07c drivers: flash: infineon_pdl: always stage writes through SRAM buffer
The CAT1 PDL requires program data to be in SRAM, but the write path
passed aligned sources straight to the PDL and only staged misaligned
ones. An aligned buffer that lives in flash/rodata could therefore bypass
the copy and violate that requirement.

Always memcpy each row into the SRAM row_buf before programming, so the
PDL always gets a buffer that is in SRAM and aligned.

Signed-off-by: Dharun krithik k <dharunkrithik@aerlync.com>
2026-10-10 22:47:09 +02:00
Andrzej Głąbek
80cf3ccc95 drivers: flash_mspi_nor: Fix transfer mode used by sfdp_read()
This is a follow-up to commit eb318914c2.

SFDP reads are not just short control or configuration transfers
and may actually involve transferring significant amounts of data,
so they should use the same transfer mode as normal data reads.
And this is not only a question of efficiency of the transfers.
For example, for the Synopsys DW SSI controller, if a fairly long
transfer is performed in single IO mode without using DMA, it may be
interrupted by the controller when the CPU won't cope with refilling
the controller's TX FIFO on time.
Use then `data_xfer_mode` instead of `control_xfer_mode` for SFDP
transfers.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2026-10-09 08:35:41 +02:00
Benjamin Cabé
5a7efa7d8c hardening: storage: add storage shell rules
Add hardening rules for the shell command modules that give raw read
and write access to persistent storage. These are base profile rules:
unlike CONFIG_SHELL itself, which only the strict profile flags, dumping or
rewriting flash, EEPROM, settings and files is not appropriate even for
products that deliberately ship a shell.

- CONFIG_EEPROM_SHELL: n (base)
- CONFIG_FILE_SYSTEM_SHELL: n (base)
- CONFIG_FLASH_SHELL: n (base)
- CONFIG_SETTINGS_SHELL: n (base)

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-10-07 05:00:11 +02:00
Pisit Sawangvonganan
27c0e8d035 drivers: {flash, gpio, i2c, mfd, misc, modem, mspi, pwm, reset}: fix typo
Utilize a code spell-checking tool to scan for and correct spelling errors
in all files within:
- `drivers/flash`
- `drivers/gpio`
- `drivers/i2c`
- `drivers/mfd`
- `drivers/misc`
- `drivers/modem`
- `drivers/mspi`
- `drivers/pwm`
- `drivers/reset`

Assisted-by: Claude:claude-sonnet-5-5 codespell
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2026-10-06 22:39:29 +02:00
Khoa Nguyen
d60b3296cf drivers: flash: Revert the flash ex_op changes for Renesas QSPI
Since the previous update removed the QSPI ex_op enumeration,
this commit reverts that update to fix the QSPI build failure
when ex_op is enabled

Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
2026-10-03 09:48:36 +02:00
Benjamin Cabé
7567491a4f drivers: flash: cc23x0: pick the flash node by instance again
commit 7acfb6145f ("drivers: flash: unify SOC_NV_FLASH_NODE logic")
switched this driver to SOC_NV_FLASH_CHILD_NODE(), which only handles a
controller with one soc-nv-flash child. cc23x0 has two, the main sector
and the CCFG sector whose compatible list also carries soc-nv-flash, so
the macro expands to two juxtaposed node ids and nothing with flash
enabled compiles.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5
2026-10-02 08:21:54 -05:00
Sylvio Alves
3d0f05791e drivers: flash: esp32: add the flash yield options
Long runs of erase and write operations keep the flash cache
disabled, and on multi-core SoCs the other core parked, for the
whole run unless the driver yields between windows. Add the
options that size that yield: whether to yield at all, the
cumulative cache-off budget, the yield length and the write
window size. The flash layer reads them through its port.

Assisted-by: Claude:opus-5
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2026-09-30 12:43:15 +02:00
Cristian Guemes
a51a9aa70c drivers: flash: microchip: flash G3 driver
Addition of Flash G3 driver implementation
to support PIC32CM SG/GC series

Signed-off-by: Cristian Guemes <cristian.guemes@microchip.com>
2026-09-29 10:42:06 +02:00
Tien Nguyen
5b0960f624 driver: flash: renesas: update memory_size property
update memory_size property follow by RZ FSP 4.2.0

Signed-off-by: Tien Nguyen <tien.nguyen.zg@renesas.com>
2026-09-28 14:32:02 -04:00
Duc Bui
e6e8badd5b drivers: flash: renesas: Initialize p_reg in extended configuration
Initialize p_reg with the register base address from devicetree.

Signed-off-by: Duc Bui <duc.bui.vt@bp.renesas.com>
Signed-off-by: Tien Nguyen <tien.nguyen.zg@renesas.com>
2026-09-28 14:32:02 -04:00
Peter Wang
c156ef1ec3 drivers: flash: mcux: fix ambiguous SOC_NV_FLASH_NODE lookup
DT_INST(0, soc_nv_flash) enumerates soc-nv-flash nodes across the
whole devicetree, ordered by dependency ordinal, not scoped to the
flash controller this driver instance actually owns. On boards with
more than one soc-nv-flash node (e.g. frdm_mcxa577, which has both
the internal MCXA577 flash and an external W25Q64 SPI NOR flash),
instance 0 can resolve to either node depending on their relative
position in the tree, so SOC_NV_FLASH_NODE silently picks up the
wrong node's write-block-size and erase-block-size.

This was hit after moving the fmu node out from under &peripheral:
the reordering flipped DT_INST(0, soc_nv_flash) from the internal
flash to the external SPI NOR flash, so the flash page layout
reported an erase-block-size of 0x1000 (the SPI NOR's) instead of
the internal flash's actual 0x2000. Erasing with that wrong size
triggers kStatus_FLASH_AlignmentError from the ROM API on real
hardware.

Use DT_CHILD(DT_DRV_INST(0), flash_0) instead, which looks up the
flash_0 child of this driver's own instance instead of searching the
whole tree. flash_0 is the child node name used by every soc-nv-flash
node under the compatibles this file matches.

Verified on frdm_mcxa577 hardware via CMSIS-DAP/MCU-Link:
tests/drivers/flash/common now reports the correct 8K erase-block-size
and the full suite passes (SUITE PASS - 100.00%, 6 passed, 3 skipped).
Build-only checked frdm_k64f and lpcxpresso55s69 (single soc-nv-flash
instance each) to confirm no regression.

Signed-off-by: Peter Wang <chaoyi.wang@nxp.com>
2026-09-28 09:38:40 -04:00
Neil Chen
17f25054c3 drivers: flash: Update flash nand driver
1. The NOR and NAND in the MCXN947 board are mutually exclusive,
add memc include for CONFIG_FLASH_MCUX_FLEXSPI_NAND.
2. Add Quad I/O enable, otherwise MX35LF1GE4AB write normal
but read fail

Signed-off-by: Neil Chen <cheng.chen_1@nxp.com>
2026-09-28 07:35:09 -04:00
Khoa Nguyen
c22d770a35 drivers: flash: Refactor Renesas OSPI_B driver
Refactor Renesas OSPI_B driver to support multiple 8D-8D-8D,
1S-4S-4S, 4S-4S-4S
SPI NOR flash devices:
- Update init flow to get command value from the SFDP tables
- Update API function to support multiple protocol modes

Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
2026-09-28 07:35:02 -04:00
Khoa Nguyen
7c9924f97b drivers: flash: Update additional macro for jesd216
Add PROFILE_1, SCCR_MAP, and SEQ_OCTAL_DDR macros and helper
macro functions

Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
2026-09-28 07:35:02 -04:00
Julien Racki
db9633c835 drivers: flash: stm32: xspi: Set a default timeout in the init fast path
When CONFIG_STM32_APP_IN_EXT_FLASH and CONFIG_XIP are enabled, XSPI
initialization is skipped because the bootloader
has already configured it.
Therefore in this fast path HAL_XSPI_Init() is not called and the
timeout value stays at 0.

This PR fixes the fast path and initialize the timeout to
HAL_XSPI_TIMEOUT_DEFAULT_VALUE.

Signed-off-by: Julien Racki <julien.racki-ext@st.com>
2026-09-26 01:13:36 +02:00
Daniel DeGrasse
15723416fd drivers: flash: flash_intel_pflash: use SOC_NV_FLASH_CHILD_NODE macro
Move intel pflash driver to use new SOC_NV_FLASH_CHILD_NODE macro

Signed-off-by: Daniel DeGrasse <daniel.degrasse@analog.com>
2026-09-24 13:42:11 -05:00
Francois Ramu
15f712a262 drivers: flash: stm32 xspi remove warning on build for stm32H5 series
The build warning caused twister error on stm32h5 boards
It can now be removed as all the stm32h5 boards have the MSPI
controller compatible.
Simply add a comment in the flash xspi driver to notify that
the flash stm32 xspi driver will be deprecated v4.5.0

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2026-09-24 09:55:36 +02:00
Guillaume Gautier
81d6f2c336 include: drivers: clock: stm32: rename macros with DT_ for consistency
Typically Zephyr device tree macros that take a node_id as argument
start with DT_ and those that take an inst start with DT_INST_.
For the STM32 clock driver we currently have two macros named
STM32_DT_INST_CLOCK_INFO_BY_NAME and STM32_CLOCK_INFO_BY_NAME.
For consistency, the latter is renamed STM32_DT_CLOCK_INFO_BY_NAME.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2026-09-22 17:56:13 +02:00
Paolo Bazzanella
995b3f3fa0 fix: renesas: flash: add missing semicolon
File was missing a semicolon, without which it didn't compile if
CONFIG_FLASH_RENESAS_RA_HP_CHECK_BEFORE_READING was set

Signed-off-by: Paolo Bazzanella <pbazzanella@qubicaamf.com>
2026-09-22 08:58:06 +03:00
Jamie McCrae
1909f76910 kconfig: Correctly have EXPERIMENTAL prompt
Fixes various issues with Kconfigs, including:
  - Using the wrong indentation
  - Not having [EXPERIMENTAL] in the prompt, or not having it at
    the end
  - Wrongly stating the CONFIG_EXPERIMENTAL is needed to enable
    an experimental Kconfig

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-09-21 16:27:52 -04:00
Daniel DeGrasse
2c7ad4f8da drivers: flash: add semihosted flash driver
Add a semihosted flash driver, which utilizes the semihosting interface
to write to a flash file on the host. The flash file will be created if
it does not exist, but otherwise an existing flash file is used. This
driver can therefore be used for testing flash in cases where the
contents need to be set before application startup (such as mcuboot)

Assisted-by: Claude:claude-haiku-4-5
Signed-off-by: Daniel DeGrasse <daniel.degrasse@analog.com>
2026-09-21 16:25:19 -04:00
Aksel Skauge Mellbye
96491da790 drivers: flash: silabs: Add Series 3 EXTMEM flash driver
Add driver for Silicon Labs Series 3 EXTMEM flash controlled by
the SE. The initial version of the driver supports reading from
and getting the layout of the entire flash, but only writing
and erasing data regions.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2026-09-21 11:26:13 +01:00
Pieter De Gendt
4fc201611f drivers: flash: flash_mcux_flexspi_nor: derive erase geometry from SFDP
The SFDP configuration path programmed ERASE_SECTOR/ERASE_BLOCK with the
classic 0x20/0xD8 opcodes and strode range erases by an assumed 64 KiB
block size, regardless of what the flash declares. On parts whose block
erase is larger (e.g. the ISSI IS25WX01G declares 128 KiB for 0xD8),
each block-erase step wipes 64 KiB more than the loop accounts for,
erasing past the end of the requested range.

Select the erase opcodes from the BFP erase types (DW8-DW9) instead: the
type matching the driver's 4 KiB sector size for ERASE_SECTOR, and the
largest declared type for ERASE_BLOCK, with the block erase stride taken
from that type's actual size. Erase types beyond the advertised BFP
table length are skipped, as are types declaring a nonsensical size.
Vendor-specific and default LUT paths keep the 64 KiB assumption they
hard-code today.

Assisted-by: Claude:claude-fable-5
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2026-09-19 10:36:12 +02:00
Ruijia Wang
18b4a06d4c drivers: flash: mcux_xspi: select chip config by DT compatible
Choose the per-chip config at build time from the node compatible
instead of matching device-name at runtime.

Signed-off-by: Ruijia Wang <ruijia.wang@nxp.com>
2026-09-17 12:19:07 +01:00
Ruijia Wang
cc24f1cf0a drivers: flash: mcux_xspi: add W25Q512NW quad SPI NOR support
Generalise the octal-only driver to a per-chip config and LUT table
so it can also drive the on-board Winbond W25Q512NW quad SPI NOR on
RT700 XSPI0. The octal path is unchanged.

Signed-off-by: Ruijia Wang <ruijia.wang@nxp.com>
2026-09-17 12:19:07 +01:00
Julien Racki
b6d1d04653 drivers: flash: stm32: xspi: Restore memory mapping between chunks
Restore memory mapping between chunks to limit the time interrupts
are masked to a single chunk instead of the entire operation.

Signed-off-by: Julien Racki <julien.racki-ext@st.com>
2026-09-16 21:38:19 +01:00
Julien Racki
30e78dc3c4 drivers: flash: stm32: xspi: lock IRQs during write/erase when relocated
When CONFIG_FLASH_STM32_XSPI_XIP_RELOCATE is enabled, ISR handlers
are in flash. Lock IRQs for the entire write/erase operation while
memmap is off to prevent executing code from flash.

Signed-off-by: Julien Racki <julien.racki-ext@st.com>
2026-09-16 21:38:19 +01:00
Julien Racki
81e8fa6f3c drivers: flash: stm32: xspi: restore memmap after write/erase
Abort the memory-mapped mode before write or erase operations and
restore it afterwards.

Signed-off-by: Julien Racki <julien.racki-ext@st.com>
2026-09-16 21:38:19 +01:00
Julien Racki
21bdd46c0d drivers: flash: stm32: xspi: set defaults on XIP init bypass
When the device is already in memory-mapped XIP mode at boot, the full
init sequence is skipped. Set address_width and write_opcode to valid
defaults based on device config so that write and erase operations have
correct parameters without requiring a full re-init.

Signed-off-by: Julien Racki <julien.racki-ext@st.com>
2026-09-16 21:38:19 +01:00
Julien Racki
42a40318de drivers: flash: stm32: xspi: avoid flash access in memmap XIP critical path
Refactor internal helpers to take dev_data directly instead of struct
device, removing dev->data and dev->config calls that cause flash
accesses while executing from RAM.

Also zero-initialize XSPI_RegularCmdTypeDef to avoid implicit memset
calls from flash.

Signed-off-by: Julien Racki <julien.racki-ext@st.com>
2026-09-16 21:38:19 +01:00