Commit graph

1299 commits

Author SHA1 Message Date
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
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