Commit graph

1230 commits

Author SHA1 Message Date
Khaoula Bidani
0c9c6014fa drivers : flash: replace dt_nodelabel_has_prop()
Replace dt_nodelabel_has_prop() with
dt_compat_any_has_prop() in Kconfig.stm32_ospi

Signed-off-by: Khaoula Bidani <khaoula.bidani-ext@st.com>
2025-02-04 15:01:13 +01:00
Stoyan Bogdanov
77d071da24 drivers: flash: Add support for cc23x0 flash
Add support for flash to cc23x0 SoC. The driver interacts with VIMS
(Versatile Instruction Memory System) internal bus standing before NVM.

Signed-off-by: Stoyan Bogdanov <sbogdanov@baylibre.com>
Signed-off-by: Julien Panis <jpanis@baylibre.com>
2025-02-04 11:56:05 +01:00
Ofir Shemesh
80e42f288b drivers: flash: flash_mcux_flexspi_nor: Add validation checks
Added area_is_subregion() to validate offset and size within bounds.
Ensured read, write, and erase operations check for valid memory regions.
Added null buffer check in read and write functions to prevent errors.

Signed-off-by: Ofir Shemesh <ofirshemesh777@gmail.com>
2025-02-03 11:18:11 +01:00
Fabio Baltieri
54564d15a7 flash_shell: add shell device filtering
Add shell device filtering using DEVICE_API_IS.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-01-29 04:17:47 +01:00
Dawid Niedzwiecki
8c97ba8017 drivers: flash: stm32h7: ensure option bytes write
Make sure to submit a change of option bytes and wait for the end of
the operation. It is done by checking the OPT_BUSY bit.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2025-01-27 13:25:43 +01:00
Dawid Niedzwiecki
f205b57174 drivers: flash: stm32h7: use a correct register to program RDP
The RDP level is set with the FLASH_OPTSR_PRG register and read with the
FLASH_OPTSR_CUR register, not FLASH_OPTCR.

Fix that to realy change and read RDP.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2025-01-27 13:25:43 +01:00
Cong Nguyen Huu
fd620c3ef9 drivers: flash: add NXP S32 QSPI HyperFlash driver
Add support HyperFlash memory devices on a NXP S32 QSPI bus.
This driver uses a fixed LUT configuration that defined in HAL RTD
HyperFlash driver.
Driver allows to read, write and erase HyperFlash devices.

Signed-off-by: Cong Nguyen Huu <cong.nguyenhuu@nxp.com>
2025-01-21 19:26:45 +01:00
Cong Nguyen Huu
f0c4d1c53c drivers: flash_nxp_s32: create common source code
Create common source code to use for supporting HyperFlash.

Rename 'FLASH_NXP_S32_QSPI_NOR_SFDP_RUNTIME' to
'FLASH_NXP_S32_QSPI_SFDP_RUNTIME' as a common kconfig.

Add the 'max-program-buffer-size' property to use for
setting memory pageSize, instead of using
'CONFIG_FLASH_NXP_S32_QSPI_LAYOUT_PAGE_SIZE' for setting.

Add the 'write-block-size' propertyto use for setting
the number of bytes used in write operations, it also
uses to instead of the 'memory-alignment' property.

Signed-off-by: Cong Nguyen Huu <cong.nguyenhuu@nxp.com>
2025-01-21 19:26:45 +01:00
Keith Short
846dc3f880 drivers: flash: npcx: Fix compile error
Remove the #ifdef guard around a function prototype.  This was causing a
compile error when CONFIG_FLASH_NPCX_FIU_DRA_V2 was disabled.

Signed-off-by: Keith Short <keithshort@google.com>
2025-01-15 23:05:23 +01:00
Tom Chang
5c62097bda drivers: flash: npcx: add setting of low flash device
This commit adds functions to select the low flash device and set the
size of the low flash device.

Signed-off-by: Tom Chang <CHChang19@nuvoton.com>
2025-01-14 17:57:50 +01:00
Georgij Cernysiov
db28dbd888 drivers: flash: stm32 xspi: early init exit for memmap mode
Exit the init earlier when XSPI is in memory map mode. Avoid
unnecessary checks and prevent pin reconfiguration that might
cause line spikes. Clock check beforehand is preserved.

Remove '\n' from the LOG_DBG string.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2025-01-10 21:07:51 +01:00
Georgij Cernysiov
9040dee5ef drivers: flash: stm32 ospi: early init exit for memmap mode
Exit the init earlier when OSPI is in memory map mode. Avoid
unnecessary checks and prevent pin reconfiguration that might
cause line spikes. Clock check beforehand is preserved.

