With K_FOREVER and no free descriptors, virtq_add_buffer_chain()
slept in k_stack_pop() while holding the queue spinlock. Pop
descriptors before taking the lock, rolling the chain back on
failure, so the lock only guards the available ring update. The
free descriptor count is now updated under the lock so it stays
coherent on SMP, and finite timeouts actually wait as documented
instead of failing immediately.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
virtq_add_buffer_chain() with bufs_size == 0 would write
recv_cbs[0xffff] out of bounds and publish a bogus descriptor index
to the device. Return -EINVAL instead.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Little-endian converted values were used as array indexes and
descriptor fields were stored without conversion, which is broken on
big-endian targets. Index with CPU-order values and convert the
addr/len/flags/next fields when writing the descriptor table. No
functional change on little-endian targets.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
format_map[] is keyed by the Type A (6800) bus-width constants
(MIPI_DBI_MODE_6800_BUS_{8,9,16}_BIT = 0x5/0x4/0x3), but
mcux_dcnano_lcdif_dbi_get_format() compared each entry's key
against `bus_type - MIPI_DBI_MODE_6800_BUS_16_BIT`. That subtraction
correctly normalizes the Type B (8080) values 0x6/0x7/0x8 down to
0x3/0x4/0x5, but it also shifts the Type A values 0x3/0x4/0x5 down
to 0x0/0x1/0x2 which do not exist in the map. As a result every
6800 mode returned -EINVAL from configure(), even though the switch
above accepts the same three modes and selects
kLCDIF_DbiTypeA_FixedE, and mipi-dbi-device.yaml lists all three
as valid mipi-mode values.
Only normalize the Type B values before the lookup so both bus
types resolve correctly. The 8080 path is byte-for-byte identical
to what it does today.
Fixes#114739
Signed-off-by: Kate Wang <yumeng.wang@nxp.com>
Add a disk_access driver for virtio,blk devices.
It supports negotiated block size and scatter-gather requests.
Signed-off-by: Hongquan Li <hongquan.li@processmission.com>
Currently, it is possible to link a IEEE802.15.4 build with
stale blobs. Add blobs verify directive to enforce blobs version
check while building.
Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
The esp_ieee802154_energy_detect_done() runs from the radio ISR.
Defer the energy_scan_done callback to a workqueue so it is invoked
from thread context instead of ISR context.
Signed-off-by: Marek Matej <marek.matej@espressif.com>
Use the active channel's configuration when converting raw sensor data
to frequency and capacitance.
The conversion helpers were using cfg->ch_cfg->fin_sel and
cfg->ch_cfg->inductance, which always reference channel 0. This gives
incorrect results for multi-channel configurations where channels use
different fin_sel or inductance values.
Index ch_cfg with the selected channel so each conversion uses the
correct per-channel configuration.
Signed-off-by: Sundareswar Palanichamy <sundareswarp@gmail.com>
lis2dh_fetch_xyz did not return -ENODATA when LIS2DH_STATUS_DRDY_MASK
was clear. Because the successful read returned 0, the data-ready check
was masked and old data was silently reported as fresh.
Signed-off-by: Markus Grafen <markus.grafen@medicassist.de>
When CONFIG_SYSTEM_TIMER_LPM_COMPANION_COUNTER is used to keep time across
a low-power state, sys_clock_idle_exit() reconstructs the elapsed time
and announces it to the kernel. Two intermediate values were computed
in 32 bits, which overflows once a single low-power sleep exceeds 2^32
core cycles (~134 s at 32 MHz):
- dcycles (the unannounced cycle delta) was uint32_t. Truncation
makes the announced tick count far too small, so k_sleep() never
completes and the MCU appears to never wake from STOP.
- announced_cycles += dticks * CYC_PER_TICK evaluated the product in
32 bits before adding to the 64-bit accumulator. Truncation under-counts
announced_cycles by a multiple of 2^32, so each subsequent sleep's
dcycles is too large and kernel time runs progressively fast.
Widen dcycles to 64 bits and cast the multiply to cycle_t so both
operations are performed in 64 bits. Only affects builds with a 64-bit
cycle counter (CONFIG_CORTEX_M_SYSTICK_64BIT_CYCLE_COUNTER) using the
counter companion; verified on STM32L151 (32 MHz core, LSE RTC companion)
with 5- and 9-minute STOP intervals.
Signed-off-by: Markus Grafen <markus.grafen@medicassist.de>
Assisted-by: Claude:claude-opus-4.8
STM32 I2C bus recovery bitbangs the scl-gpios/sda-gpios pins
through the GPIO API, but I2C_STM32_BUS_RECOVERY never pulled in
GPIO. The build relied on the ST board defconfig to enable
CONFIG_GPIO; since commit 90b9c954f0 ("boards: st: *: don't
enable CONFIG_GPIO by default") the drivers.i2c.build.bus_recovery
build on nucleo_f411re fails to link with undefined references to
the GPIO ports named by the I2C node (those properties were added
to ST boards by commit 56e96eef9b).
A select GPIO is not possible here: the symbol lives inside the
if I2C block and selecting GPIO from there creates a recursive
Kconfig dependency. Use depends on GPIO instead - all recovery
code in the driver is already guarded by
CONFIG_I2C_STM32_BUS_RECOVERY, so the feature simply stays off
without GPIO - and enable CONFIG_GPIO explicitly in the
bus_recovery test scenario so it keeps building the recovery path.
Assisted-by: Claude:claude-fable-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The HD44780 driver is a purely GPIO-driven LCD controller: the
register-select-gpios, enable-gpios and data-bus-gpios properties
are required by the binding and driven through the GPIO API, but
AUXDISPLAY_HD44780 never pulled in GPIO. The build relied on the ST
board defconfig to enable CONFIG_GPIO; since commit 90b9c954f0
("boards: st: *: don't enable CONFIG_GPIO by default") the
nucleo_f746zg auxdisplay sample build fails to link with undefined
references to the GPIO port devices. Select GPIO unconditionally
since the driver cannot function without it.
Assisted-by: Claude:claude-fable-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The generic cellular modem driver embeds gpio_dt_spec entries for
the power, reset, wake, ring, dtr and status pins and drives them
through the GPIO API, but MODEM_CELLULAR never pulled in GPIO. The
build relied on the ST board defconfig to enable CONFIG_GPIO; since
commit 90b9c954f0 ("boards: st: *: don't enable CONFIG_GPIO by
default") the b_u585i_iot02a cellular_modem sample build fails to
link with an undefined reference to the GPIO port referenced by the
modem's mdm-power-gpios. Select GPIO unconditionally: the specs
span six properties across all vendor compatibles, and physical
modems need at least a power or reset pin (the BG9x binding marks
mdm-power-gpios as required), so a per-property conditional select
is not worth the complexity here.
Assisted-by: Claude:claude-fable-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The NT35510 driver drives its optional reset-gpios and bl-gpios
pins through the GPIO API, but its Kconfig never pulled in GPIO.
The build relied on the ST board defconfig to enable CONFIG_GPIO;
since commit 90b9c954f0 ("boards: st: *: don't enable CONFIG_GPIO
by default") the stm32h747i_disco build with the
st_b_lcd40_dsi1_mb1166_a09 shield fails to link with an undefined
reference to the GPIO port device referenced by the display node.
Select GPIO when any enabled node has one of these properties,
following the same pattern as the otm8009a and stm32_ltdc drivers.
Assisted-by: Claude:claude-fable-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The OTM8009A driver drives its optional reset-gpios and bl-gpios
pins through the GPIO API, but its Kconfig never pulled in GPIO.
The stm32h747i_disco build relied on the ST board defconfig to
enable CONFIG_GPIO; since commit 90b9c954f0 ("boards: st: *: don't
enable CONFIG_GPIO by default") linking fails with undefined
references to the GPIO port devices referenced by the display node.
Select GPIO when any enabled node has one of these properties,
following the pattern used by the stm32_ltdc and stm32_ospi
drivers, since both properties are optional in the binding.
Assisted-by: Claude:claude-fable-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The PWM DALI driver unconditionally uses the GPIO API for its
required rx-gpios pin, but DALI_PWM only selected PWM and COUNTER.
The sample built anyway because ST board defconfigs used to enable
CONFIG_GPIO; since commit 90b9c954f0 ("boards: st: *: don't enable
CONFIG_GPIO by default") the nucleo_f091rc build fails to link with
an undefined reference to the GPIOA device. Select GPIO so the
driver pulls in its own dependency.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
pwm_resume applies the pinctrl from devicetree, sets the gpio to the
idle value, respecting the nordic,inverted flag in the pinctrl nodes.
However, the IDLEOUT register is not set on socs which include this
register. The IDLEOUT register takes precedent over the GPIO setting,
it must thus be set to match the pin polarity, otherwise glitches
will be observed when PWM goes idle, see issue #114343.
This commit adds setting the channel idle state as part of pwm_resume.
An nrfy function is used since the nrfx_pwm driver sets this idle
states on nrfx_pwm_init, which is run before pinctrl is set, and thus
before the driver is able to get the nordic,inverted setting, since
it reads this by reading the pin out setting set by pinctrl.
Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
Mark an IPI child enabled before unmasking its interrupt. Otherwise, a
pending interrupt can run the ISR while the child still appears disabled,
leaving its status uncleared and trapping the CPU in an interrupt storm.
Mask the interrupt before marking the child disabled so the ISR cannot skip
a channel while its interrupt is still unmasked.
Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
Add typed wrappers for XENMEM_increase_reservation and
XENMEM_decrease_reservation using the existing Xen memory-op helper
style. Both operations use struct xen_memory_reservation, so share the
reservation setup with the existing populate-physmap wrapper.
These calls are useful for Zephyr when it runs as a Xen hardware/control
domain, not as ordinary Zephyr heap management. The Xen support already
exposes domain creation, maximum-memory, memory-mapping, grant-table,
and event-channel control APIs. A Zephyr control-domain service or
validation app needs the reservation operations to exercise the same
guest memory lifecycle: ask Xen to adjust a domain reservation, receive
any extent bases returned by Xen, and later return guest frames to Xen
when the domain is torn down or resized.
Keep this as a typed Xen wrapper instead of adding a Zephyr memory
subsystem driver. A real balloon or memory-hotplug driver would need a
policy for which frames can be removed, coordination with Zephyr's
allocator, and ownership of runtime memory pressure. This patch only
exposes the stable Xen ABI primitive needed by that future policy and by
control-domain test code.
Signed-off-by: Vladyslav Goncharuk <vladyslav_goncharuk@epam.com>
GPIO isolation during sleep leaves all pins floating, for power saving.
In some configurations the UART peripheral will remain ON during sleep
and can be affected by signal shifts in the pins. Use the pad hold
function to leave signals recessive and avoid spurious UART events
which can dirty the FIFO and leave pending interrupts which can
stall the system.
Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
Attach the hardware capture of received PTP frames to the packet
and request a transmit timestamp when the network stack asks for
one, so PTP can measure the time frames crossed the wire.
The receive capture is latched from the last descriptor before it
is returned to the DMA, and the transmit capture is read back from
the first descriptor once the DMA releases it.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
Expose the IEEE 1588 clock provided by the Ethernet MAC as a PTP
clock device, so applications can read, set, offset and rate
adjust it through the PTP clock API.
The reference frequency is queried from the clock control driver
instead of being assumed, and only PTP frames are timestamped.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
Add SoC and devicetree support for the R-Car Gen4 R8A779G0 A76.
Co-authored-by: Yuya Hamamachi <yuya.hamamachi.sx@renesas.com>
Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
Fix the integer-to-pointer cast warning by casting through uintptr_t
when converting clk->rate to clock_control_subsys_rate_t on 64-bit
environmet.
Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
Switch the Cadence SPI driver to use the DEVICE_MMIO API instead
of directly accessing the physical base address from the devicetree.
This is required to support platforms with an active MMU (such as the
Cortex-A9 on Zynq 7000), where accessing unmapped physical addresses
causes MMU translation faults.
Closes#113693
Signed-off-by: Simon Maurer <mail@maurer.systems>
The ACI_HAL_STACK_RESET command is replaced by ACI_RESET command.
Update comment.
Added endianness management for 32 bits options parameter.
Remove misaligning.
Signed-off-by: Eric Mechin <eric.mechin@st.com>
Don't allow enabling the STM32 pinctrl driver if no GPIO port is enabled
as this would cause a build error in the GPIOport manager module.
If no GPIO port is enabled, the pinctrl driver is useless anyways.
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
It is relatively common (at least for nRF93M1, Telit LE910) that channel
configuration commands such as `ATE0` that are normally sent during the
`init` script are not actually carried over to the DLCI channels opened
with CMUX.
Enable vendor implementations to provide a script that should be run
after a DLCI channel is opened to re-apply these configurations.
Note that this script is NOT automatically run for user DLCI channels,
as the `modem_cellular` is not responsible for opening these pipes.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Add board overlays and platform_allow / filter entries so the measure_freq
and check_freq samples and the clock_monitor_api test run on the
FREQME-capable frdm_mcxa153, frdm_mcxa156, frdm_mcxa266, frdm_mcxa344,
frdm_mcxa366, frdm_mcxa577, frdm_mcxn236, mcx_n5xx_evk (MCXN547),
mcx_n9xx_evk (MCXN947), frdm_mcxl255 and mimxrt700_evk (MIMXRT798S) boards.
The nxp,freqme driver does not enable the clocks it measures, so on MCXN -
where the FRO_12M / FRO_HF distribution to the Frequency Measure mux is
gated until clock_control_on() - the samples and test enable the measured
source clocks at startup. The clocks are declared independently of the
monitor in a "clock-monitor-required-clocks" (samples) /
"test-required-clocks" (test) node, added with new bindings, that the
application turns on before configuring; boards whose sources are always
running omit the node.
Extend the clock_monitor_api test with a set_source case that switches the
reference and target between declared sources and re-measures to confirm
the switch took effect, driven by per-instance "switch-reference" /
"switch-target" / "switch-target-expected-hz" properties added to the
test-clock-monitor fixture binding and to the FREQME board overlays.
Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
Enable clock_control_get_rate and clock_control_on for FRO_HF,
FRO_HF_DIV, FRO_12M, CPU/AHB and external clock rates.
Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
Add a clock_monitor back-end for the NXP FREQME (Frequency Measurement)
peripheral, wrapping the MCUX lpc_freqme HAL. It supports MEASURE
(one-shot) and WINDOW (continuous MIN/MAX threshold) modes, queries the
reference rate from clock_control, and enables the peripheral gate through
clock_control. It does not enable the reference or target source clocks -
the application must ensure they are running before configure()/start();
the driver only routes and measures them.
Reference and target clocks are selected from devicetree-declared source
lists ("reference-sources" / "target-sources"); each source pairs an
INPUTMUX route with a frequency provider (a "clocks" phandle or a fixed
"clock-frequency"). clock_monitor_set_source() switches the reference and
the target between the declared sources at runtime and drops the device
back to unconfigured state, so the next configure() re-derives REF_SCALE
and the WINDOW thresholds. Reference sources must resolve a frequency;
target sources may omit one, since the target rate is measured, not
predicted.
This includes the devicetree binding, the INPUTMUX connection-cookie header
with per-family cookies (MCXA, MCXC, MCXN, MCXL, MCXW and RT700) plus the
NXP_FREQME_SOURCE_UNCHANGED sentinel, and the syscon clock identifiers used
to query the FRO / CPU-AHB / external clock rates and to gate FREQME.
Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
Receive interrupts can arrive before the ENET_QOS DMA has completed the
regular and context descriptor writebacks used for PTP RX timestamps.
Add a short bounded wait for the context descriptor ownership handoff
and timestamp status bits before extracting the timestamp.
Signed-off-by: Philipp Steiner <philipp.steiner1987@gmail.com>
Use xen_sched_yield() in the Xen HVC UART driver instead of calling the
low-level scheduler hypercall entry point directly.
This keeps the driver on the public Xen scheduler helper API while
preserving the existing behavior. The driver still yields the current
VCPU when the TX ring is full so the console backend can consume data.
Signed-off-by: Vladyslav Goncharuk <vladyslav_goncharuk@epam.com>
Assisted-by: Codex:gpt-5 cpp-code-map
Add typed helpers for Xen scheduler operations used by Zephyr guests and
management code:
- yield; block; poll; shutdown; remote shutdown; shutdown code; pin
override.
The raw hypercall entry point remains available for low-level code, but
normal Zephyr callers should not need to depend on the
architecture-specific hypercall header or build Xen ABI request
structures by hand. Keep these operations under <zephyr/xen/sched.h>,
matching the existing Xen wrapper style.
Signed-off-by: Vladyslav Goncharuk <vladyslav_goncharuk@epam.com>
Assisted-by: Codex:gpt-5 cpp-code-map
DRIVER_FEATURES is a write-only register per the virtio specification
(4.2.2.2), but virtio_mmio_write_driver_feature_bit() did a
read-modify-write on it. Reads return 0, so every call only ever wrote
the single current mask bit and erased all feature bits previously
written to the same 32-bit word -- e.g. a device driver negotiating a
feature bit in word 1 (bits 33..63) silently dropped VIRTIO_F_VERSION_1
set during transport init.
Accumulate the feature bits in a per-device shadow and write complete
words instead. This also drops the sys_cpu_to_le32() applied to the
mask, which was wrong because virtio_mmio_write32() already performs
the conversion (a no-op on little-endian hosts, corruption on
big-endian ones).
Fixes#115150
Signed-off-by: Hongquan Li <hongquan.li@processmission.com>
virtio_mmio_reset() passes VIRTIO_MMIO_STATUS to
virtio_mmio_read_status_bit(), but that macro is the register offset
(0x70 = 112), not a bit number. The loop condition therefore evaluates
read32(STATUS) & BIT(112), which is always 0, so the driver never
actually waits for the device to complete the reset (and BIT(112) is
shift-count-overflow UB on 32-bit platforms).
Poll the status register value instead, as required by the virtio
specification (4.2.2: after writing 0 to Status, the driver must wait
until it reads back 0).
Fixes#115149
Signed-off-by: Hongquan Li <hongquan.li@processmission.com>
The patch ad42613252 added GPIO_DISCONNECTED support
for gpio_mcux_port_configure, but port_get_direction was not updated
accordingly.
port_get_direction() only checks PDDR to determine pin direction,
so a disconnected pin (PDDR cleared) is incorrectly reported as an
input. This causes the gpio_get_direction.test_disconnect test to
fail on boards using the PORT-based gpio_mcux driver.
Check PORT PCR and PDDR state to identify disconnected pins and
exclude them from direction results, so they are reported as
neither input nor output per the Zephyr GPIO API contract.
Fixes: #114432
Assisted-by: Claude:opus-4.6
Signed-off-by: Jason Yu <zejiang.yu@nxp.com>
The weekday field was masked with 0x08, which zeroes every valid
1-to-7 value, so the day of week was never stored and always read
back as -1. Use the 3-bit mask 0x07 for both the pack and unpack
sides.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
(~SPEED_Msk | ~SDAHOLD_Msk) is all-ones for disjoint fields, so
reconfiguration never cleared the old SPEED/SDAHOLD bits. Use
~(SPEED_Msk | SDAHOLD_Msk).
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Extended sleep interval is the period during which STA will stop all
types of TX/RX. Through this command user can configure the quiet period.
Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
Add ext1-pwren-gpios binding to nxp,wifi.yaml for M.2 module VPCIe_3V3
power control. On imx91 (AArch64), GPC is not available so read
WL_WAKE_HOST GPIO directly via wakeup_gpios DT property instead.
Use CONFIG_PM_MCUX_GPC to guard fsl_gpc.h include, which is more
precise than excluding by SoC series.
Signed-off-by: Li Long <li.long@nxp.com>
The counter-backed RTC wrapper is the only RTC driver that depends on
another device: it fetches and calls its parent counter device during
init, so it must initialize after the counter. It previously reused the
shared RTC_INIT_PRIORITY symbol, whose default is not guaranteed to
order the wrapper after the backing counter, so each board and test had
to override CONFIG_RTC_INIT_PRIORITY to build reliably.
Introduce a wrapper-scoped RTC_COUNTER_INIT_PRIORITY (default 70) used
only by rtc_counter. The shared RTC_INIT_PRIORITY default is left
unchanged for all other RTC drivers, and consumers of the wrapper no
longer need per-board init-priority overrides. Correct ordering is
verified at runtime by the device_is_ready() check on the backing
counter during init.
Signed-off-by: Harini T <harini.t@amd.com>