Commit graph

1230 commits

Author SHA1 Message Date
Francois Ramu
958087f49d drivers: flash: stm32 ospi driver size and address of the external NOR
New property of the st,stm32-ospi-nor compatible gives
the external NOR flash in bits.
The property of the st,stm32-ospi compatible gives
the external NOR flash base address

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2025-06-20 14:41:41 -05:00
Andrzej Głąbek
8415f7f7a7 drivers: flash_mspi_nor: Omit quad_enable_set() when QER is set to NONE
When the quad-enable-requirements property is set to "NONE" or is not
present, no Quad Enable operation should be performed.
This fixes an issue with the mx25uw6345g flash chip that is present
on the nRF54h20 DK and supports the Single I/O mode, but cannot be
used in that mode.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2025-06-20 16:22:58 +02:00
Joakim Andersson
e5093f41b2 drivers: flash: Fix timeout handling in STM32 flash driver
Fix timeout error that can occur in rare case.
When the thread writing to flash is pre-emptive it can be scheduled
out after reading the status register, but before checking if timeout
has expired. In this case it will report timeout without re-checking
the status register.

When writing a lot to flash, for example a firmware update process
then this situation is very likely to occur.

Signed-off-by: Joakim Andersson <joerchan@gmail.com>
2025-06-19 14:02:32 +02:00
Federico Di Gregorio
3d720bcb73 drivers: flash: stm32: add "generic read/write" ex op to QSPI driver
Some external flash modules have extra commands to support, for example,
reading/writing an OTP zone. Given that the commands are highly specific
and difficult to generalize, we add two ex ops that can be used to
transmit a custom command (in the form of a full QSPI_CommandTypeDef) and
then read or write a user-provided buffer.

Signed-off-by: Federico Di Gregorio <fog@dndg.it>
2025-06-18 07:37:00 +02:00
Swift Tian
cc5c142535 drivers: mspi: add mspi is25xx0xx device driver
This device driver supports ISSI is25w/lx032/64 series flash.
Only extended SPI mode(1s-1s-1s, 1s-8s-8s, 1s-1s-8s) is implemented.

Signed-off-by: Swift Tian <swift.tian@ambiq.com>
2025-06-18 07:36:26 +02:00
Keith Packard
87029f7422 drivers/flash: Fix #if condition for is_area_readable for mcux
is_area_readable is used for SOCS other than LPC55XXX chips, not just
chips other than LPC55S36. Change the condition which elides this code
to avoid a GCC 14.3 warning.

Signed-off-by: Keith Packard <keithp@keithp.com>
2025-06-17 16:06:21 +02:00
Khaoula Bidani
70ebb0a6a3 drivers: flash: add stm32u3 devices
Introduce the stm32u3 serie to the the existing flash driver
It is based on the stm32l5 model.

Signed-off-by: Khaoula Bidani <khaoula.bidani-ext@st.com>
2025-06-16 13:59:38 -04:00
Martin Gysel
812d33b7ab drivers: flash_stm32_qspi: fix conditional to assing jedec_id property
the jedec_id field is only available if CONFIG_FLASH_JESD216_API is set

Signed-off-by: Martin Gysel <me@bearsh.org>
2025-06-13 10:21:00 -07:00
Andrzej Głąbek
2d9ede3852 drivers: flash: nrf_qspi_nor: Handle properly multiple XIP users
Add reference counting in nrf_qspi_nor_xip_enable() so that XIP is
kept enabled as long as there is at least one user that needs it
(boot time enabling done with CONFIG_NORDIC_QSPI_NOR_XIP also counts).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2025-06-12 11:45:10 +02:00
Alessandro Manganaro
bbef47fc56 drivers: flash: stm32wba: fix build issue when BLE enabled
Specific flash driver is used for stm32wbax when ble is
enabled. A simple typo error was fixed to properly build
all the samples where flash and ble are enabled,
such as the peripheral one.

