Commit graph

1230 commits

Author SHA1 Message Date
Mahesh Mahadevan
9278de258e drivers: flash: flexspi: Fix XIP during flash write
Commit 857e5793f1 fix
the flash_mcux_flexspi_nor.c driver to wait for the
FlexSPI to be idle before performing write/erase
operations. Add a similar check to these drivers that
also use the FlexSPI NOR block.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2025-04-25 18:58:57 +02:00
Andrzej Głąbek
fb1d0785ae drivers: flash: nrf_qspi_nor: Prevent CPU hang when XIP is re-enabled
Add a simple non-XIP transaction before deactivating the QSPI after
a XIP transaction is performed. This prevents a CPU hang from occuring
when another XIP transaction is attempted after the QSPI is activated
again.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2025-04-25 15:57:35 +02:00
Henrik Lindblom
1a3fb4adfc drivers: stm32: use cache peripheral driver
Use cache API for disabling and enabling ICACHE. The driver handles waiting
for ongoing cache invalidation.

Signed-off-by: Henrik Lindblom <henrik.lindblom@vaisala.com>
2025-04-25 11:04:37 +02:00
Tomasz Chyrowicz
2f6ac20654 drivers: flash: Optimize mspi_nor driver memory
Move MSPI NOR commands to rodata.
Replace array with empty padding (~1kB) with macro-based assignments.

Ref: NCSDK-32779

Signed-off-by: Tomasz Chyrowicz <tomasz.chyrowicz@nordicsemi.no>
2025-04-22 04:33:05 +02:00
Marcin Szymczyk
b6642bb996 drivers: flash: mspi_nor: support MODE_SINGLE and MODE_QUAD_1_4_4
Extend driver to support single lane and 1-4-4 IO modes.
Move flash chip quirks to a separate file.

Signed-off-by: Marcin Szymczyk <marcin.szymczyk@nordicsemi.no>
2025-04-22 04:33:05 +02:00
Tim Pambor
d68929c64a drivers: flash_stm32_xspi: fix DT accessor for flash size
The flash size is the second part (size) of the first reg value, not the
first part (address) of a nonexistent second reg value.

Based-on-patch-by: Armin Brauns <armin.brauns@embedded-solutions.at>
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2025-04-18 12:36:20 +02:00
Hao Luo
6f4b92d64d soc: ambiq: Optimize the inclusion relationship of header files
Optimized the inclusion relationship of header files

Signed-off-by: Hao Luo <hluo@ambiq.com>
2025-04-17 09:06:18 +02:00
Francois Ramu
a60d7741b5 drivers: flash: stm32wba6x add flash driver support
-The stm32wba6x has Dual Bank memory. Change the flash driver
 to support this OPTion given by presence of the
 DUAL_BANK bit (21) in the FLASH_OPTR register.

-Flash erase with 2 banks: Add the control of the BKER
 bit of the FLASH_NSCR1 to select BANK1 or 2 of
 the internal flash depending
 on the page number >127 for BANK2

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2025-04-15 15:33:15 +02:00
Peter Wang
7b2c92f0a0 boards: frdm_mcxa166, frdm_mcxa276: add flash support
1. enable flash support
2. verified test/driver/flash

Signed-off-by: Peter Wang <chaoyi.wang@nxp.com>
2025-04-14 20:03:54 +02:00
Fabrice DJIATSA
0e41b07309 drivers : flash: update way to get flash size
The LL_GetFlashSize function has been removed for
this new HAL H7RS release. Retrieves the value now from
the devicetree using the DT_REG_SIZE macro.

Signed-off-by: Fabrice DJIATSA <fabrice.djiatsa-ext@st.com>
2025-04-11 17:32:01 +02:00
Tim Lin
8c2f5684bb drivers/flash: Enable flash controller for it51xxx series
Enable flash controller for ITE it51xxx series.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2025-04-08 10:48:26 +02:00
Tim Lin
0e5218cbcc drivers: ITE: Use generic name instead of specific chip name
Use generic name for structure in driver instead of specific chip name
for better compatibility.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2025-04-08 10:48:26 +02:00
Peter Wang
5309c93944 drivers: flash: update flash_mcux to support all mcxa family device
update flash_mcux driver to support all mcxa family device

