The SiWG917 has a data cache in front of PSRAM (family reference manual
rev 1.2 section 5.4.5). The bootloader leaves it enabled and nothing in a
Zephyr build maintains it: the SoC does not select CPU_HAS_DCACHE and
sys_cache_data_*() return -ENOTSUP. The network processor writes the same
memory, so contents read back stale or torn under load.
Disable it with the vendor call at the top of the memory controller init,
before PSRAM is set up.
Signed-off-by: Mikey Sklar <mikeysklar@gmail.com>
The RTIO path updated the transfer command with read-modify-writes of
TCR while the transmit FIFO held queued entries: clearing CONT and
CONTC when the last data word enters the FIFO, in the DMA TX complete
callback, and in the end-of-transfer touch. TCR reads are not reliable
in that state. The reference manual advises reading TCR only with an
empty transmit FIFO or reading it twice and comparing, and ERR050606
adds that a polled TCR read can return a stale value. A stale or torn
readback written back is queued as a command word and silently alters
the frame for the remaining words with no error flag raised.
On a 17 byte half duplex probe read of an AFBR-S50 on MCXN947 LPSPI
with its 8 word RX FIFO the transfer completes reporting success while
the payload arrives displaced: the device's 0x00..0x10 test ramp
returns ten 0x00 bytes with the values 0x01..0x07 landing at offsets
10..16. Reads at or below the FIFO size are unaffected.
Compose the transfer command once at start of transfer, while the
transmit FIFO is empty and the read is defined, cache it per instance,
and write the cached value with CONT and CONTC cleared at every later
command write instead of reading TCR back.
For transmit only transfers on the interrupt path, mask RX in the
cached command before the first FIFO fill rather than after it, so no
unread words collect in the RX FIFO behind the queued data. The DMA
path keeps RX unmasked since it drains every received word and its
completion is signaled by the RX channel. Skip the RX drain pass when
the receive data flag is clear, keeping the receive interrupt armed,
so transmit and completion interrupts no longer run empty drain loops.
The watermark scheme, FIFO tuning, and DMA support are unchanged.
Signed-off-by: Benjamin Perseghetti <bperseghetti@rudislabs.com>
The transfer() function passes rx + carry to the DMA, but carry is not
guaranteed to be aligned to ESP_HOSTED_MCU_DMA_ALIGN, causing DMA
alignment errors (EINVAL/-22) on some platforms.
Fix by introducing a 'pad' offset. The address passed to transfer()
becomes rx + pad + carry, where pad is calculated as
ROUND_UP(carry, ESP_HOSTED_MCU_DMA_ALIGN) - carry, guaranteeing that
the read lands on an aligned boundary while keeping the carried bytes
contiguous. The frame processing starts at rx + pad, and when a partial
frame is carried over, a new pad is calculated for the next cycle.
Fixes: #117626
Signed-off-by: Matheus Alencar <sletezes@gmail.com>
Move esp_hosted_mcu_ap_authmode() into the soft-AP Kconfig guard
next to its only caller. Station-only builds compile out the AP
management code and emitted an unused-function warning.
Assisted-by: Claude:opus-5
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
spi_config() stored the config in the context before calling
am_hal_ios_configure(), so a failed HAL configure left the context
marked as configured. The next transceive then passed the
spi_context_configured() check and ran on unconfigured hardware, and
the raw HAL status leaked through the SPI API as a positive value.
Only publish the new config once the HAL accepts it and map a configure
failure to -EIO.
Fixes#116324
Signed-off-by: Richard Wheatley <richard.wheatley@ambiq.com>
spi_ambiq_transceive() returned early when spi_config() failed, skipping
the runtime PM put and leaking the usage count taken by the get; the
device could then never runtime-suspend again. It also overwrote the
transfer status with the return of pm_device_runtime_put_async(), hiding
transfer errors from the caller, and continued into the HAL after a
failed get.
Route the config-failure path through the common exit, keep the put
status in its own variable, and bail out when the get fails.
Fixes#116324
Signed-off-by: Richard Wheatley <richard.wheatley@ambiq.com>
Instantiate the native_sim TAP ethernet driver from devicetree using a
new `zephyr,native-tap` compatible. Each interface is described by its
own devicetree node, so multiple interfaces are created by adding
multiple nodes rather than increasing an interface count
(`CONFIG_ETH_NATIVE_TAP_INTERFACE_COUNT`).
Per-interface configuration moves from Kconfig to devicetree properties:
- the host interface name comes from the `host-interface` property
- the MAC address from the common `local-mac-address` or
`zephyr,random-mac-address` properties loaded through
`net_eth_mac_load()`
- the PTP clock from a child node
The `CONFIG_ETH_NATIVE_TAP_DRV_NAME`, `CONFIG_ETH_NATIVE_TAP_MAC_ADDR` and
`CONFIG_ETH_NATIVE_TAP_RANDOM_MAC` options are removed.
The `--eth-if`, `--mac-addr` and `--ipv4-*` command line options keep
applying to the first interface. In addition, per-interface variants
prefixed with the node name are added for the remaining interfaces.
Assisted-by: Claude:opus-4.8
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
Modified the driver file and the Kconfig file to include the Target
buffer mode support.
Signed-off-by: Santhosh Easwaramoorthy <santhosh.easwaramoorthy@microchip.com>
The interrupt handler only exited its drain loop once every data ready
flag in STATUS_REG was clear, but those flags are cleared by reading the
output registers, which only happens from a registered handler. A flag
set for a source with no handler (or a handler deferring the fetch) made
the loop spin forever and never re-enable the GPIO interrupt. Only
consider sources that have a handler registered, cap the number of
iterations, and re-arm the interrupt on a status read error as well.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
The enable_{t,xl,g}_int() helpers hardcoded the data-ready route bit
to 1, so a sensor_trigger_set() with a NULL handler never cleared
INT1_CTRL/INT2_CTRL and the sensor kept asserting the interrupt line.
Assign the enable parameter to the route bit instead.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
The sensor hub humidity converters stored the whole relative humidity
value scaled by 1e6 into val2 instead of only the fractional remainder,
so the reading was counted twice (e.g. 45.5 %RH became 90.5 %RH) and
val2 exceeded the 1000000 micro-unit bound. Use
sensor_value_from_float() to pack the value correctly.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
The die temperature conversion multiplied the int16_t raw sample by
1000000 in 32-bit arithmetic, which overflows (signed overflow UB) once
the temperature is more than ~8.4 C away from 25 C. Widen to 64-bit
before scaling, matching the lsm6dsv16x driver.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
The SENSOR_ATTR_CONFIGURATION handler in lsm6dso16is_gyro_config()
called lsm6dso16is_xl_hm_mode_set(), leaving the gyroscope power mode
untouched while silently changing the accelerometer one. Use
lsm6dso16is_gy_hm_mode_set() so the attribute acts on CTRL7_G.g_hm_mode.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
The gyroscope full-scale tables were copied from the lsm6dso driver and
used that part's FS_G encoding, so a gyro-range of 2000 dps yielded a
zero gain (readings always 0 rad/s), 125 dps read past the end of the
tables, and the other ranges applied a wrong sensitivity. Lay the tables
out per the LSM6DSO16IS encoding and index them through a helper that
maps the FS_125 register value.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
If the current state is I2S_STATE_ERROR, the peripheral has already been
stopped through nrfx_i2s_stop. Do not try to stop it again when
i2s_nrfx_trigger is called with I2S_TRIGGER_DROP, as this may cause the
hal to assert on p_cb->state != NRFX_DRV_STATE_UNINITIALIZED.
Signed-off-by: Marco Widmer <marco.widmer@bytesatwork.ch>
Replace hardcoded MSPM0_MCAN_MRBA (0x8000) with
CAN_MCAN_DT_INST_MRBA(inst). The constant accidentally produced
correct SIDFC offsets for canfd0 via mask truncation but computed
wrong filter addresses for canfd1 (base 0x40510000), causing the
controller to hang when starting.
Signed-off-by: Aman Lachhiramka <a-lachhiramka@ti.com>
MCANSS muxes LINE0 and LINE1 onto a single CPU IRQ. Loop up to the
number of lines per ISR entry instead of handling only the first
pending line, preventing latency spikes under concurrent TX+RX load.
Signed-off-by: Aman Lachhiramka <a-lachhiramka@ti.com>
Add a new NXP_WIFI_SUPP_DEBUG Kconfig option to control the
supplicant interface debug logs. It defaults to enabled when
WIFI_NM_WPA_SUPPLICANT_LOG_LEVEL_DBG is set. Previously the
CONFIG_SUPP_DEBUG macro had no Kconfig entry to enable it.
Assisted-by: WChat:Claude
Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
Remove NXP_WIFI_DEBUG_BUILD and NXP_WIFI_OS_DEBUG Kconfig
options that are not referenced anywhere in the source code.
Also remove the depends on NXP_WIFI_DEBUG_BUILD from
NXP_WIFI_NET_DEBUG and NXP_WIFI_WLCMGR_DEBUG so that
individual debug options can be enabled independently
without the unnecessary intermediate toggle.
Assisted-by: WChat:Claude
Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
Use gnttab_query_size() in the grant table initialization path instead
of calling the low-level grant table hypercall entry point directly.
This keeps the existing max-frame fallback behavior while making the
driver use the public grant table helper API for the operation it
performs during initialization.
Signed-off-by: Vladyslav Goncharuk <vladyslav_goncharuk@epam.com>
Assisted-by: Codex:gpt-5
Add gnttab_query_size() to expose GNTTABOP_query_size through the
public Xen grant table helper API.
The helper accepts operation arguments directly, builds the Xen ABI
request internally, and returns the per-operation GNTST_* status through
an output parameter.
Signed-off-by: Vladyslav Goncharuk <vladyslav_goncharuk@epam.com>
Assisted-by: Codex:gpt-5
bt_nxp_close() was a no-op, violating the bt_hci_close() contract that
requires the transport to be fully closed before the function returns.
After bt_hci_close() cleared data->recv, the NXP HAL could still fire
the RX callback, and on a quick reopen stale packets could be delivered
into the new session.
Deregister the HCI RX callback via PLATFORM_SetHciRxCallback(NULL) and
propagate any error so bt_hci_close() only clears data->recv after the
transport is confirmed closed. With CONFIG_HCI_NXP_RX_THREAD, a plain
K_NO_WAIT drain loop is not sufficient: when bt_rx_thread is blocked in
k_msgq_get(K_FOREVER), k_msgq_put() hands the frame directly into the
thread's stack buffer without touching msgq->used_msgs, so the drain
misses any frame the thread already holds. Add bt_nxp_rx_drain(): flush
buffered frames, post a sentinel (data == NULL) with K_FOREVER, and
wait on rx_drain_sem until bt_rx_thread acknowledges it. Because the
queue is FIFO, the acknowledgement guarantees every pre-close frame has
been processed before close returns.
Signed-off-by: Guotao Zhang <guotao.zhang@nxp.com>
Enable Wireless Location Service (WLS) by default when NXP IW61X SoC
and WIFI_NM_WPA_SUPPLICANT are enabled. WLS supports 802.11mc (FTM)
and 802.11az (Next Generation Positioning) features.
Signed-off-by: Keval Thakker <keval.thakker@nxp.com>
An underrun maybe expected if, for instance, the controller is polling
to know if there's something to read. However, current logging was
logging URUNNACK (the underrun condition) with error level, which was
annoying (many messages per second depending on the controller's polling
rate).
This patch changes it so that underruns are only logged at debug level.
Assisted-by: Copilot-CLI:claude-opus-5
Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
npcx_i3c_target_ibi_raise() is defined unconditionally, but the
.ibi_raise entry of the driver API that references it sits inside a
CONFIG_I3C_USE_IBI guard. Building with CONFIG_I3C_USE_IBI=n leaves
the function unreferenced and the compiler warns:
warning: 'npcx_i3c_target_ibi_raise' defined but not used
[-Wunused-function]
Wrap the function in the same guard as its only user.
Assisted-by: Copilot-CLI:claude-opus-5
Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
Convert the native_sim_timer system-timer driver to the generic tickless
timer core. The core takes over the tick accounting, and what is left here
is the cycle-domain primitives for this hardware, for a COMPARE_ORDERED
backend.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
The IRQMP driver implements the interrupt source query used by the
SPARC interrupt trap path under an arch-namespace name,
z_sparc_int_get_source(), declared in the SPARC arch header. The
function is driver code, not arch code: rename it to
intc_irqmp_get_source(), declare it in the driver header next to
the rest of the API, and have the trap path call the driver API
directly, matching how the arch_irq_* control functions are already
mapped to this driver in the same file.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The IRQMP driver defines arch_irq_enable(), arch_irq_disable() and
arch_irq_is_enabled() directly. Interrupt controller drivers should
only expose their own namespaced API; providing the architecture
interrupt control functions is platform glue and does not belong in
a driver.
Rename the functions to intc_irqmp_irq_* and declare them in a
driver header. The arch_irq_* mapping goes into the SPARC arch
layer, not the SoCs: the port is already coupled to an IRQMP-style
controller -- the interrupt trap path queries it for the interrupt
source -- and every SPARC SoC uses it, so mapping it once in
arch/sparc/core/irq_manage.c under CONFIG_LEON_IRQMP serves all of
them. An SoC with a different controller can leave the option
disabled and provide its own implementation.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The Basic Timer PRE_SCALE field divides the input clock by
(prescaler + 1) per the datasheets, not by the raw prescaler value.
Update the frequency calculation to divide by (prescaler + 1) and
correct the binding description to match.
Signed-off-by: Manimaran A <manimaran.a@microchip.com>
The driver calls IRQ_CONNECT() and irq_enable() but never includes
zephyr/irq.h, relying on it arriving indirectly. That does not always
hold: building samples/drivers/counter/alarm for an Arm Cortex-M
target fails with implicit declarations of both. Fix this.
Signed-off-by: Silesh C V <silesh@alifsemi.com>
counter_dw_timer_init() reads the timer clock rate from the clock
controller but never requests the clock, so it relies on the clock
already being enabled by other means. clock_control_get_rate() is
documented to return -EAGAIN when a driver cannot report the rate of a
clock that is off.
Request the clock with clock_control_on() before reading its rate.
-ENOSYS is tolerated so that clock controllers implementing only
.get_rate keep working, and -EALREADY for controllers that report an
already-enabled clock that way.
Signed-off-by: Silesh C V <silesh@alifsemi.com>
Add basic support for the AMD Versal Gen2 Clocking Wizard driver in the
Zephyr clock control subsystem. This hardware is used to generate
and control clocks on the Versal Gen2 platform.
Currently supported features:
- Configure the output clock frequency
- Read the current output clock frequency
- Enable/disable clock outputs
Signed-off-by: Beesam Sridhar Sagar <sagar.beesamsridhar@amd.com>
The eth_nxp_enet_qos_mac.c driver programs the MAC in a sequence that
violates the Synopsys DWC_ether_qos databook. This fixes that.
Signed-off-by: Martin Oliver Pitoňák <martin.pitonak@nxp.com>
The DCS display inversion state was never written, and the power-on
state of some panels is not deterministic, resulting in an image with
complemented colors on a random basis. Add an inversion-on devicetree
property and always program the state explicitly.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Vendor initialization sequences for ST7701S-based panels commonly
program additional registers: a Command2 BK3 setting (EFh), extra GIP
settings (E9h, BK1 EFh), and panel-specific values for the display line
setting (C0h), porch control (C1h) and CCh registers. Add optional
devicetree properties for these, keeping the existing computed or
hard-coded values when they are absent.
Add build assertions so a devicetree array that does not fit its
fixed-size configuration field fails the build instead of being
silently truncated.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
The inversion selection (C2h) and the Command2 BK1 power and source
timing registers (Vop, VCOM, VGH, VGL, power control, source pre-drive,
MIPI setting) were hard-coded. These are panel-specific analog drive
parameters that panel vendors specify per module; expose them as
optional devicetree properties defaulting to the previously hard-coded
values.
The undocumented B9h register is now written only when the b9 property
is present. It was previously always written, but due to the short
write length bug its parameter never reached the panel, so no board
relied on a specific value.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
The GIP and gamma configuration commands were always written with the
full size of their fixed-size config fields. A property shorter than
the field was padded with trailing zero parameters on the wire, and an
absent property was sent as an all-zeros packet instead of leaving the
controller's power-on default untouched.
Track the devicetree-provided length of each setting and write exactly
those bytes, skipping settings that are not set.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
The LNESET (C0h) command was hard-coded to 0x63, which configures the
panel for (0x63 + 1) * 8 = 800 lines. Compute the value from the panel
height instead so panels other than 480x800 work. Existing 800-line
users are unaffected.
Heights that are not a multiple of 8 are encoded using the extra-line
delta field (LDE_EN + Line_delta), matching the reference formula
NL = (Line[6:0] + 1) * 8 + (LDE_EN ? Line_delta[1:0] * 2 : 0). A build
assertion rejects odd heights, which cannot be represented.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Not all MIPI-DSI host drivers implement DCS read transfers, e.g. the
NXP RT11xx DSI host returns -ENOTSUP. Failing the panel ID check in
that case aborts the panel initialization entirely on otherwise
functional hardware. Log a warning and continue instead.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
The ST7701S datasheet requires 120 ms after the Sleep Out command
before the display is fully functional; the driver only waited 50 ms.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
st7701_short_write_1p() passed sizeof(val), which is 1, instead of
sizeof(buf) as the length, so every one-parameter write was transmitted
as a Generic Short Write with the command byte only. The controller
interprets such a packet as carrying parameter value 00h, so the entire
Command2 BK1 bank (Vop amplitude, VCOM, VGH and VGL voltages, power
control, source pre-drive timing and MIPI settings) was programmed to
zero on every panel initialized by this driver, resulting in unstable,
fading and heavily flickering output.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
The driver never programs the per-address multicast hash table and does
not advertise ETHERNET_HW_FILTERING, so the stack never installs a group
filter. On a MAC that reports a hash table (HASHTBLSZ is nonzero) that
combination dropped every multicast frame, which breaks IPv6 neighbor
discovery and MLD group membership, so a joined group received nothing.
Set the pass-all-multicast bit unconditionally so joined groups are
delivered. The prior code set it only when the MAC reported no hash
table, but pass-all is needed in strictly more cases than that: the
driver never populates the hash table, so perfect multicast filtering
is unavailable regardless of the reported hash-table size.
Signed-off-by: Benjamin Perseghetti <bperseghetti@rudislabs.com>
This MAC gates inbound multicast through the group-address hash
(GAUR/GALR), which starts empty after ENET_Up. The driver advertises
ETHERNET_HW_FILTERING and installs a hash bit for every group the
stack joins, so IP multicast joined through the stack (including IPv6
neighbor discovery and MLD group membership) is delivered. Multicast
that the stack never joins, such as traffic received through a raw
packet socket, has no hash bit installed and is dropped by the MAC.
Add ETH_NXP_ENET_MULTICAST_FILTER (default y) to preserve the existing
hash-filtered behavior. When it is disabled, the driver stops
advertising ETHERNET_HW_FILTERING, skips the per-group hash
installation, and opens the group-address hash to every multicast
address so reception no longer depends on per-group installation. This
follows the ETH_NXP_S32_MULTICAST_FILTER and ETH_STM32_MULTICAST_FILTER
options already in tree.
Signed-off-by: Benjamin Perseghetti <bperseghetti@rudislabs.com>
Replace direct NVIC_SetPendingIRQ()/NVIC_ClearPendingIRQ() calls with
k_irq_set_pending()/k_irq_clear_pending(), dropping the dependency on
cmsis_core.h where nothing else needed it. These platforms are
plain-NVIC Cortex-M, so the pending-state capabilities are always
available where this code builds.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Update comments, log messages, and driver-local identifiers to use
the controller/target terminology ratified by coding guideline A.2
and already used by the Zephyr I2C API.
Identifiers mirroring the Atmel/Microchip datasheets
(e.g. SERCOM_I2CM_CTRLA_MODE_I2C_MASTER, TWIM_CMDR_HSMCODE, and the
TWI/TWIHS register mnemonics) are kept unchanged. The hs_master_code
config member is also kept, as it holds the hs-master-code devicetree
property, whose name is unchanged.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
Add support for both dedicated and shared IRQ lines based on
devicetree configuration using num-dedicated-irqs property.
- Dedicated IRQ: One IRQ per channel, uses CHINTFLAG register
- Shared IRQ: Multiple channels share one IRQ, uses INTPEND register
- Generate IRQ ISR functions using LISTIFY macro
- IRQ type (dedicated/shared) determined at compile time from DTS
Example: num-dedicated-irqs = <4> means ch0-ch3 have dedicated IRQs,
ch4+ share the remaining IRQ line.
Note: This dual-path design is required by hardware behavior, not just
an optimization. Channels with dedicated interrupt lines do not refresh
the INTPEND register (as per datasheet section 24.5.4), so the shared
handler using INTPEND is valid only for multiplexed channels, while
dedicated channels must use CHID and CHINTFLAG directly.
Signed-off-by: Arunprasath P <arunprasath.p@microchip.com>
Add a SmartDMA-accelerated transfer path as an alternative to the
generic-DMA (e.g. eDMA) back-end, selectable via
MIPI_DBI_NXP_FLEXIO_LCDIF_SMARTDMA.
Signed-off-by: Neil Chen <cheng.chen_1@nxp.com>
Introduce an interactive multi-vector steering redirection table
probe subcommand to the common PCIe host shell driver layer.
The IRQ subsystem extracts MSI-X registers using pcie_get_cap()
offsets, decoding allocated vector pools and exposing steering
offsets via standard Base Address Register (BAR) bitmasks.
Signed-off-by: Khadem Ullah <khadem.systems@gmail.com>