Signed-off-by: Alessandro Manganaro <alessandro.manganaro@st.com>
2025-06-09 14:39:34 -07:00
Benjamin Cabé
998ee87635 drivers: flash: use negative errno in Renesas RA HP
fixed an incorrect "return EINVAL" where it should
be -EINVAL.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-09 08:56:19 +02:00
Mahesh Mahadevan
c5787e8809 drivers: flash: Fix unused function warning on LPC55S69
is_area_readable() function is no longer used for the LPC55XXX
series.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2025-06-06 14:49:45 +01:00
Francois Ramu
cbe3e18396 drivers: flash: stm32h7RS flash size is fixed to 64KBytes
Fix the flash size to 64KB for the stm32H7RS series.
Restore the get_size API function for that series.
This is a specificity of this stm32 mcu (RefMan RM0477).

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2025-06-06 10:11:07 +02:00
Tri Nguyen
1005cd9fa2 drivers: flash: Initial support OSPI flash driver on RA8 boards
Support OSPI flash driver on EK-RA8M1 and EK-RA8D1 with ospi_b
and S28HL512T flash.

Signed-off-by: Tri Nguyen <tri.nguyen.wj@bp.renesas.com>
Signed-off-by: Thao Luong <thao.luong.uw@renesas.com>
2025-06-06 08:41:46 +02:00
Wilkins White
00ee4a5887 drivers: flash: mcux: fix read for LPC55XXX
The LPC55XXX SoC series requires the use of a HAL function to read
from uninitialized flash without triggering a hardfault. This
broadens an existing #ifdef clause so that it is triggered for all
chips in the series instead of only the LPC55S36.

Signed-off-by: Wilkins White <ww@novadynamics.com>
2025-06-04 08:45:56 +02:00
David Leach
c0c1b0af44 drivers: flash: Align NXP flash drivers on parameter checking
Parameter checking of flash read API expects checking for len == 0
before checking dest buffer validation.

Fixes #87021

Signed-off-by: David Leach <david.leach@nxp.com>
2025-05-30 10:27:26 +02:00
Benson Huang
3e8ec3aaf2 driver: flash: Add Set/ Get write protect function
Add Set_WP function to set SPI flash WP line to low
Add Get_WP function to obtain status of the SPI flash WP line

