So far the driver first changed the configuration of the flash chip
and after that checked the signature of that chip. This could lead
to improper change of the chip configuration if the actually found
one was different than that specified in devicetree.
This commit reverses the order of these two initialization steps and
also restructures a bit the initialization code.
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
After integration of nrfx 3.2.0, it is no longer needed to deinitialize
the nrfx_qspi driver to avoid increased power consumption when the QSPI
peripheral is idle. Now it is enough to call `nrfx_qspi_dectivate()`
when a given operation is done. The driver will automatically activate
the QSPI peripheral again when a next operation is requested.
This commit applies the following changes:
- `qspi_device_init` and `qspi_device_uninit` functions are replaced
by `qspi_acquire` and `qspi_release`, respectively; those handle
exclusive access to the QSPI peripheral and deactivation of it or
runtime device power management
- locking is removed from `qspi_send_cmd` as it is the resposibility
of the caller of that function
- `trans_lock` and `trans_unlock` functions are removed together with
the related semaphore as they are no longer needed
- checking of input parameters is moved from `qspi_erase` to its
caller, `qspi_nor_erase`
- `qspi_nor_pm_action` is refactored to properly handle locking of
the QSPI peripheral; checking of the `xip_enabled` flag is removed
from that function as now the call to `pm_device_is_busy()` covers
that (when XIP is enabled, the device is kept indicated as busy)
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
Consistently use `res` for results of calls to nrfx functions
and `rc` for Zephyr return codes, to avoid mixing up those two
and for example calling `qspi_get_zephyr_ret_code()` for a value
that is already a Zephyr return code. Correct also such call in
`qspi_nor_write()`.
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
After entering the Deep Power-down mode, some flash chips ignore all
commands except from the one that releases the chip from the DP mode
and it is not possible to successfully read their Status Register then.
Since the QSPI peripheral tries to read this register when it is being
activated, it consequently fails to send the actual command that would
release the flash chip from the DP mode if that is to be done right
after QSPI initialization.
Prevent this problem by performing the QSPI activation with all pins
disconnected. This causes that the Status Register value is read as
all zeros and allows the activation to always finish successfully,
and the RDPD command to be properly sent.
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
Do not enable subsystem/driver shell modules by default and stop abusing
CONFIG_SHELL_MINIMAL, which is internal to the shell subsystem, to decide
when to enable a driver shell.
The list of shell modules has grown considerably through the
years. Enabling CONFIG_SHELL for doing e.g. an interactive debug session
leads to a large number of shell modules also being enabled unless
explicitly disabled, which again leads to non-negligible increases in
RAM/ROM usage.
This commit attempts to establish a policy of subsystem/driver shell
modules being disabled by default, requiring the user/application to
explicitly enable only those needed.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
This CL is to minimize `CONFIG_SOC_SERIES_XXXX` definitions when we
introduce a new chip series. Most of them are relevant to register
layouts in different npcx soc series. It moves soc-specific register
definitions from `reg_def.h` to its own soc.h file.
Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
Care must be taken to avoid any flash access while programming the flash
attached to the FlexSPI either via executing XIP code or reading RO data.
Remove locations where a constant device pointer might be dereferenced
within the mcux_flexspi_nor driver, to help avoid RWW hazards.
Fixes#64702
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
The way that the QSPI peripheral is activated has been changed in
nrfx 3.2.0. Now the peripheral is not activated during the driver
initialization. Instead, the driver activates the peripheral when
the first operation is requested or when `nrfx_qspi_activate()` is
called. In case of XIP, the latter needs to be used, as there may
be no standard operation request.
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
Fix the SFDP command to be sent by the qspi driver
to get the SFDP table from the NOR quad flash.
Note that CONFIG_FLASH_STM32_QSPI=y and CONFIG_SPI_NOR=n
HAL_DMA_Abort declared as weak to fix compilation error with stm32f7x
Signed-off-by: Francois Ramu <francois.ramu@st.com>
Move the syscall_handler.h header, used internally only to a dedicated
internal folder that should not be used outside of Zephyr.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
In the CONFIG_SPI_NOR_SFDP_MINIMAL configuration this value is hard
coded to 256 bytes. Make it configurable via devicetree.
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
changes enable flash driver to provide api interface to send reset memory
spi command to the spi flash. The reset memory command would bring the
spi flash to its default power-on state and loose all the volatile register
settings.
Flash reset is needed when more than one controller access the flash chip
in a shared mode.
Signed-off-by: Deepti Deshatty <deepti.deshatty@intel.corp-partner.google.com>
Because shadow variable warning is turned on, a warning was thrown and
could fail some twister tests that don't use the -W option. This commit
gets rid of the warning.
Signed-off-by: David Corbeil <david.corbeil@dynon.com>
Replace Nuvoton NPCX series definitions with new Kconfig definitions in
the npcx drivers. The benefit of this approach is that we won't touch
the npcx driver sources again during introducing a new npcx series next
time.
Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
Update interface of memc flexspi driver to better handle multiple
devices. Previously, using multiple devices on one FlexSPI bus would
require the user to configure each device to install its command table
(referred to as a LUT table by the driver) at an offset, so that it did
not overlap with other devices on the bus.
This commit changes the interface of the memc flexspi driver to instead
configure the LUT and flash device in one call. This allows the memc
driver to record the port each LUT sequence is used with, so that
future FlexSPI transfer requests can have their LUT offsets adjusted
based on the target port (which will correspond to a target device)
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
rand32.h does not make much sense, since the random subsystem
provides more APIs than just getting a random 32 bits value.
Rename it to random.h and get consistently with other
subsystems.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Per the MX25UM51325G datasheet, all page programs in OPI DTR mode need to
start at an even address, and be of even length. Update the minimum
write size reported by the driver and check all writes when OPI DTR mode
is enabled, so that subsystems using the flash driver can align to this
requirement.
Fixes#63639
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
Adjusted the prompt of the load command to make it more obvious that
the user is being prompted for keyboard input.
Signed-off-by: Kelly Helmut Lord <helmut@helmutlord.com>
Add "st,stm32-flash-controller" as compatible for STM32H7 so that
what is defined for STM32 in general is also defined for STM32H7.
Already most of the other STM32 versions have this addition.
Also removed the specific STM32H7 flag check in
/flash/driver/Kconfig.stm32.
Signed-off-by: Stefan Petersen <spe@ciellt.se>
Drivers for nRF SoCs using pinctrl did not select PINCTRL. This means
boards are forced to enable PINCTRL.
Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
Manufacturer id is skipped when reading jedec_id, due to wrong
address mode.
Before: flash_stm32_ospi: Jedec ID = [60 20 00]
After: flash_stm32_ospi: Jedec ID = [ef 60 20]
Signed-off-by: Brian Juel Folkmann <bju@trackunit.com>
Adds support for forcing XIP support at boot time, and reduces the
init priority of the driver so that it inits earlier.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Fix compilation error on variable used for size of array in
OSPI and QSPI drivers.
Fixes#61804
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Fix a few issues with the reset-gpio functionality in spi_nor, missing
header, missing semicolon, unnecessary and not working condition on a
struct field that is not a pointer.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Move workaround methods for npcx series to soc init functions. If
there's no workaround for this series, drop its soc.c file directly.
Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
This CL introduces new Flash Interface Unit (FIU) hardware in npcx4
series. The different operations of npcx9 and npcx4 FIU include:
1. 4-byte mode support for DRA mode move to SPI_DEV reg
2. To access the second flash in DRA mode, we need to configure
SPI_DEV_SEL field in BURST_CFG additionally.
Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
Due to source data pointer having no alignment constraint,
extra care needs to be taken when reading source data
as dword
Signed-off-by: Tomislav Milkovic <tomislav.milkovic95@gmail.com>
Commit slters z_impl_nrf_qspi_nor_xip_enable to not call
qspi_device_init in case when xip_enabled has the same value
as requested.
In case when qspi_device_init returns non-zero no further actions
are taken and xip_enabled will not be to set requested value.
Fixes#59535.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Removed single offset alignment check mechanism and replaced it with
offset alignment check for each iteration
Signed-off-by: Madhurima Paruchuri <mparuchuri@google.com>