Cortex-A53 SBC on the Broadcom BCM2710 (BCM2837 die). Adds the
soc/brcm/bcm2710 SoC with the native BCM283x interrupt controllers
(no GIC), booting single-core with the mini-UART console at 115200.
Signed-off-by: Jonathan E. Peace <jep@alphabetiq.com>
Exposes the FPGA System ID build-info ROM (board / product / git
data) through the standard Zephyr OTP API as a read-only device.
otp_read() returns the raw ROM bytes; knowledge of the ROM format is
intentionally left to the consumer.
CONFIG_OTP_ADI_AXI_SYSID is auto-selected when
DT_HAS_ADI_AXI_SYSID_ENABLED.
Signed-off-by: Iustin Stolniceanu <stolniceanuiustin@gmail.com>
The RTC is a free-running counter that z_nrf_rtc_timer_read() extends to
64 bits in software, plus an absolute compare, so a COMPARE_ORDERED
backend: compare_set() raises the interrupt straight away for a target the
counter has already passed, and the core's single write is enough. The
counter width is declared as the extended one, 64 bits, while the arm
range stays the driver's own MAX_CYCLES, half the 24-bit counter span,
because that bound comes from the compare register rather than from the
count the core reads.
The core takes over the tick accounting. last_count, last_elapsed and the
cycle-to-tick math go with it, and so do sys_clock_set_timeout(),
sys_clock_elapsed() and sys_clock_cycle_get_32(), which the core emits.
What is left of the timeout handler is the anchor update and the announce.
sys_clock_no_timeout() stays. It does something the arming path cannot:
release sys_busy, which keeps z_nrf_rtc_timer_trigger_overflow() out of
the way while a deadline is pending. The core's default would park the
compare the same distance out but leave that flag set. This also replaces
the old magic tick value in sys_clock_set_timeout(), where a timeout
further out than the announce range arrived as that same value and was
indistinguishable from having none.
Not reprogramming at all in the hook would be the natural improvement, the
compare already in place covering the counter wrap, but that is a
behaviour change and is left for the driver's maintainers.
timer_api, context and sleep pass on nrf52_bsim, which runs this driver
against a model of the RTC, and timer_api passes on nrf5340bsim,
including the sloppy-idle variant. Also build-tested on nrf52840dk,
nrf5340dk and nrf9160dk.
The tickful configuration fails on nrf52_bsim, as it does on upstream
main, so that is not a regression from this change.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
drv_rx_done() took the length byte from the start of the RF core's receive
entry and immediately used it as an index twice:
len = drv_data->rx_data[i][0];
status = drv_data->rx_data[i][len--];
rssi = drv_data->rx_data[i][len--];
That byte is the over-the-air SUN-FSK PHR and is not validated. len == 0
makes the first read index rx_data[i][0], wrapping len to 255, so the
second read lands at rx_data[i][255] - 125 bytes past the 130-byte
(IEEE802154_MAX_PHY_PACKET_SIZE + 3) receive row - and leaves len at 254,
which is then used as the length for net_pkt_rx_alloc_with_buffer() and
net_pkt_write(), copying ~124 bytes of adjacent memory into a packet
delivered to the network stack.
With CONFIG_IEEE802154_L2_PKT_INCL_FCS the same wrap is an out-of-bounds
write: the CRC append does sdu[len++] twice, storing two bytes past the
row for a sufficiently large len.
Reject a length that would underflow the post-decrements or exceed the
receive buffer, and recycle the entry, mirroring the guard added to the 2.4
GHz sibling driver in "drivers: ieee802154: cc13xx_cc26xx: fix short-frame
path reaching net_recv_data".
Assisted-by: Claude:claude-opus-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Commit "drivers: ieee802154: cc13xx_cc26xx: reject short RX frames
before len--" rejected RX frames with len < 4 before the two
post-decrements that would otherwise underflow uint8_t, but jumped to a
label placed after the packet allocation and before the packet is handed
to the network stack:
next_entry:
drv_data->rx_entry[i].status = DATA_ENTRY_PENDING;
net_pkt_set_ieee802154_lqi(pkt, lqi);
...
net_recv_data(drv_data->iface, pkt);
Taking the goto therefore reached net_pkt_set_ieee802154_lqi() and
net_recv_data() with pkt uninitialised on the first loop iteration, or
stale on later ones - in which case the packet had already been passed
to the net stack and unreferenced, making this a use-after-free that a
short frame could trigger remotely.
Recycle the RX entry and continue the loop instead, matching how the
DATA_ENTRY_UNFINISHED branch below already handles a discarded entry,
and drop the label.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The RX done handler post-decremented len twice then subtracted 2 for FCS.
With len < 4 the uint8_t underflows, producing a huge length passed to
net_pkt_rx_alloc_with_buffer. Reject frames with len < 4 before the
post-decrement operations.
Assisted-by: Claude:claude-sonnet-4-6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The CC1200 radio can supply a pkt_len of 0-255 but IEEE 802.15.4 limits
PHY packets to 127 bytes. verify_rxfifo_validity() only checked the lower
bound; values above 127 reached net_pkt_rx_alloc_with_buffer() unclamped.
Add the upper bound check against IEEE802154_MAX_PHY_PACKET_SIZE.
Assisted-by: Claude:claude-sonnet-4-6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The PHR is used to compute len = raw[0] - IEEE802154_FCS_LENGTH, bounded
only by __ASSERT_NO_MSG, which compiles out at CONFIG_ASSERT=n. Add the
lower bound before the subtraction and a runtime length check.
Note the ESP-IDF HAL drops frames whose FCS does not validate, and a frame
declaring fewer than two PHR bytes has no room for an FCS, so the wrap may
not be reachable in practice; the bound costs one comparison and does not
depend on that argument holding.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The driver subtracts the FCS length from the radio-reported length and then
bounds the result with __ASSERT_NO_MSG alone, which compiles out at
CONFIG_ASSERT=n - the production default. A length below the FCS size
wrapped to ~254 and drove the packet allocation and copy.
Add the lower bound before the subtraction and a runtime length check,
matching what the nrf5 driver already does.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The ACK length reported by the NBU was memcpy'd into a fixed
rx_ack_data[IEEE802154_MAX_PHY_PACKET_SIZE] buffer with no bound.
Drop an ACK that does not fit rather than copying past the end of the
buffer; a zero length tells mcxw_tx() that no ACK was received.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The frame-length register was used raw. MCR20A_RX_FRM_LENGTH_MASK is
defined but was never applied, and there was no lower bound, so len - 2
wrapped to ~254 and drove read_rxfifo_content(), which reads into the first
net_buf fragment only - overflowing that fragment.
Apply the mask, reject a length below the FCS size, and check the fragment
tailroom before the FIFO read.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The call site only checked that the radio-reported length was non-zero, so
a length below KW41Z_FCS_LENGTH underflowed pkt_len = len - FCS_LENGTH and
drove an oversized packet allocation and copy.
Reject such a length, and check the tailroom of the first net_buf fragment
before the copy loops, which write into that fragment only.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Some Renesas RA USBFS variants only have 5 pipes with a different
pipe layout compared to the standard variant:
- Pipe 0: control transfer
- Pipes 4-5: bulk transfer only
- Pipes 6-7: interrupt transfer only
- No isochronous support
Previously, all non-control endpoints were unconditionally advertised
as supporting bulk, interrupt, and isochronous transfers, which is
incorrect for this variant
Therefore shim-code udc_renesas_ra.c needed changes to properly configure
the pipe-configuration for this 5-pipe usbfs variant.
Signed-off-by: Victor Hogeweij <hogeweyv@gmail.com>
Crypto driver nested in the Infineon MXCRYPTO mfd driver.
The driver supports select AES and Hash operations.
Assisted-by: Claude:claude-opus-4.7
Signed-off-by: Laura Carlesso <laura.carlesso@infineon.com>
MXCRYPTO mfd driver intended to supported a crypto driver and
a trng (entropy) driver.
Assisted-by: Claude:claude-opus-4.7
Signed-off-by: Laura Carlesso <laura.carlesso@infineon.com>
The need_setup member of struct i2c_dw_dev_config only exists when
CONFIG_I2C_ALLOW_NO_STOP_TRANSACTIONS is enabled, and every other
access to it in the driver is wrapped in a matching #if. The write
added in i2c_dw_transfer() to require a re-setup after a failed or
aborted transaction was left unguarded, so the driver fails to build
whenever that option is off:
drivers/i2c/i2c_dw.c:1032:19: error: 'struct i2c_dw_dev_config'
has no member named 'need_setup'
Wrap the write in the same #if used by the rest of the driver.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
uart_gecko_irq_tx_enable() enables both the TXBL and TXC interrupts,
but nothing in the standard interrupt-driven flow clears the TXC
flag: it is write-1-to-clear and only uart_gecko_irq_tx_complete()
clears it, which typical interrupt handlers (servicing
uart_irq_tx_ready() and uart_irq_rx_ready()) never call. Once a
transmission completes, TXC stays pending and the UART interrupt
re-enters continuously whenever TX is enabled, spinning at hardware
interrupt priority between TXBL servicing opportunities.
This is the same defect as in the silabs usart driver fixed by the
previous commit, where it was measured on hardware (82017 ISR entries
for 1811 TX-ready services on xg24_rb4186c). The gecko driver shares
the exact structure: TXC enabled as an interrupt source, no stale
flag clearing in irq_tx_enable() or irq_tx_disable(), and
irq_is_pending() not reporting TXC. This change is build-tested for
slwrb4104a but not validated on Series 0/1 hardware.
Only enable TXBL, which is sufficient to pace FIFO refills, and clear
the stale TXC flag when TX is disabled so uart_irq_tx_complete()
cannot report a completion from a previous transmission.
Assisted-by: Claude:claude-fable-5
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
uart_silabs_irq_tx_enable() enables both the TXBL and TXC interrupts,
but nothing in the standard interrupt-driven flow clears the TXC flag:
it is write-1-to-clear and only uart_silabs_irq_tx_complete() clears
it, which typical interrupt handlers (servicing uart_irq_tx_ready()
and uart_irq_rx_ready(), as the console, shell and Bluetooth monitor
do) never call. Once the first frame completes, TXC stays pending and
the UART interrupt re-enters continuously for the whole duration of a
transmission, spinning at hardware interrupt priority between TXBL
servicing opportunities (one byte time apart at the configured baud
rate). The driver's own irq_is_pending() does not include TXC either,
so the documented "while (uart_irq_is_pending())" handler idiom cannot
observe the interrupt cause it is being invoked for.
This is distinct from and not addressed by commit 3a6406439c
("drivers: serial: silabs: Only clear processed flags"), which fixed
flag clearing inside irq_tx_complete() itself but did not change TXC
being enabled as an interrupt source that no standard handler
acknowledges.
Measured on xg24_rb4186c with an interrupt-driven TX user that
services only uart_irq_tx_ready(): 82017 ISR entries for 1811 TX-ready
services. The storm throttles every thread on the CPU to the UART
byte rate, and starves the radio hard enough to break Bluetooth link
supervision under load. With this fix the same workload shows 805139
TX-ready services in 806757 ISR entries.
Only enable TXBL, which is sufficient to pace FIFO refills, and clear
the stale TXC flag when TX is disabled so uart_irq_tx_complete()
cannot report a completion from a previous transmission. TXC remains
readable through uart_irq_tx_complete(), which uses the raw interrupt
flag rather than the enabled mask.
The eusart driver also enables TXC from irq_tx_enable(), but clears
stale TXC flags in both irq_tx_enable() and irq_tx_disable(), which
prevents the storm; this was verified on the same hardware (497
interrupts for 497 TX-ready services when transmitting 512 bytes).
The legacy gecko driver shares the vulnerable structure and is fixed
in the following commit.
Assisted-by: Claude:claude-fable-5
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
Move the BT_RX_STACK_SIZE default out of the HCI driver Kconfig
and into the common Espressif defconfig, next to the other
Bluetooth subsystem defaults.
The BT_ESP32 block is now shared by both architectures instead of
being duplicated under RISCV and XTENSA, so the stack default also
applies to the Xtensa targets.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
Report errors returned by pinctrl_apply_state() and
i2c_stm32_runtime_configure() in i2c_stm32_recover_bus() that were
not.
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Bitbang bus recovery sequence supports only standard and fast speeds,
not higher ones. Force fast speed for the recovery sequence unless
the bus runs at standard speed in which case calling i2c_bitbang_init()
is enough.
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Restore the bus current speed when exiting bus recovery, not the
speed initially set from the DT.
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Correct the STM32 I2C bus recovery sequence in the non-RTIO driver
where bus semaphore (acting as a mutex) was taken twice before this
change. Fix that by taking the semaphore outside of the
i2c_stm32_runtime_configure() functions.
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Header file include/zephyr/sys_clock.h is deprecated since commit
84fbdcb06d ("include: zephyr: Deprecate include/zephyr/sys_clock.h")
and will be removed someday. Update Zephyr file tree to include
include/zephyr/sys/clock.h instead.
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Explicitly set the addressing type during target mode registration.
In the DW implementation, the addressing type is configured
independently for controller and target modes, so this change also
removes setting of the target mode address type during controller
mode configuration.
Tested on Realtek rts5915 board with an EEPROM target enabled.
Signed-off-by: Keith Short <keithshort@google.com>
Add missing dependencies on the HAL module for sensors that use the HAL
headers. This fixes compile time errors for `build_all` tests downstream
that don't have the HAL checked out.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Add missing dependencies on the HAL module for sensors that use the HAL
headers. This fixes compile time errors for `build_all` tests downstream
that don't have the HAL checked out.
Signed-off-by: Jordan Yates <jordan@embeint.com>
If an i2c transaction got past setting the need_setup but didn't
complete for some reason the i2c driver would send the next transaction
to that address regardless of what was passed into the driver. Update the
i2c_dw_transfer error handler to reset need_setup to true since the failed
transaction is no longer active.
Also adds a check in setup to verify that the target address is the address
that is setup, if not require setup.
Signed-off-by: Brandon Breitenstein <brandon.breitenstein@intel.com>
Add a stub configure callback to the native PTY UART driver when
CONFIG_UART_USE_RUNTIME_CONFIGURE is enabled.
The stub accepts valid configuration requests without applying any UART
settings and returns -EINVAL when the configuration pointer is NULL.
This enables applications that require the runtime UART configuration API,
such as Modbus RTU, to use the native PTY UART driver.
Signed-off-by: Hans Wilmers <hans@wilmers.no>
Override FM_MutexTake and FM_MutexRelease function definitions to comply
with the changes introduced in STM32CubeWBA v1.10.0.
Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
Add IMX_CCM_ENC1/2/3/4_CLK macros to imx_ccm_rev2.h and handle them
in the CCM rev2 driver's clock-enable and rate-query callbacks. The
ENC clock gate maps to kCLOCK_Enc1+instance (LPCG 118-121); the rate
root is kCLOCK_Root_Bus_Wakeup per RM Table 136.
Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
Register addresses are forced to bus-byte-order for I2C transfers, and
product IDs are converted from the little-endian representation read
from the device. This keeps the values correct on both little-endian and
big-endian systems.
Signed-off-by: Mingzong Zhao <mingzong.zhao@outlook.com>
xpt2046_isr_handler() unconditionally removes the GPIO callback before
submitting the work item, and the gpio_add_callback() at the end of
xpt2046_work_handler() is the only place it is ever registered again. The
averaging loop returns early when a SPI transfer fails, jumping over that
call.
gpio_manage_callback() really unlinks the node, so the pin interrupt stays
armed but is dispatched to an empty callback list, and nothing else - no
retry, timer or PM hook - ever registers it again. A single transient
-EIO or -EBUSY from a shared SPI bus while the user is touching the panel
therefore leaves the touchscreen permanently silent until the next reboot.
If a touch was in progress, the 100 ms delayed work emits one last
BTN_TOUCH 0 and nothing after that.
Branch to the re-registration instead of returning, so the callback is
restored on every exit path.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
gt911_process() tracked the previous scan in function-scope statics:
static uint8_t prev_points;
static struct gt911_point_reg prev_point_reg[...];
GT911_INIT is expanded by DT_INST_FOREACH_STATUS_OKAY, so every panel
shares one snapshot even though gt911_process() is passed the device it
is working on.
With two goodix,gt911 nodes the release loop compares one device's
current point ids against the other's cached points, and the memcpy
overwrites the snapshot with whichever ran last. A release on the first
panel then carries the second panel's coordinates, and the second panel's
still-active touch is erased from the cache, so its real lift finds
prev_points == 0 and emits no release at all, latching BTN_TOUCH=1. This
is aliasing rather than a data race, so workqueue serialization does not
help.
Move both into struct gt911_data. struct gt911_point_reg has to be
defined before struct gt911_data to be usable as a member.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
Add a shell command that allows enabling or disabling SMBus Packet
Error Checking (PEC) at runtime for a given SMBus device. This is
useful for testing and debugging PEC-related transactions without
having to modify and rebuild application code.
Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
PEC can be enabled through smbus_config and is supported by all SMBus
protocols except Quick.
In addition, hardware PEC is not supported for Process Call and Block Read
transactions in FIFO mode. Software PEC is calculated instead.
Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
Use the vcpu argument when issuing XEN_DOMCTL_getvcpucontext and
XEN_DOMCTL_setvcpucontext. The wrappers already accept a target vCPU,
but always forwarded vCPU0 to Xen.
This lets Dom0 callers get or set the context of secondary vCPUs in SMP
domains.
Signed-off-by: Vladyslav Goncharuk <vladyslav_goncharuk@epam.com>
Assisted-by: Codex:gpt-5 cpp-code-map
Adjust base_timestamp_ns backward from the trigger timestamp by
(N-1)*period so it reflects the time of the first FIFO sample,
matching the lsm6dsv16x reference implementation.
Fixes: #98720
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
(cherry picked from commit 2e9f16f337e5ae2748257871328d2bc29f442bd5)
MISRA C:2012 Rule 8.2 requires every parameter in a function type to be
named, including the parameters of function pointer parameters.
The XMC4xxx GPIO interrupt helper and the XMC7200 system interrupt
helper declared their callback parameters with bare types.
Name them after the arguments the documentation or the
definitions already use. No functional change.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Add support for tracking heavy sleep duration on the RTS5912/RTS5915
using the low-frequency RTMR (RTOS Timer) 32KHz clock domain.
- Expose rts5912_clock_capture_low_freq_timer(),
rts5912_clock_compensate_system_timer(), and
rts5912_clock_get_sleep_ticks() in soc_clock.h.
- Capture timer reading prior to WFI in rts5912_heavy_sleep() and
accumulate elapsed sleep cycles upon wake-up after clock restoration.
Signed-off-by: Keith Short <keithshort@google.com>
Assisted-by: Antigravity:gemini-1.5-pro
When the RTOS timer (RTMR) expires and reaches 0, the hardware sets the
interrupt status bit (RTOSTMR_INTSTS_STS_Msk). If rtmr_get_counter() is
called while interrupts are locked (or before rtmr_isr() clears INTSTS),
counter == 0 is sampled.
Previously, rtmr_get_counter() unconditionally replaced counter == 0
with previous_cnt (assuming 0 meant an unlatched restart). This caused
sys_clock_cycle_get_32() to compute previous_cnt - cur_cnt = 0 elapsed
cycles, leading to a backward jump in the cycle count.
Fix this by checking !(RTMR_REG->INTSTS & RTOSTMR_INTSTS_STS_Msk) so
that a genuine 0 count from an expired timer is preserved until the ISR
runs.
Without this fix, the new test_timer_monotonic_irq_locked fails. With
this fix, test_timer_monotonic_irq_locked passes.
Also verified no regressions on the rts5912_evb board:
* kernel.tickless.concept
* kernel.poll.minimallibc
* kernel.poll
* kernel.timer.monotonic
* kernel.timer.timepoints
Signed-off-by: Keith Short <keithshort@google.com>
Assisted-by: Antigravity:gemini-1.5-pro
The ti_dmtimer driver used to use the first enabled compatible timer
instead of honoring the chosen zephyr,system-timer property. This has been
fixed.
Signed-off-by: Mika Braunschweig <mika.braunschweig@siemens.com>
Enable FIFO_TMST_FSYNC_EN in FIFO_CONFIG4 so the sensor inserts a
16-bit hardware timestamp into every 20-byte FIFO packet. Set
TMST_RESOL=1 (16us/tick) to support batch spans up to ~524ms.
In the decoder, anchor the batch to the host IRQ time via the last
packet's hardware timestamp, then compute base_timestamp_ns and
per-sample timestamp_delta using the signed 16-bit delta between
packet timestamps. This handles wraparound naturally and gives exact
inter-sample timing without assuming a uniform ODR.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
In i3c_sec_get_basic_info() and i3c_sec_i2c_attach(), a descriptor is
allocated from the mem-slab pool when a DEFTGTS-reported device is not
already in the device list. If the subsequent attach (or temporary detach)
fails, free that pool descriptor instead of leaking the slot. Descriptors
found in the static device list are left untouched via the in_pool check.
Also zero-initialise the temporary descriptor in i3c_sec_get_basic_info()
so its unused fields are not garbage stack values when passed to attach.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>