Remove '\n' from the LOG_DBG string.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2025-01-10 21:07:51 +01:00
Khoa Nguyen
1275058979 drivers: flash: update source code Flash driver for Renesas RA
- Bring macro defined of RA8 in flash_hp_ra.h to device tree
- Change to use irq_lock instead of semaphore for code flash
- Modify and add conditions to check and make decision to perform
action at last block.

Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
Signed-off-by: Tran Van Quy <quy.tran.pz@renesas.com>
2025-01-08 17:02:36 +01:00
Jordan Yates
a5643a4664 flash: stm32l4/g4: force load option bytes after write
After writing option bytes, force them to be loaded. Failing to perform
this step means the values are never applied and not actually written
to non-volatile memory.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-01-08 01:29:53 +01:00
Dawid Niedzwiecki
8aa4aa7edf drivers: flash: stm32h7: do not unlock CR at the end of init
Do not unlock CR at the end of initialization.

The lock mechanism is to protect unwanted registers modifications due to
software bugs. There is no point in leaving the registers unlock once
the driver is initialized.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2025-01-06 22:36:28 +01:00
Derek Snell
88b9cb6efc drivers: flash: soc_flash_mcux: remove CMD_MARGIN_CHECK
The CMD_BLANK_CHECK can return errors when the flash is readable, and
should only be used after programming, not in is_area_readable().  From
the LPC55S69 datasheet: "As cells age and lose charge, a correctly
programmed address will fail this check, while still being able to be
read successfully for the remaining duration of the data retention time."

Signed-off-by: Derek Snell <derek.snell@nxp.com>
2025-01-06 17:13:49 +00:00
Dawid Niedzwiecki
be5d44eb7e drivers: flash: stm32: update ex_op API
Use uint64_t instead of uint32_t for the FLASH_STM32_EX_OP_SECTOR_WP
extended operation.

Some chips have two banks, more than 16 sectors each e.g. stm32h7a3xx
chips, so more than 32 bits are required.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2024-12-24 13:54:04 +01:00
Martin Stumpf
857e5793f1 drivers: flash: flexspi: Fix XIP during flash write
XIP prefetching seems to still be running, even while interrupts are
disabled. Therefore it is important to wait for the FlexSPI to be idle
before performing a write/erase operation.

Signed-off-by: Martin Stumpf <martin.stumpf@vected.de>
2024-12-23 18:41:28 +01:00
Dominik Ermel
486428951b drivers/flash: Correct flash_erase userspace handler
As the erase callback is optional, handler should not check
if it is not NULL.

Fixes #81777

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-12-19 19:55:53 +01:00
Andrzej Puzdrowski
2cea407afb drivers/flash/Kconfig.nrf_rram: bufferd write by default
Enable buffered write for nRF54l RRAM flash driver by default.
CONFIG_NRF_RRAM_WRITE_BUFFER_SIZE=1 means that write will be buffered
by 16 B buffer (native RRAM write-bock-size).
This allows optimal life-endurance of RRAM memory.

For reference" DTS declares 16 write-block-size already.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2024-12-19 17:38:12 +01:00
Francois Ramu
2000ae6ac9 drivers: flash: stm32 flash register name for the stm32h7RS serie
Adapt the stm32 flash driver for the stm32h7rs serie where some
bit of the FLASH registers are named differently from stm32h7 serie.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2024-12-19 12:37:44 +01:00
Jun Lin
6064a1cf21 driver: flash: npcx: use CONFIG_FLASH_LOG_LEVEL
This commit replaces the hard-coded log level with CONFIG_FLASH_LOG_LEVEL.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2024-12-19 04:18:34 +01:00
Fin Maaß
4b366384fa drivers: flash: spi_nor: use existing DT macros
use existing DT macros for `ANY_INST_HAS..` defines.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-12-18 22:11:20 +01:00
Yishai Jaffe
1b4cef325b shell: use shell_device_get_binding
Use shell_device_get_binding() instead of device_get_binding() so that
we get the device based on its name and in addition by its label.

Signed-off-by: Yishai Jaffe <yishai1999@gmail.com>
2024-12-18 15:32:10 +01:00
Francois Ramu
424c187e2a drivers: flash: stm32wba flash driver moves sem functions
When the CONFIG_BT_STM32WBA the stm32wba_fm flash driver is compiled
and must takes flash_stm32_sem_take/give functions from the
flash_stm32.h header file, like other stm32 series.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2024-12-17 11:37:14 +00:00
Fabio Baltieri
5b92e7af0e drivers: flash: stm32: add STM32 option bytes extended ops
Add two new flash extended operations for reading and writing STM32
option bytes from the application code.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-12-17 11:35:13 +00:00
Martin Stumpf
a9bdaf428a drivers: flash: flexspi: Add 4-byte addressing support for MT25 family
Currently, MT25 flashes were running in 3-byte mode.
This is not compatible with the chip we use in our project (MT25QU01GBBB),
as only 128 Mbit of its 1 Gbit can be addressed.

Signed-off-by: Martin Stumpf <finomnis@gmail.com>
2024-12-16 08:35:23 +01:00
Dominik Ermel
63d5ba4e89 drivers/flash: Fix z_vrfy_flash_handler
Wrong write size has been given.

