Add SOC_ESP32_APPCPU_TARGET, a hidden symbol set whenever the
build targets the APPCPU image of a dual-core SoC. Replace all
places that checked SOC_ESP32_APPCPU and SOC_ESP32S3_APPCPU
together with the new symbol.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
Header file include/zephyr/sys_clock.h is deprecated and will be removed
someday. Update the whole file tree to include zephyr/sys/clock.h
straight instead of zephyr/sys_clock.h.
This change was made running the sed shell command below:
$ sed -i 's/zephyr\/sys_clock\.h/zephyr\/sys\/clock\.h/' \
`grep -rsl "zephyr/sys_clock\.h" drivers/`
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
The dual-bank error check read SR2 but tested the bank1 ECC error
flags, so bank2 ECC errors were reported based on bank1 bits. Use
the bank2 flags like the rest of the bank2 block.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The RRAM driver was allowing unaligned operations for erase
and write because the underlying PDL driver would correct the
operation doing read-modify-write. Rather than relying on the
lower level implementation to correct the alignements and due
to the fact that the flash apis specifically state that alignment
must be checked, added the check and returned error for
unaligned operations.
Signed-off-by: Laura Carlesso <laura.carlesso@infineon.com>
cadence_nand_read_page() allocates main and spare buffers before
submitting the read-page command. Free both buffers on every exit path so
repeated reads do not leak host memory.
Signed-off-by: Old Ding <ai.neo.ae86@gmail.com>
Previously, flash parameters (size, erase/write block size) were
hardcoded for internal flash only.
Introduce struct flash_info and update_flash_info() to dynamically
resolve flash parameters based on the active flash target (internal,
external CS0/CS1).
Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
Implement soc_secure_mem_read for flash driver to read secure memory,
access to the range of secure memory from non secure side should be
governed by tfm_platform allow list, implementation aligns to nrf_rram
driver secure memory read.
Signed-off-by: Travis Lam <travis.lam@nordicsemi.no>
Use flag_access_32bit from device data to select
MXC_SPIXF_Set4ByteAddr() or MXC_SPIXF_Set3ByteAddr() accordingly.
Signed-off-by: Benjamin Santon <benjamin.santon@analog.com>
flash_si32_valid_range() returns bool, but the write alignment
checks returned -EINVAL, which converts to true and marks
misaligned writes as valid. An odd size then made the write loop
read one byte past the source buffer. Return false as the other
checks do.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The driver hardcodes DT_NODELABEL(cpuapp_mram) which does not exist
when building for cpuflpr since the node is deleted in the cpuflpr
dtsi. Use DT_INST(0, soc_nv_flash) to resolve whichever soc-nv-flash
child is present under the controller, matching the RRAM driver.
Signed-off-by: Dhanoo Surasarang <dhanoo.surasarang@nordicsemi.no>
XIP in Zephyr is a software configuration concept (CONFIG_XIP). The MSPI
feature gated by MSPI_XIP only memory-maps the device into the SoC
address space; the mapped region can be used for plain data access as
well as code execution. Rename the feature to MEMMAP to reflect what it
actually does:
- CONFIG_MSPI_XIP -> CONFIG_MSPI_MEMMAP
- CONFIG_FLASH_MSPI_XIP_READ -> CONFIG_FLASH_MSPI_MEMMAP_READ
- struct mspi_xip_cfg -> struct mspi_memmap_cfg
- enum mspi_xip_permit / MSPI_XIP_READ_* -> mspi_memmap_permit /
MSPI_MEMMAP_READ_*
- mspi_xip_config() -> mspi_memmap_config(), driver API entry
xip_config -> memmap_config
- MSPI_XIP_CONFIG_DT{,_INST,_NO_CHECK} -> MSPI_MEMMAP_CONFIG_DT{,...}
- MSPI_XIP_CFG_STRUCT_DECLARE / MSPI_XIP_BASE_ADDR_{DECLARE,INIT} ->
MSPI_MEMMAP_*
- devicetree property xip-config -> memmap-config
Vendor HAL symbols (am_hal_mspi_xip_*) and DesignWare register names,
where XIP is the hardware documentation terminology, are unchanged.
The MSPI API is experimental, so no deprecated aliases are provided;
a migration guide entry is added in a separate commit. Add missing
Doxygen comments on new API symbols. Add missing SPDX header to the
nrf54h20dk code_relocation_nocopy overlay touched by this rename.
Fixes#104657
Signed-off-by: Richard Wheatley <richard.wheatley@ambiq.com>
In ramcode_flash_cmd_read_status, the status polling loop continuously
reads SMFI_ECINDDR in RAM without any delay cycles. During flash erase
operations, tight polling can cause bus contention or premature register
evaluation on fast silicon and at higher compiler optimization levels,
resulting in intermittent erase failures (rc=-2).
Add a small delay loop inside the status polling loop to throttle
register reads.
Tested on board with it8xxx2 EC.
Signed-off-by: Keith Short <keithshort@google.com>
Previously, the MRAMC uses the NRFX driver which
used the INFO.MRAM register to get the size of
the MRAM. In other parts of the driver, the size
is taken from the devicetree. Also, if running tf-m
the size would be taken from the devicetree. This
commit ensures there's only 1 source of truth so
we only ever use the devicetree. This will also
allow the user to select a smaller MRAM size if
they wanted.
Signed-off-by: David Jewsbury <david.jewsbury@nordicsemi.no>
Add a basic flash driver for intel pflash. This flash implements a CFI
interface, and is available as "pflash" within QEMU targets.
Assisted-by: Claude:Haiku 4.5
Signed-off-by: Daniel DeGrasse <daniel.degrasse@analog.com>
The syscall handler functions forward parameters with identical casts
that are redundant since the variables already have those types. Drop
the casts to let the compiler type-check the arguments unobstructed.
Signed-off-by: Flavio Ceolin <flavio@hubble.com>
Rename CONFIG_STM32_MEMMAP to CONFIG_FLASH_STM32_NOR_MEMMAP for clarity
since it only concerns STM32 Flash drivers.
Same change is applied on MCUboot side upstream.
Signed-off-by: Abderrahmane JARMOUNI <git@jarmouni.me>
Enable the GPIO subsystem when reset-gpios are used on any STM32 QSPI,
OSPI or XSPI flash node and the corresponding driver is enabled.
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
This is useful to reduce the size of mcuboot builds, so it can fit into the
16K bootloader flash area outside of the main flash, which many Silabs SoCs
have.
Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
Use LINKER_DT_NODE_REGION_NAME_TOKEN() when assigning the flash simulator
backing array section.
Using LINKER_DT_NODE_REGION_NAME() passes a quoted string into
Z_GENERIC_SECTION(), which produces a literal section named "FlashSim"
instead of FlashSim. The linker memory-region section matcher expects the
token form, so the array was not placed in the configured RAM region.
This is needed to be able to build with zephyr/llvm on some platforms.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Use legacy method to get the SOC flash node for the rv32m1 flash driver,
because users of this flash driver define multiple child nodes with the
soc-nv-flash compatible. This prevents use of the
SOC_NV_FLASH_CHILD_NODE helper macro, which relies on one compatible
with the child being present.
Signed-off-by: Daniel DeGrasse <daniel.degrasse@analog.com>
Many drivers in tree use a similar pattern to find their child node with
the compatible "soc-nv-flash". Rather than continuing to duplicate this
logic, define a common handler that is instance based in the flash_priv
header file, and include this from each flash driver.
Assisted-by: Claude: claude-opus-4-6
Signed-off-by: Daniel DeGrasse <daniel.degrasse@analog.com>
The flash_controller node is defined using the non secure
alias regster. Add a macro to switch between the secure
and non secure one correctly.
Also properly call the serial_memory_setup function to
init the object.
Signed-off-by: Laura Carlesso <laura.carlesso@infineon.com>
The compat string is updated in device drivers to align with
changes in binding files.
Added depends on $(dt_compat_on_bus,$(DT_COMPAT_[DEVICE]),mspi)
to device Kconfig.
Signed-off-by: Swift Tian <swift.tian@ambiq.com>
Switch from a binary semaphore to a mutex with priority inheritance.
Write in chunks (~128 B) so ISRs can run between chunks. Add per-operation
retry logic (up to 3 attempts) to handle transient voltage drops. Add cache
invalidation after write/erase on SoCs with D-cache. Extend HAL dispatch
to cover Apollo2x/3x (am_hal_flash), Apollo4x, and Apollo5x (MRAM).
Signed-off-by: Richard Wheatley <richard.wheatley@ambiq.com>
Correct serial memory qspi init to skip serial memory setup
when not explicitly needed, to avoid SMIF init in XIP mode.
The full fix for this issue will be finalized with issue 112066.
Signed-off-by: Laura Carlesso <laura.carlesso@infineon.com>
Signed-off-by: Davide Di Lello <Davide.Dilello@Infineon.com>
Use <> operator to include a Zephyr header file instead of "" that
is intended to local header files, not header files relative to
specifically defined search paths.
This change was made running the sed shell command below:
$ sed -i -E 's/#include "zephyr\/([^"]+)\.h"/#include <zephyr\/\1.h>/g' \
`grep -rsl "#include \"zephyr/" drivers/`
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Remove `select FLASH_PAGE_LAYOUT` from any flash drivers doing so, as
this is an option to enable an API into the flash driver, not something
the flash driver itself needs.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Move the configure/de-configure pair from rram_write() up to nrf_write(),
where SYNC_LOCK guarantees exclusive access for the duration of the
whole API call. The hardware write mode is then programmed exactly
once per flash_write()/flash_erase() in the standalone (non-radio-sync)
path, regardless of how many chunks the throttling loop produces.
Behaviour for non-secure (TF-M) builds is unchanged: RRAMC config is
still programmed by TF-M at boot and never touched here.
Signed-off-by: Jakub Zymelka <jakub.zymelka@nordicsemi.no>
When CONFIG_SOC_FLASH_NRF_THROTTLING is enabled, the chunking loop in
rram_write() unconditionally advances the source pointer by chunk_len
at the end of every iteration. This turns the originally-NULL pointer
into chunk_len, then 2*chunk_len, ... by the start of subsequent
iterations.
The bug only triggers when:
- CONFIG_SOC_FLASH_NRF_THROTTLING=y
- the erase length is greater than
CONFIG_NRF_RRAM_THROTTLING_DATA_BLOCK * 16 (default 256 B)
Guard the data pointer advance with an explicit data != NULL check so
the erase emulation path stays on the memset() branch for every
chunk.
Signed-off-by: Jakub Zymelka <jakub.zymelka@nordicsemi.no>
When CONFIG_SOC_FLASH_NRF_THROTTLING is enabled, the inner chunking
loop in rram_write() decrements `len` to 0 and advances `addr` past
the end of the user buffer. The commit_changes() call that follows
then always sees `len == 0`, so the modulo-WRITE_BUFFER_MAX_SIZE
check at the top of commit_changes() returns early and the explicit
NRF_RRAMC_TASK_COMMIT_WRITEBUF is never triggered.
For sub-buffer writes (e.g. flash_write of 32 B with a 512 B buffer)
the partially-filled write buffer is then only flushed by the
READYNEXTTIMEOUT auto-commit (~4 us), which means data is not yet in
physical RRAM when the API returns. That breaks callers that rely on
write persistence on return.
Capture the original `addr` and `len` once before the throttling loop
mutates them and pass those values to commit_changes(), matching the
behaviour the non-throttled path always had.
Signed-off-by: Jakub Zymelka <jakub.zymelka@nordicsemi.no>
Add support for LPC84x IAP Flash driver to soc_flash_lpc84x_iap.c
Signed-off-by: Dilip Raman <dilipr@aerlync.com>
Signed-off-by: Sayooj K Karun <sayooj@aerlync.com>
Add a bad block cache by keeping a bad block table in memory.
This will speed up bad block checking at the cost of slightly
increased memory usage of 1 bit per erase block.
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
Add explicit JEDEC handling for the ISSI IS25LP512M. Configure the
FlexSPI LUT for 4-byte Quad I/O reads plus 4-byte page program, sector
erase, and block erase commands.
The IS25LP512M uses nonvolatile SR1 bit 6 as the QE bit, so enable quad
mode with the existing S1B6 helper before using the 1-4-4 read path.
Hardware was verified by clearing SR1 QE from 0x40 to 0x00, setting it
back to 0x40, and passing quad erase/program/readback.
Fixes#111686
Signed-off-by: Eli Hughes <eli.hughes@nxp.com>
This is a follow-up to commit d7d1a64e27.
The above commit added `MSPI_DEVICE_CONFIG_IO_MODE` to `XIP_DEV_CFG_MASK`,
but in consequence it removed that bit from `NON_XIP_DEV_CFG_MASK` since
the latter is defined with `& ~XIP_DEV_CFG_MASK`. And that bit must be
present in `NON_XIP_DEV_CFG_MASK`, otherwise the driver will not configure
IO mode as expected in `switch_to_target_io_mode()` and `_acquire()`.
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
This reverts commit 97bfea46a0.
Contrary to what the above commit description says, the change it brings
does not in fact cause IO mode to be switched in the MSPI controller.
That is because `switch_to_target_io_mode()` uses `NON_XIP_DEV_CFG_MASK`
in its call to `mspi_dev_config()` and after recent changes (see commit
d7d1a64e27) that mask does not actually
include the `MSPI_DEVICE_CONFIG_IO_MODE` bit.
Revert the commit as it unnecessarily doubles the operations related to
switching the flash chip to desired IO mode (like the `post_switch_mode`
quirk), without fixing the actual problem with IO mode incorrectly set
in the MSPI controller.
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
Add nor flash drivers for Realtek Bee family SoCs (RTL8752H and RTL87x2G).
Supports read, write, erase operations with page layout support.
Signed-off-by: Zhiyuan Tang <zhiyuan_tang@realsil.com.cn>
The XSPI_NOR_STM32_INIT macro initialized the jedec_id field
unconditionally when the DT node has a jedec-id property, but
the field in flash_stm32_xspi_data is only declared when
CONFIG_FLASH_JESD216_API is enabled. Guard the initialization
accordingly to fix build failures when jedec-id is present in
DT but CONFIG_FLASH_JESD216_API is not set.
Signed-off-by: Filip Stojanovic <filipembedded@gmail.com>
Handle necessary code relocation better,
clearly delimiting what is required and what is not
Also group RAM together
Signed-off-by: Camille BAUD <mail@massdriver.space>
BFLB flash driver is updated:
- Add support for bank 2
- Add support for SFDP
- Add ability to use writable devices (MRAM, PSRAM, FRAM) via bank2 mapping
- Improve overall organization
- Add QPI and continous read support
Signed-off-by: Camille BAUD <mail@massdriver.space>
Correct FLASH_STM32_EX_OP_OPTB_WRITE private flash operation for
stm32 internal flash drivers when unlocking or locking option bytes
fails. flash_stm32_option_bytes_lock() returns non-zero negative error
when so, not a positive error, fix flash_stm32_ex_op() accordingly,
using a comparison against zero, for consistency with other
calls to flash_stm32_option_bytes_lock().
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>