Signed-off-by: Peter Wang <chaoyi.wang@nxp.com>
2025-04-03 08:43:16 +02:00
John Barbero Unenge
64fe9344e1 driver: flash: mcux_flexspi_nor: Fix for is25lpxxxd chips
IS25LPXXXD uses the same jedec-id as IS25LPXXX, but the latter has
an extended read register, similar to IS25WPXXX. This change will
attempt to read the extended read register to determine what the
appropriate initialization value for read register should be.

Signed-off-by: John Barbero Unenge <git@lsrkttn.com>
2025-04-02 13:04:38 +02:00
Khoa Nguyen
37c5ac4bce drivers: flash: Update api for migration of FSP to 5.8.0
Update api of Renesas flash-hp driver when FSP has been
migrated from version 5.3.0 to 5.8.0

Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
2025-04-01 04:14:14 +02:00
Artur Hadasz
38b959e1a3 drivers: flash: nrf: Add possibility to add custom context
This commit adds the possibility to add additional custom
context for flash operations for usage by non-standard
flash drivers.

Signed-off-by: Artur Hadasz <artur.hadasz@nordicsemi.no>
2025-03-31 14:33:56 +02:00
Nidhal BEN OTHMEN
43c00e5b6c soc: stm32wbax: hci_if: Clean code
Clean the code, rename some constants and variables for more
consistency.

Signed-off-by: Nidhal BEN OTHMEN <nidhal.benothmen@st.com>
2025-03-20 14:22:21 +01:00
Guillaume Gautier
c46f2beee7 drivers: flash: stm32: xspi: fix xspi driver for stm32n6
Add some ifdef to fix compilation error on STM32N6

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-03-20 12:17:32 +01:00
Armin Brauns
bd98e0199b drivers: flash_stm32_qspi: fix DT accessor for flash size
The flash size is the second part (size) of the first reg value, not the
first part (address) of a nonexistent second reg value.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2025-03-19 20:25:37 +01:00
Tom Chang
1d59f95ad4 drivers: flash: npcx: avoid obstruction by eSPI TAF when EC access flash
This commit applies the arbitration when EC and eSPI TAF access flash.

Signed-off-by: Tom Chang <CHChang19@nuvoton.com>
2025-03-14 05:46:23 +01:00
Bjarki Arge Andreasen
9c6195a2da drivers: flash: sam: fix flash erase last page
The implementation for erasing pages in the flash_sam.c driver
indicated a successful erase after exceeding the last page to be
erased successfully. Since the last page has no proceeding page,
the succeeded status was not set.

This fix switches around the status to be set as succeeded before
erase begins, to have the succeeded status cleared if page unlock
or erase fails.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2025-03-10 15:02:16 +01:00
Aksel Skauge Mellbye
b25acabb70 drivers: flash: silabs: Add DMA read support
Enable support for using DMA to read from flash.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2025-03-07 20:02:26 +01:00
Aksel Skauge Mellbye
dba1c4bbbe drivers: flash: silabs: Add low power write support
Add low-power-write property to MSC device tree node, set
MSC_WRITECTRL_LPWRITE if enabled.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2025-03-07 20:02:26 +01:00
Aksel Skauge Mellbye
4970e2a196 drivers: flash: silabs: Add DMA write support
Enable support for using DMA to write to flash.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2025-03-07 20:02:26 +01:00
Aksel Skauge Mellbye
1de48c36ec drivers: flash: silabs: Introduce Silabs Series 2 flash driver
Introduce separate flash driver for Silabs Series 2. This driver
is forked from the Gecko flash driver with no changes outside of
formatting and naming.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2025-03-07 20:02:26 +01:00
Andrzej Głąbek
29f3061f32 drivers: flash: Add generic NOR flash driver for MSPI devices
Add a flash driver intended to handle various flash devices
connected over MSPI bus as long as they support JEDEC SFDP.
This is an initial commit providing only basic operations
in Octal I/O mode with some hard-coded values for Macronix
MX25Ux series chips.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2025-03-07 19:42:46 +01:00
Fabio Baltieri
91cf42c657 drivers: flash: spi_nor: fix few printf format warnings again
Looks like 9d5ebb3cbc introduced a new warning when building with
runtime sfdp on 32 bit platforms. Fix it for good by just casting the
operation to int and go back to use %u.