Fixes #81910
Coverity CID: 434734

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-12-12 18:39:15 +01:00
Francois Ramu
3696ee06e5 drivers: flash: stm32h7 with RDP protection
Implement the readout protection for the STM32H7 series.
Define the specific functions used by the flash_stm32h7.
Move the stm32h7 flash register manipulation in a write_optb()
to be called by the flash_stm32_set_rdp_level.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2024-12-09 15:12:04 +01:00
Francois Ramu
a8da57471f drivers: flash: stm32 flash ex op functions are common
Move the stm32 flash driver ex_op functions to common
flash_stm32_ex_op.c file.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2024-12-09 15:12:04 +01:00
Francois Ramu
3e166bc209 drivers: flash: stm32 driver move sem functions for multithread
Place the flash_stm32_sem_take and flash_stm32_sem_give
function to header file for common to use in any flash driver

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2024-12-09 15:12:04 +01:00
Daniel DeGrasse
c12030acb9 drivers: flash: flash_mcux_flexspi_nor: check all 3 bytes of JEDEC ID
The FlexSPI NOR driver should verify all 3 bytes of the JEDEC ID match
the expected value before attempting to use a custom LUT table with a
flash chip. This reduces the odds that an incompatible LUT will be used
with a flash chip, as some flash chips may share the same first byte of
their device ID but not be compatible with the custom LUT table.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2024-12-06 22:22:06 +01:00
Dominik Ermel
5518bb46e6 drivers/flash/flexspi_x25um51345g: Fix broken support for get_size
Fix incorrectly implemented flash_get_size callback.

Fixes #82364

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-12-05 22:08:26 +01:00
Fin Maaß
007350a9c9 drivers: flash: spi_nor: use defines for 4byte identifiers
use defines for 4byte identifiers.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-12-03 13:06:41 +01:00
Fin Maaß
ba18d41804 drivers: flash: spi_nor: fix 4byte opcodes
the check for both bit should be in the first DWORD.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-12-03 13:06:41 +01:00
Pieter De Gendt
9dd07da0a1 drivers: flash: Place API into iterable section
Add wrapper DEVICE_API macro to all flash_driver_api instances.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-12-02 22:08:48 +00:00
Dominik Ermel
eb4f2fb44a drivers/flash/nrf_rram: Add get_size implementation.
Commit adds flash_get_size callback to the driver.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-11-23 15:30:10 +01:00
Dominik Ermel
383bcc790c drivers/flash/soc_flash_nrf_mram: Add get_size implementation
Commit adds flash_get_size callback to the driver.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-11-23 15:30:10 +01:00
Dominik Ermel
a6ef37ca8e drivers/flash/spi_nor: Add flash_get_size API call
The commit adds implementation of flash_get_size.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-11-23 15:30:10 +01:00
Dominik Ermel
b4a9f1d67a drivers/flash/flash_sam: Add flash_get_size API call
The commit adds implementation of flash_get_size.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-11-23 15:30:10 +01:00
Dominik Ermel
6efba38e97 drivers/flash/flexspi_x25um51345g: Add flash_get_size API call
The commit adds implementation of flash_get_size.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-11-23 15:30:10 +01:00
Dominik Ermel
9a162e0b79 drivers/flash/flexspi_nor: Add flash_get_size API call
The commit adds implementation of flash_get_size.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-11-23 15:30:10 +01:00
Dominik Ermel
6a06c10f3f drivers/flash/gecko: Add flash_get_size API call
The commit adds implementation of flash_get_size.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-11-23 15:30:10 +01:00
Dominik Ermel
31dcaa2611 drivers/flash/stm32_qspi: Add flash_get_size
The commit adds implementation of flash_get_size.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-11-23 15:30:10 +01:00
Dominik Ermel
f39940b86c drivers/flash/at45: Add flash_get_size API call
The commit adds implementation of flash_get_size to the flash driver.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-11-23 15:30:10 +01:00
Dominik Ermel
8acf0a1ecf drivers/flash/nrf_qspi_nor: Add flash_get_size API call
The commit adds implementation of get_size.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-11-23 15:30:10 +01:00
Dominik Ermel
b0584b7d08 drivers/flash/nrf: Add flash_get_size API call
The commit adds implementation of flash_get_size.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-11-23 15:30:10 +01:00
Dominik Ermel
6298fed7d4 drivers/flash/flash_simulator: Add flash get_page_size API call
The commit adds implementation of flash_get_size,

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-11-23 15:30:10 +01:00
Dominik Ermel
13fa2331da drivers/flash: Flash API: device size getter
The commit adds flash_get_size  API functions.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-11-23 15:30:10 +01:00
Fin Maaß
cf4a398477 drivers: flash: spi_nor: add option for 4byte opcodes
some flashes support special opcodes
for 4-byte addressing, that can be used
without switching to 4-byte mode.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-11-18 13:18:08 -05:00