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 a GPIO expander driver for the Raspberry Pi BCM283x, using
the VideoCore firmware property interface.
Signed-off-by: Muhammad Waleed Badar <walid.badar@gmail.com>
Add support for output open drain mode which is used by the tests in
`tests/drivers/gpio/gpio_basic_api/`.
While there, switch some magic numbers to the corresponding HAL
defines and be stricter on invalid or unsupported configurations.
Signed-off-by: Michael Hope <michaelh@juju.nz>
Forward rtc_set_calibration() and rtc_get_calibration to the underlying
counter device via counter_set_calibration and
counter_get_calibration().
Both APIs use parts per billion (ppb), so no conversion is needed.
Translate -ENOSYS from the counter layer to -ENOTSUP to preserve the
error code documented by the RTC API.
Select COUNTER_CALIBRATION from Kconfig when RTC_CALIBRATION is enabled
to ensure the counter calibration API is compiled in.
Signed-off-by: Harini T <harini.t@amd.com>
Allow rtc_counter_set_time() to proceed when counter_stop() or
counter_start() returns -ENOTSUP. Both APIs may return -ENOTSUP for
always-on counters that cannot be stopped or started. Without this,
rtc_set_time() fails unconditionally on such hardware.
Signed-off-by: Harini T <harini.t@amd.com>
Set the counter tick value directly in hardware via counter_set_value()
instead of relying solely on a software offset.
Fall back to the existing software offset when the counter does not
implement set_value or the desired tick value exceeds 32 bits.
Signed-off-by: Harini T <harini.t@amd.com>
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>
Implement device runtime power management for the SiWx91x
entropy driver. This ensures that the RNG is automatically
reenabled after deep sleep.
Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
Check that the buffer length is a multiple of the data size, and return
an error if it's not the case.
Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
Do not store stack-allocated pointers in the SPI data structure.
Set current_tx and current_rx to NULL since they are not used in RTIO
anyway.
Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
Adapt the STM32 SPI driver so that in RTIO, transactions can be done either
in interrupt or in DMA mode, for different instances (until now, once
CONFIG_SPI_STM32_DMA was enabled, all transactions had to be done with
DMA).
Also use the asynchronous DMA callback for RTIO since it shares a lot of
code.
Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
The transceive and transceive_dma functions had some similar code.
Factorize them to reduce code duplication. transceive_dma is now called
from the transceive function, and only the latter is called from the
.transceive and .transceive_async API functions.
Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
This commit fixes issues that could arise notably when only the slave was
sending data (and the master was only receiving). By keeping track of bytes
transmitted in both directions (the context may not keep track of a
direction if the associated buffer is NULL or the length is 0), we prevent
the master side to abort the transmission prematurely.
Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
Fixes the slave mode for st,stm32h7-spi compatibles by setting the
transfer size also for the slave device, and also waiting for SPI to not be
busy before calling the "complete" function (or else the transaction might
end too early in case where only the slave sends data).
Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
CONNECT_CMUX had no handler for CMUX_DISCONNECTED, so a modem that never
establishes CMUX (left in an unknown state, for example a wrong baud
rate after an interrupted firmware update) stalled the driver in
CONNECT_CMUX with no way out.
Route CMUX_DISCONNECTED through modem_cellular_enter_recovery_state(),
the same recovery the init script uses, pulsing the reset line when one
is present and enabled to return the modem to a known state.
Signed-off-by: Paulo Santos <pauloxrms@gmail.com>
The init-script failure path picks between a reset pulse, a power pulse
and idle based on which control GPIOs the board wires and the
reset_on_recovery setting. Factor that selection into
modem_cellular_enter_recovery_state() so other failure paths reuse it
without duplicating the GPIO gating.
Signed-off-by: Paulo Santos <pauloxrms@gmail.com>
This change adds basic target mode support for STM32 products.
Controller writes to target, and reading from the target, is supported.
Signed-off-by: James Growden <jgrowden@tenstorrent.com>
Add a counter driver for the Xilinx Zynq Ultrascale+ MPSoC Real Time
Clock. The hardware provides a 32-bit seconds counter driven by an
external crystal oscillator, one alarm channel, and a calibration
register with integer and fractional tick adjustment.
The driver implements the Zephyr counter API and is intended to be used
with the rtc_counter wrapper to expose the standard RTC API.
The RTC oscillator runs continuously so start() and stop() return
-ENOTSUP. Calibration support is gated by CONFIG_COUNTER_CALIBRATION.
Signed-off-by: Harini T <harini.t@amd.com>
Add optional set_calibration/get_calibration operations to the counter
driver API. Calibration is specified in parts per billion (ppb). The
operations are gated behind CONFIG_COUNTER_CALIBRATION and return
-ENOSYS if not implemented by the driver.
Signed-off-by: Harini T <harini.t@amd.com>
Introduce Xilinx ADMA driver.
Features:
- Support for Xilinx ZynqMP ADMA (xlnx,zynqmp-dma-1.0)
and AMD Versal2 ADMA (amd,versal2-dma-1.0)
- Simple mode for single block memory-to-memory transfers
- Scatter-Gather mode for multi-block linked descriptor transfers
- Configurable 64-bit and 128-bit bus width support
- Maximum burst length of 256 beats for source and destination
- 64-bit addressing capability
- Software-managed cache coherency via flush/invalidate operations
- Optional hardware cache-coherent mode (device tree configurable)
- Interrupt-driven transfers with completion callbacks
- Error detection and reporting (AXI errors, overflow)
- Channel filtering support
Signed-off-by: Abin Joseph <abin.joseph@amd.com>
PR#107029 is merged, it provide supporting wpa_supplicant.
That means wifi shell sample should be able to support
two different mechanism. One use wpa_supplicant,
another one use wifi_mgmt_ops directly without wpa_supplicant.
Some structures like wpa_supp_event_supported_band or functions
in airoc_wifi.c belongs to wpa_supplicant only.
Therefore if we compile wifi shell without wpa_supplicant,
it causes build error.
Signed-off-by: Kevin Chan <kevin.chan3@infineon.com>
Extend mc_cgm_get_subsys_rate() with five new cases so the standard
clock_control API can return rates for the system and source clocks
that MCXE31 peripherals point at via a clocks = <&mc_cgm IDX> phandle:
MCUX_FIRC_CLK, MCUX_FXOSC_CLK, MCUX_CORESYS_CLK, MCUX_AIPSPLAT_CLK,
and MCUX_HSE_CLK.
Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
This driver supports CLOCK_MONITOR_MODE_MEASURE:
configure programs REF_CNT from the user's window_ns and the
reference clock rate queried via clock_control; start() triggers a
single measurement whose completion is delivered through the
configure-time callback, with the device auto-disarmed before the
callback runs so the callback may restart the next measurement from
ISR context. get_rate() returns the most recent completed result.
stop() is ISR-safe and aborts an in-flight measurement; a transient
CONFIGURING state guards configure()'s unlocked clock query and HAL
init against concurrent start().
Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
This driver supports CLOCK_MONITOR_MODE_WINDOW:
configure programs HFREF and LFREF from the user's expected_hz +
tolerance_ppm (auto-derived from the monitored clock via
clock_control when expected_hz is 0), start begins the background
comparison and stop disables it.
Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
Introduce a clock_monitor driver class that abstracts hardware that
watches one clock against another - frequency-window checkers,
frequency meters, and stuck/lost detectors. The subsystem exposes five
syscalls (configure, start, stop, get_rate, set_source).
clock_monitor_start() begins operation of whatever mode was installed
by configure(): continuous threshold checking in WINDOW mode, or one
measurement in MEASURE mode, whose result is delivered through the
configure-time callback with the device auto-returning to the stopped
state before the callback runs. Repeating measurement is achieved by
calling start() again from the callback; start() and stop() are
ISR-safe. clock_monitor_get_rate() polls the most recent completed
result and is the retrieval path for user mode, where callbacks may
not be installed.
The public header at include/zephyr/drivers/clock_monitor.h documents
the operating modes (WINDOW, MEASURE) and the event bitmap
(EVT_FREQ_HIGH, EVT_FREQ_LOW, EVT_CLOCK_LOST, EVT_MEASURE_DONE),
delivered exclusively through the configure-time callback.
Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
On mimxrt1060_evk, CONFIG_CODE_DATA_RELOCATION_SRAM
is enabled by the board configuration, which causes arm_core_mpu.c
to reference __ram_text_reloc_start and __ram_text_reloc_size.
These symbols are only generated when at least one function
is relocated to RAM_TEXT. Since no code was previously placed
there, the build fails with undefined reference errors.
Fix this by relocating hot-path functions from ipv6_fragment.c
and ipv4_fragment.c to RAM_TEXT using function-level FILTER,
Only throughput-critical functions in the RX/TX fragment path
are selected, which also improves throughput performance.
Signed-off-by: Xinyu Hong <xinyu.hong@nxp.com>
virtio_pci_read_cap() only asserted cap_len == cap_struct_size, which
compiles out in production. A device-supplied cap_len below the base
struct size underflows extra_data_words, and a value above the caller's
buffer overflows it during the config read loop, smashing the guest
stack during probe.
Replace the assert with a runtime range check.
Assisted-by: Claude:claude-opus-4.6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
virtio_isr() took the descriptor id from the device-written used ring and
used it directly to index recv_cbs[] and desc[] (both sized vq->num),
then invoked the callback pointer found there. A malicious or compromised
hypervisor could thus call an arbitrary function pointer in the guest.
Reject a descriptor id >= vq->num before using it.
Assisted-by: Claude:claude-opus-4.6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
- Only modify salve mode registers when not in 4-channel capture mode
- Add compile time check for not compatible configuration.
Capture support is only allowed if:
- No slave mode is selected
- or capture runs in four_channel_capture_support mode
Signed-off-by: Matthias Plöger <matthias.ploeger@phoenixcontact.com>
If the TX FIFO is too small, these calls can fail. While this usually
doesn't happen, I ran into this issue while porting this driver to
efr32mg13p and was wondering why sending data doesn't work properly.
Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
Sleep End Devices (SED) use data poll packets to check if the coordinator
has data to send. These packets use the type
IEEE802154_FRAME_TYPE_MAC_COMMAND, which as an additional field inside the
part of the header thats supposed to be part of the authenticated data
rather than the encrypted payload.
sl_802154_get_mhr_length has to detect this situation and adjust the
returned header size accordingly. The check is modeled after what the
function FindPayloadIndex does inside of the openthread source code. That
code is used, if the device doesn't support IEEE802154_HW_TX_SEC.
Before this fix, neither Wireshark nor the receiver of the message were
able to decrypt the message. This caused sleepy devices to be unable to
communicate.
Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
- tx_errno was set before giving the semaphore in several places. This can
cause the tx function to use the old value.
- The code tried to wait for an ACK even if the tx has failed. This caused
a dead lock. To solve this without relying on the order in which the ack
and the TX result are received, a new variable `ack_errno` is introduced,
so the success of the ack can be tracked and waited for separately.
Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
If mailbox is used for communication with VPR co-processor then
initilize mailbox just after vpr is launched. Otherwise, compilation
will fail due to devicetree hierarchy.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Add a hwinfo device-id backend that reads the unique chip identifier
stored in an NXP OTP flash memory area, as documented in the MCXE31xx
Reference Manual UTEST memory map. Add the nxp,otp-uid devicetree
binding that describes the identifier, and read it directly as memory
(8 bytes, most-significant byte first).
The hwinfo subsystem exposes its z_impl_hwinfo_* entry points as weak
symbols, so this backend implements only hwinfo_get_device_id() and
coexists with a separate reset-cause backend on the same SoC.
The backend is selected only when a node with the nxp,otp-uid
compatible is enabled, so it has no effect on its own; it is build
tested through tests/drivers/hwinfo/api once a board enables the node
(done later in this series).
Signed-off-by: Lucien Zhao <lucien.zhao@nxp.com>
Use NET_ETH_ADDR_LEN instead of raw 6 value to define MAC address
byte array size in STM32 ethernet drivers.
Assert at build time that the MAC address array size in HAL do match
those in Zephyr.
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
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>
This commit fixes a bug where esp32 UART errors are cleared before they
can be read. Additionally, all line errors (such as break and FIFO
overflow) are now watched and reported.
Assisted-by: Claude:claude-opus-4.7
Signed-off-by: Perry Naseck <pnaseck@media.mit.edu>
The USART init sequence configured BRR and CTLR1 (enabling the UART) and
only afterwards applied the pinctrl state. Reorder so that:
1. The clock is enabled.
2. The pinctrl state is applied before the peripheral is enabled.
3. CTLR1 is cleared first to ensure the UART is disabled while CTLR2/CTLR3
and the baud-rate divisor (BRR) are programmed, then CTLR1 is written
last to enable the UART with the final configuration.
Programming the control and baud-rate registers while the UART is disabled
and bringing up the pins before enabling avoids configuring the peripheral
in an undefined intermediate state. This is the ordering required by the
CH32H417 (QingKe V5F) and was regression-tested on a CH32V317 to confirm it
does not affect existing single-core parts.
Signed-off-by: Liu Changjie <liucj1228@outlook.com>
It turns out the GPIO FIFO has its own clock gate marked as a reserved bit,
Also the wrong bit was set for GPIP
Signed-off-by: Camille BAUD <mail@massdriver.space>
Move the CONFIG_I2C_TARGET_BUFFER_MODE guard to the proper location and
update the enable condition.
The option is enabled when either target_shared_fifo_mode or
target_fifo_mode property is specified, ensuring the required buffer mode
support is enabled.
Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
The init, network and dial scripts are keyed to the devicetree
compatible, so board-specific configuration on a shared modem (RF tuner
band routing, for example) can only be added by forking the vendor
driver. Add MODEM_CELLULAR_BOARD_INIT_DEFINE, registering a
board-supplied chat script against a modem instance via an iterable
section. The driver runs it over the AT control channel in a new
RUN_BOARD_INIT_SCRIPT state, entered after CMUX is up and before APN and
network configuration, and only when a script is registered.
Signed-off-by: Paulo Santos <pauloxrms@gmail.com>
Add WWDT (Windowed WatchDog Timer) support for all LPC55Sxx variants
(LPC55S06/S16/S28/S36/S69):
DTS / board changes:
- Add wwdt0 node (compatible = "nxp,lpc-wwdt", reg = 0xc000) and
watchdog0 alias to nxp_lpc55S0x/S1x/S3x_common.dtsi
- Enable wwdt0 and add watchdog to supported features on
lpcxpresso55s06, lpcxpresso55s16, lpcxpresso55s36 boards
SoC / clock:
- soc.c: call CLOCK_SetClkDiv(kCLOCK_DivWdtClk, 1U, true) when
wwdt0 is enabled, alongside the existing FRO1MHz enable
Driver hardening (per hakehuang review):
- Add `bool started` flag to mcux_wwdt_data to track post-setup state
- Set started=true in mcux_wwdt_setup(), clear in mcux_wwdt_disable()
and PM_DEVICE_ACTION_TURN_OFF
- Guard mcux_wwdt_isr() with early return when !started, preventing
spurious callbacks from warm-reset stale WWDT status on LPC55S36
- Clear WWDT status flags + NVIC pending bit before irq_enable() in
the IRQ init macro
Tests:
- Add per-board .conf files for wdt_basic_api; lpcxpresso55s06/s16
use SRAMX noinit section to survive TrustZone NS Boot ROM clears;
all boards enable WDT_MCUX_WWDT_WARNING_INTERRUPT_CFG=10
- Update testcase.yaml filter to allow SOC_SERIES_LPC55XXX and
exclude lpcxpresso55s69 NS variant
Tested with tests/drivers/watchdog/wdt_basic_api on lpcxpresso55s36:
SUITE PASS 100% [wdt_basic_test_suite]: pass=1, fail=0, skip=0
Signed-off-by: Peter Wang <chaoyi.wang@nxp.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>