Tested with:

west build -p -b gd32f450z_eval samples/drivers/flash_shell \
	-DCONFIG_SPI_NOR_SFDP_RUNTIME=y
west build -p -b mpfs_icicle/polarfire/u54 samples/drivers/flash_shell

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-03-06 09:05:18 +00:00
Fabio Baltieri
9d5ebb3cbc drivers: flash: spi_nor: fix few printf format warnings
Fix few printf format warnings when building for
mpfs_icicle/polarfire/e51. PRIdPTR for the pointer difference, %zu for
size_t.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-02-28 18:29:26 +01:00
Khoa Nguyen
c768144002 drivers: Correct value of event macro for all Renesas SoC
Since the RA2L1 uses the macro "ICU_EVENT" instead of
"ELC_EVENT" (which is currently used) to input into
the IELSR register, the ek_ra2l1 board cannot assign
any interrupts for any driver.

This commit aim to correct the Event macro to input correct
value for IELSR register on all the Renesas SoC by using
"BSP_PRV_IELS_ENUM" macro.

Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
2025-02-28 18:29:17 +01:00
Jun Lin
dee7927a21 drivers: flash: npcx: add k_usleep when polling busy status
Adding k_usleep while polling the flash's busy status yields the CPU
resource, giving lower-priority threads the opportunity to run.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2025-02-26 07:40:37 +01:00
Sylvio Alves
5902f00bd5 driver: flash: esp32: fix unaligned read
Fix flash read operation to account for all unaligned
scenarios, i.e, address, buffer and length. This is needed
when using flash APIs provided in ROM.

This also removes the unaligned flash write call as it
expects aligned values only.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2025-02-24 20:19:47 +00:00
Sylvio Alves
e36d702acd soc: espressif: move code start prior hw init
Make sure vector table and BSS clean up
is performed pior hardware initialization.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2025-02-14 17:07:40 +01:00
Andriy Gelman
b92c3aa6ed drivers: flash: spi_nor: Set 4-byte addr mode via write instruction 0x17
Some flash devices enable entering the 4-byte address mode
by setting BIT(7) in a special register via a write instruction 0x17.
The support for this method is indicated in BIT(3) of
Enter 4-Byte Addressing byte in 16th DWORD of the JEDEC Basic
Flash Parameter Table.

Infineon's S25FL512S is an example flash device with this feature.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2025-02-13 16:40:24 +01:00
Dawid Niedzwiecki
c387fcae17 drivers: flash: stm32h7: fix compilation errors
There were some compilation errors caused by unused functions.

Add proper #ifdef statements not to include unused functions.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2025-02-13 09:12:12 +01:00
Pieter De Gendt
f13643ebbd drivers: flash: Wrap driver instances in device API macro
Use the device API macro to place the driver API instance into an iterable
section.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-02-12 16:06:25 +01:00
Emil Gydesen
571f26cf1a Bluetooth: Rename BLE to Bluetooth (LE) where applicable
The BLE acronym is not an official description of Bluetooth
LE, and the Bluetooth SIG only ever refers to it as Bluetooth
Low Energy or Bluetooth LE, so Zephyr should as well.

This commit does not change any board or vendor specific
documentation, and the term BLE may still be used in those.
It will be up to the vendors to update it if they want,
since many of them are using the term BLE in their
products.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-02-12 12:24:18 +01:00
Francois Ramu
2a5be6856a drivers: flash: stm32h5 flash driver reports the actual flash size
The Max flash size of the stm32H5 serie depends on the mcu device
from 256 to 1024 KB, in two banks.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2025-02-12 09:39:36 +01:00
Dawid Niedzwiecki
c2bcb5b646 drivers: flash: stm32: rename CR lock functions
Rename *write_protection functions to *cr_lock, because it is not
enabling real write protection. It only blocks changing register
by software accidentally.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2025-02-12 07:52:49 +01:00
Tom Hughes
cc73219748 drivers: flash: spi_nor: Fix unused function warning
Building with clang warns:

drivers/flash/spi_nor.c:306:20: error: unused function
'delay_until_exit_dpd_ok' [-Werror,-Wunused-function]
static inline void delay_until_exit_dpd_ok(const struct device *const dev)
                   ^

delay_until_exit_dpd_ok is only used when ANY_INST_HAS_DPD is defined.

Signed-off-by: Tom Hughes <tomhughes@chromium.org>
2025-02-12 02:24:33 +01:00
Jérôme Pouiller
d97479fdc3 drivers: flash: Introduce SiWx91x Flash driver
Add flash driver for Silicon Labs SiWx91x family.

Co-authored-by: Martin Hoff <martin.hoff@silabs.com>
Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
2025-02-11 22:07:11 +01:00
Kamil Krzyzanowski
d9b59f12de drivers: flash: spi_nor: swap depends on and help in Kconfig.nor
Change order of `depends on` and `help`, so `help` comes last.

Signed-off-by: Kamil Krzyzanowski <kamnxt@kamnxt.com>
2025-02-10 15:57:08 +00:00
Kevin Wang
c6488fc5c6 drivers: flash: andes_qspi: check if spi is used as flash fetch device
XIP may indicate that the program is executed either in local memory
or flash. However, the SPI node is only used as a flash fetch device
when the program is executed in flash.
Therefore, optimize the related checks to ensure that when XIP is
enabled but the program is executed in local memory, the qspi flash
node can still be used.

Signed-off-by: Kevin Wang <kevinwang821020@google.com>
2025-02-06 14:45:19 +01:00
Kevin Wang
72d7a0f548 drivers: flash: andes_qspi: Fix the bug when rx length exceeds 512 bytes
ATCSPI hardware limits single transfer to 512 bytes, so when reading
data over 512 bytes, it needs to be split into multiple transfers

Signed-off-by: Kevin Wang <kevinwang821020@google.com>
2025-02-06 14:45:19 +01:00
Dawid Niedzwiecki
3d372c048a drivers: flash: stm32h7: add support for blocking registers
Add support for blocking flash control registers and option bytes for
STM32H7 chips.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2025-02-06 14:45:06 +01:00
Dawid Niedzwiecki
def973f5b9 drivers: flash: stm32h7: add support for write protection
Add support for setting flash write protection per sector for STM32H7x
chips.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2025-02-06 14:45:06 +01:00
Dawid Niedzwiecki
4c6b097df3 drivers: flash: stm32h7: change place of memory barrier
Move the memory barrier to a function that commits option bytes.

This way the barrier doesn't have to be added before every call of the
commit_optb function.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2025-02-06 14:45:06 +01:00
Dawid Niedzwiecki
52f45b91a4 drivers: flash: stm32h7: change return value of write_opt
Change the return value of the write_opt function. If returns 0 if a
change of option bytes was not needed.

It gives callers of the function an information a commit of the option
bytes is needed.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2025-02-06 14:45:06 +01:00
Kamil Krzyzanowski
6065ddb3b5 drivers: flash: spi_nor: make wait_until_ready erase delay configurable
The erase time varies between different SPI NOR flash chips.
Some have typical erase times in the 20-25ms range, at which point the
default 50ms poll interval means we get half the possible erase speed.
With slower memory, or larger erases, 50ms might not be a lot, but for
block erases, if we are unlucky we may end up polling just as the it's
about to finish erasing, and have to wait another poll interval.

Signed-off-by: Kamil Krzyzanowski <kamnxt@kamnxt.com>
2025-02-06 10:42:06 +01:00
Khaoula Bidani
fa2a3c39ff drivers : flash: replace dt_nodelabel_has_prop()in xspi
Replace dt_nodelabel_has_prop() with
dt_compat_any_has_prop() in Kconfig.stm32_xspi

Signed-off-by: Khaoula Bidani <khaoula.bidani-ext@st.com>
2025-02-04 15:01:13 +01:00
Khaoula Bidani
cd004dd84f drivers : flash: replace dt_nodelabel_has_prop()in qspi
Replace dt_nodelabel_has_prop() with
dt_compat_any_has_prop() in Kconfig.stm32_qspi

Signed-off-by: Khaoula Bidani <khaoula.bidani-ext@st.com>
2025-02-04 15:01:13 +01:00