Signed-off-by: Benson Huang <benson7633769@gmail.com>
2025-05-28 08:14:27 +02:00
Luca Burelli
8151dd9c6c drivers: flash_stm32h7: fix flash size detection
Commit 0e41b07309 ("drivers : flash:
update way to get flash size") changed the way to get flash size from
the LL_FLASH_GetSize() HAL function to the current DT_REG_SIZE() macro.

However, they are not equivalent:

- With LL_FLASH_GetSize(), REAL_FLASH_SIZE_KB returned the *total* size
  of the Flash memory, reading it from a ROM register of the CPU. For
  example, it was 2048 (2MB) for a STM32H747xI.

- The current DT_REG_SIZE() applies to a flash *bank*, therefore it only
  returns half of the total Flash size on dual bank devices.

This mismatch causes issues with the DISCONTINUOUS_BANKS logic below,
incorrectly matching partitions close to the end of the first bank as
appearing to span both and triggering the "range overlaps discontinuity"
check later.

Fix it by doubling the size when appropriate, in the same way it is
already done for the M4 core.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2025-05-23 11:04:15 +02:00
Stoyan Bogdanov
bdca32d88f drivers: flash: Remove VIMS calls for cc23x0
Remove VIMS calls for flash operations, since they are not needed.

Signed-off-by: Stoyan Bogdanov <sbogdanov@baylibre.com>
2025-05-21 19:57:28 +02:00
Francois Ramu
e13722bc38 drivers: flash: stm32 xspi flash driver set the DelayBlock if exists
The stm32H7RS serie has no DelayBlock Bypass control in its DCR1 register.
For other stm32 devices with DelayBlock bypass control, set the value
directly in the structure.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2025-05-21 17:35:06 +02:00
Francois Ramu
93b983d578 drivers: flash: stm32 xspi drivers supporting the stm32h7r/s mcu
Add the support of the stm32h7rs serie to the
drivers/flash/flash_stm32_xspi driver.
The stm32h7rs has no delayblock

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2025-05-21 17:35:06 +02:00
Francois Ramu
8cb8017038 drivers: flash: stm32 xspi driver supports clock domain config
Add the clock domain configuration for the xspi nodes
Where the DTS defines main clock and peripheral clock sel
plus a XSPIM clock

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2025-05-21 17:35:06 +02:00
Mark O'Donovan
d33da4db35 drivers: flash_stm32_qspi: add st,read-id-dummy-cycles
Add new device tree property specifying the number of
dummy-cycles required when reading the JEDEC ID.

The Arduino Opta has an at25sf128a with JEDEC ID 1F 89 01.
The PR below adds support for this, but the id read is 01 1F 89.
Changing DummyCycles to 16 causes the correct value to be read.

https://github.com/zephyrproject-rtos/zephyr/pull/89539

Signed-off-by: Mark O'Donovan <shiftee@posteo.net>
2025-05-21 14:04:09 +02:00
Erwan Gouriou
cec116c83f drivers: flash: xspi: Put delay block config under specific bit
On some series, use of Delay Block could be possible on OSPI device but
not on HSPI one (which uses this drivers).
As a quick fix check the presence of XSPI Delay Block by-pass
configuration bit instead of the Delay Block presence.

Note: This fix works because we don't have cases today where this driver
is used for OSPI and HSPI instances with mixed DLYB compatibility.
This may have to be reviewed one day and may require a more complex fix
with instantiable configuration, but this day may never come as well.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2025-05-16 19:07:23 +02:00
Yonas Alizadeh
c186bffab8 drivers: flash: flash_stm32g4x: Fix STM32G4 unaligned read access
Due to source data pointer having no alignment constraint,
extra care needs to be taken when reading source data
as dword

Signed-off-by: Yonas Alizadeh <yonas.alizadeh@alfalaval.com>
2025-05-16 16:12:10 +02:00
Anas Nashif
5fe84d5b69 arch: nios2: remove arch
Remove architecture and dependencies.
Remove altera HAL supporting nios2

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-05-15 20:01:05 -04:00
Jhan BoChao
7450a5249d driver: flash: add flash driver for rts5912
add flash driver for rts5912.

Signed-off-by: Jhan BoChao <jhan_bo_chao@realtek.com>
2025-05-15 11:18:22 +02:00
Hao Luo
4bc2de23a9 drivers: flash: Add support for Apollo510 flash controller
This commit adds support for Apollo510 SoC in ambiq flash driver

Signed-off-by: Hao Luo <hluo@ambiq.com>
2025-05-14 09:11:17 +02:00
Robert Hancock
3a2639a9de drivers: flash: spi_nor: Add fast read support
Most SPI NOR flash devices support a "fast read" command which uses
dummy bits between the address and the start of the data transfer. In
many cases, the maximum SPI clock speed of the device is lower for the
regular read command due to the limited time between the address and
data phases, so using the fast read command will remove this restriction
and allow for faster transfers.

Add a device tree flag to indicate that fast reads should be used for
the device.

Signed-off-by: Robert Hancock <robert.hancock@calian.com>
2025-05-13 12:09:06 +02:00
Robert Hancock
ecacf3d5e3 drivers: flash: spi_nor: Added flag status register support
Some Micron (and possibly other) SPI NOR devices implement a flag status
register which provides more information on the success/failure of erase
and program operations. In addition to better error checking, some of
these devices actually don't function properly if the flag status
register is not read after a program operation (subsequent reads will
only return 0xFF bytes).

Add a device tree parameter to indicate that the flag status register is
supported. When specified, the flag status register will be used for
ready/error checks rather than the standard status register.

Signed-off-by: Robert Hancock <robert.hancock@calian.com>
2025-05-13 12:09:06 +02:00
Robert Hancock
1fdb43cf27 drivers: flash: spi_nor: optimize SPI buffer usage
This driver was providing SPI buffers for both TX and RX on the data
payload portion of read transfers, even though the TX buffer is not
meaningful in these cases. As well as being less efficient, this also
caused likely uninitialized data to be transferred to the device, which
is possibly problematic.

Update to not include the TX buffer for the read data payload SPI
transfer, so that the SPI driver can generate dummy TX data internally.

Signed-off-by: Robert Hancock <robert.hancock@calian.com>
2025-05-13 12:09:06 +02:00
Francois Ramu
4278e98210 drivers: flash: stm32 octospi supports the 4Bytes address mode
Add the 4Bytes program mode to the stm32_ospi driver
to enter 4-Byte Address Mode (SPI_NOR_CMD_4BA) when flash is supporting it.
This is given by the JESD216 SFDP table.
Based on the stm32 qspi driver.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2025-05-13 12:08:51 +02:00
Jeremy Dick
b5c0984eb1 drivers: flash: flash_hp_ra: perform blank check before reading
The value read from unwritten areas of Renesas RAxxx SoCs data
flash is undefined. To prevent reading unwritten areas a
blank check command is performed first. If the area is blank, we
return dummy data so it behaves the same as other flash devices.

Signed-off-by: Jeremy Dick <jdick@pivotint.com>
2025-05-13 07:24:39 +01:00
Titouan Christophe
7e26a7130e drivers: flash: stm32: fix FLASH_ constants renamed in hal_stm32
In hal_stm32 commit "update stm32h7rs to cube version V1.2.0"
e5eba65b76
the constants FLASH_OPTKEY1/2 for the STM32H7RS have been renamed to
FLASH_OPT_KEY1/2. For backward compatibility, 2 defines have been added
to Legacy/stm32_hal_legacy.h, so that FLASH_OPTKEYx is an alias for
FLASH_OPT_KEYx.

However, in Zephyr's STM32 flash driver, the alias is defined the other
way around since 5dc537389a, which leads to
Twister build failures, for example
https://github.com/zephyrproject-rtos/zephyr/actions/runs/14927867714/job/41936931524#step:12:1335

To fix the build issue, we can simply remove that alias in Zephyr, since
it is no longer needed.

Signed-off-by: Titouan Christophe <titouan.christophe@mind.be>
2025-05-12 13:31:23 +02:00
Titouan Christophe
25b326bc1f flash: stm32h7x: fix implicit declaration for LL_GetFlashSize
Since https://github.com/zephyrproject-rtos/zephyr/pull/83114 was merged,
I get twister errors unrelated to my pull requests for the STM32H7S78-DK
(for example https://github.com/zephyrproject-rtos/zephyr/actions/runs/14900504138/job/41851537049#step:12:1369)

This is because the function LL_GetFlashSize() was removed from hal_stm32
on the STM32H7RS series in
e5eba65b76

I am unsure if the removal from hal_stm32 is intentional. If yes, then this
commit should be merged into Zephyr to fix compilation for that target.
Otherwise, hal_stm32 must be patched, Zephyr's west manifest updated, and
this commit can be discarded.

Signed-off-by: Titouan Christophe <titouan.christophe@mind.be>
2025-05-09 12:52:12 +02:00
Swift Tian
726eb0a25d drivers: mspi: add apollo5x MSPI controller
Add the MSPI controller support for apollo5x.
Add the MSPI controller to mspi API test.
Updated west.yml for hal updates.

Signed-off-by: Swift Tian <swift.tian@ambiq.com>
2025-05-07 10:33:38 +02:00
Swift Tian
5c7e7eab7f drivers: mspi: shroud controller specifics and fix potential issue
1. Moved ambiq specific macro to mspi_ambiq header.
2. Always fill rx&tx dummy settings regardless of transfer direction.
3. Add the CONFIG_MSPI_* macro for optional features.
4. Fixed the ID read process and add k_sleep during busy_wait in
   atxp032 driver.

Signed-off-by: Swift Tian <swift.tian@ambiq.com>
2025-05-07 10:33:38 +02:00
Swift Tian
cbd475b9ed drivers: mspi: standarlized transfer priority
Standarlized transfer priority and add a medium level.

Signed-off-by: Swift Tian <swift.tian@ambiq.com>
2025-05-07 10:33:38 +02:00
Francois Ramu
96b3a22dd8 drivers: flash: stm32H5 flash driver gives the flash size
Use the LL_GetFlashSize to retrieve the size of the flash, reading the
system flash OTP of the stm32h5 serie. This operation requires
Icache disable/re-enable to access the 0x08FF F80C memory area

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2025-05-06 18:23:36 +02:00
Francois Ramu
eea1b828a1 drivers: flash: stm32 flash drivers supports the get_size API function
Implement the get_size flash device API function for the various stm32
This is just CONFIG_FLASH_SIZE expressed in Bytes or the FLASH_SIZE
given by the LL driver

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2025-05-06 18:23:36 +02:00
Francois Ramu
5dc537389a drivers: flash: stm32 flash driver common functions
Move the flash_stm32_write_protection and
flash_stm32_option_bytes_lock functions to a common
file for stm32 devices including stm32h7

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2025-05-06 18:23:14 +02:00
Guillaume Gautier
08cc15aed8 drivers: flash: stm32 xspi: replace prescaler assert by returning error
Replace the assert on the value of the prescaler by a standard check and
an error value return (similar to the STM32 XSPI PSRAM driver).

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-05-06 15:32:02 +02:00
Khoa Nguyen
d9032f03f2 drivers: flash: Update driver flash to support Flash-HP for RA4L1
Update source flash driver to support Flash-HP for RA4L1

Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
2025-05-02 07:19:46 +02:00
Khoa Nguyen
9088261efd drivers: flash: Correct naming of Flash HP Renesas RA Kconfig
Correct naming of Flash HP Renesas RA Kconfig

Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
2025-05-02 07:19:46 +02:00
Khoa Nguyen
f305a339b3 drivers: flash: Update naming for flash driver of Renesas RA
Update naming for flash driver of Renesas RA

Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
2025-05-02 07:19:46 +02:00
Khoa Nguyen
575a95de65 drivers: flash: Remove Dual mode feature for Renesas flash-HP
Since the Dual Mode feature doesn't actually work when selected,
and we also realize that we can't support key features of dual
mode, such as bank swap using hardware.
As a solution, we desire to remove this Dual mode feature.

Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
2025-05-02 07:19:46 +02:00
Francois Ramu
bee60ed906 drivers: flash: stm32 xspi driver size and address of the external NOR
New property of the st,stm32-xspi-nor compatible gives
the external NOR flash in bits.
The property of the st,stm32-xspi compatible gives
the external NOR flash base address

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2025-04-30 18:44:24 +02:00
Guillaume Gautier
a5f979315e drivers: flash: stm32 xspi: add memmap support for n6
Add memory-mapped support for STM32N6 XSPI Flash driver.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-04-30 16:26:28 +02:00
Guillaume Gautier
f69fcdf65f drivers: flash: stm32: remove dependeny on XIP for memory map
Remove XIP dependency for enabling memory mapping for Q/O/XSPI NOR Flash.
It is not necessary and is preventing configuring an external Flash in
memmap mode if there is no internal Flash (like on STM32N6)

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-04-30 16:26:28 +02:00
Cong Nguyen Huu
1596cc5667 drivers: flash-nxp-s32-qspi: ignore flash operations with zero size
The current shim driver for flash-nxp-s32-qspi returns invalid error
when handling write, erase operations with zero size.
This issue causes the failure of the tests/subsys/settings/fcb/.
Updated to ignore the flash operations with zero size instead of.

Signed-off-by: Cong Nguyen Huu <cong.nguyenhuu@nxp.com>
2025-04-30 11:57:05 +02:00