Implement the I2C callback API (CONFIG_I2C_CALLBACK) and a transfer
timeout backstop for the Bee controller.
The transfer path is refactored into i2c_bee_start(), which kicks off a
transaction, and i2c_bee_complete(), which finalizes it from the
completion ISR. i2c_bee_transfer_cb() arms the transfer, stores the
user callback and, unless the timeout is K_FOREVER, starts a watchdog
timer; the callback is invoked from ISR context on completion. The
blocking i2c_bee_transfer() now waits on the sync semaphore with the
configured transfer timeout and returns -ETIMEDOUT on a hung bus.
Because the completion path releases the bus lock from ISR context, the
bus mutex is replaced with a binary semaphore (a mutex cannot be given
back from an ISR). The driver selects I2C_TRANSFER_TIMEOUT_SUPPORTED and
honors CONFIG_I2C_TRANSFER_TIMEOUT_MS via I2C_DT_INST_TRANSFER_TIMEOUT().
Signed-off-by: Yuzhuo Liu <yuzhuo_liu@realsil.com.cn>
Add optional I2C bus recovery for the Bee controllers. When
CONFIG_I2C_BEE_BUS_RECOVERY is enabled and scl-gpios/sda-gpios are
provided on the I2C node, recover_bus() temporarily muxes the pins to
GPIO and drives the standard bit-bang recovery sequence via the shared
i2c_bitbang helper, then restores the pinctrl default state and
reprograms the controller with the cached configuration.
On RTL87X2G the recovery lines are configured once as hardware
open-drain outputs, so each bit-bang edge is a single data-register
write that meets the SCL timing. RTL8752H has no hardware open-drain,
so its callbacks emulate it by switching pin direction (input with
pull-up for high, output-low for low).
Signed-off-by: Yuzhuo Liu <yuzhuo_liu@realsil.com.cn>
Cache the last applied controller configuration and expose it through
the I2C get_config API. The configuration logic is split into a lockless
i2c_bee_do_configure() helper that performs the hardware programming and
records the active configuration word, and a thin i2c_bee_configure()
wrapper that keeps holding the bus lock around it. i2c_bee_get_config()
returns the cached word, allowing clients to query the current bus speed
and addressing mode.
Signed-off-by: Yuzhuo Liu <yuzhuo_liu@realsil.com.cn>
Wire up the I2C RTIO fallback submit handler so that the Bee I2C
controller can be used through the RTIO-based asynchronous API. The
fallback executes the submitted transactions on top of the existing
blocking transfer path, which keeps the change minimal while making the
device usable from i2c_iodev/rtio_submit based clients.
Signed-off-by: Yuzhuo Liu <yuzhuo_liu@realsil.com.cn>
Added standard controller driver per SD Specifications Part A2
SD Host Controller Simplified Specification (Version 3.00) which
matches current sdhc and sd subsystem features support.
It can be updated in the future for example to v4.20 if new
features are required to support.
For now, the driver provided standard registers definition and
access APIs, also provided a sdhc_standard_host_init API for host
properties/capabilities initialization.
Vendor drivers to reuse the standard host driver are required to
use sdhc_standard_host_common_config/sdhc_standard_host_common_data.
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Added sdhc_common.c for common code. For now, it provided
only one common API, for SDHC device tree properties
initialization.
Vendor drivers can convert to use sdhc_common_config and
sdhc_common_dt_props_init API.
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Renamed sdhc_helpers.h to sdhc_common.h for more usage
in the future. The SDHC needs a common c file for vendor
drivers reusing, and this file can be as its header file.
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Add support for the Xilinx AXI/XPS Interrupt Controller (PG099).
The driver integrates with Zephyr's next-level interrupt framework and
supports multiple interrupt controller instances described in devicetree.
Optional hardware features (IPR, SIE, and CIE) are selected at build
time from Vivado xlnx,has-* devicetree properties.
IER updates use sys_read32()/sys_write32() with a per-instance spinlock
when SIE/CIE registers are not synthesized. Fast interrupt mode is
rejected at build time.
Signed-off-by: Alp Sayin <alpsayin@gmail.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Signed-off-by: Satya Sri <satyasri.katru@amd.com>
Update the driver for using the generic timer core.
Enable the TICKLESS_CAPABLE support for mchp_pit_g1_timer.
Signed-off-by: Tony Han <tony.han@microchip.com>
Announce PICNT directly in tickful ISR by removing the unnecessary
multiplication and division.
Add a guard for early calls for "mchp_pit_get_cycles()" before MMIO is
mapped.
Signed-off-by: Tony Han <tony.han@microchip.com>
Add initial driver support for the AMS AS7341 11-channel spectral sensor.
The driver communicates over I2C and implements the Zephyr sensor API.
- Add driver source files (ams_as7341.c, ams_as7341.h)
- Add devicetree binding (ams,as7341.yaml)
- Add Kconfig and CMakeLists.txt integration
Signed-off-by: Parin Baudhanwala <parin.baudhanwala@dnkmail.in>
Fixes a Kconfig bleeding when the driver it impacts is not
enabled. The Kconfig has not been renamed, but looks to have been
mis-named as it applies to MTL_TLB and just not TLB, which is a
different Kconfig and driver
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Fixes a dependency for a Kconfig that bleeds, which looks to have
added the same dependency requirement twice by mistake
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
System timer speed is now calculated from the timebase-frequency value.
Increase timebase-frequency for all SoCs.
Signed-off-by: Camille BAUD <mail@massdriver.space>
In the async RX DMA completion callback, dma_reload() and dma_start()
were called after three user-visible callbacks (UART_RX_RDY,
UART_RX_BUF_RELEASED, UART_RX_BUF_REQUEST). During this window the
DMA was idle and only the RX FIFO protected against data loss.
Reorder the callback so that dma_reload() and dma_start() are called
immediately after the driver state is updated, before any user
callbacks are issued. Bytes arriving during the callbacks are then
captured by DMA rather than stalling in the RX FIFO.
Signed-off-by: Michal Chromec <michal.chromec@nxp.com>
Add the NPCM pin controller driver. It selects a pin's function by
writing the SCFG bits listed in devicetree, and sets the pull and
voltage level when requested.
Also add the NPCM4 pin function and pin group tables.
Signed-off-by: Alan Yang <tyang1@nuvoton.com>
Include the UART needed for console output on the Erbium board. Its
original Shakti integration uses 32-bit MMIO accesses at eight-byte
register intervals, while the generic Shakti driver uses four-byte
intervals and mixed access widths.
Use openhwgroup,shakti-uart-v1 to identify the original register layout,
with interrupt enable at 0x30 and receive threshold at 0x40. The later
Erbium UART has a different interrupt register layout. Link the public
register documentation for the supported revision in the binding [1].
Follow the documented transmit flow: wait for space in the FIFO and
write the character. The functional emulator [2] also enqueues data on
the TX write, without additional configuration-register writes.
Provide polling input/output, receive error reporting and fixed 8N1
initialization. Calculate the baud divisor at build time from devicetree
clock-frequency and current-speed. Reject zero baud rates and divisors
outside 1..65535 with build assertions. Keep the divisor in the constant
device configuration and program it once at initialization. Use the
device MMIO API and add the serial Kconfig and CMake integration.
Validate polling transmit and receive with actual input on the public
et-platform functional emulator at 836a4ab600e93. Interrupt-driven,
asynchronous and runtime line-configuration APIs remain unsupported.
[1] 325b32b7ef/doc/uart.md
[2] 836a4ab600/sw-sysemu/devices/shakti_uart.h
Signed-off-by: Afonso Oliveira <afonso.oliveira707@gmail.com>
Assisted-by: Codex:GPT-6
The 16-bit CMT1 counter is extended to 32 bits in software: a read
counts a wrap when it sees the IR flag, or the count going backwards
during the read, then clears IR. A wrap landing between the count
sample and that clear loses its flag, and the next read sees neither
the flag nor a backwards step. The count then steps back by a period,
which the core announces as a jump of about 2^32 cycles (716 s at
6 MHz). Since commit dc295cc414 ("drivers: timer: renesas_rx_cmt:
use the generic timer core") the alarm can be armed for COUNTER_MAX,
one count short of a CMT1 period, so the read point creeps through the
period and regularly hits that window. Nothing but the alarm paced the
reads either, so two wraps could also pass between them.
Remember the last count read, so a count below it is a wrap whatever
became of the flag, and enable CMT1's compare-match interrupt to do a
read every period, so wraps can't pile up between reads however the
alarm is armed. Accepting the interrupt clears IR; a read that already
folded the wrap leaves nothing for the interrupt to add.
The wrap interrupt also wakes the CPU from idle, so raise the number
of early wakes the k_cpu_idle() test allows for this driver.
Fixes#123189
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
When the driver receives the PM_DEVICE_ACTION_RESUME notification,
the Link Layer deep-sleep exit function is called regardless of
the standby_entered value, and the NVIC configuration for the radio
is restored regardless of the Link Layer state.
Signed-off-by: Vincent Tardy <vincent.tardy@st.com>
When the driver receives the PM_DEVICE_ACTION_RESUME notification,
the Link Layer deep-sleep exit function is called regardless of
the standby_entered value, and the NVIC configuration for the radio
is restored regardless of the Link Layer state.
Signed-off-by: Vincent Tardy <vincent.tardy@st.com>
Bus recovery muxes SCL and SDA to GPIO while the SCB stays enabled, and
every later transfer on the instance times out after a recovery.
The driver now disables the SCB before taking the pins and re-enables it
once they are restored.
Assisted-by: Copilot:claude-opus-5.5
Signed-off-by: John Batch <john.batch@infineon.com>
The interface was registered with GENET_MAX_FRAME_LEN, the 1536 byte
frame length programmed into the MAC, as its MTU. That made TCP and IP
fragmentation build packets up to 1536 bytes of L3 payload, which
exceeds the Ethernet frame size the MAC is configured for.
Register the interface with NET_ETH_MTU. The MAC frame length register
keeps GENET_MAX_FRAME_LEN.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
The ETHERNET_CONFIG_TYPE_MAC_ADDRESS case of set_config called
net_if_set_link_addr(). The caller of set_config,
NET_REQUEST_ETHERNET_SET_MAC_ADDRESS, updates the link address of the
interface itself once set_config succeeded, and the driver should only
register the initial address from iface_init. Only store the address
in the driver data.
Assisted-by: Claude:claude-opus-5.5
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
The ETHERNET_CONFIG_TYPE_MAC_ADDRESS case programmed the address
already stored in the driver data instead of the one passed in the
config, so the hardware kept the old MAC address. Store the new
address before programming it.
Assisted-by: Claude:claude-opus-5.5
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
When LV_Z_DRAW_PXP is enabled, the build requires the PXP driver
sources. Add it to the build.
Additionally, ensure `MCUX_PXP` is not enabled at the same time as
the PXP IRQ is required by both LVGL and the DMA driver resulting
in conflicts.
Signed-off-by: André Costa <andre_miguel_costa@hotmail.com>
Select CLOCK_CONTROL_ESP32_RTC_CLK_SRC_EXT_OSC when the
devicetree selects an external 32 kHz oscillator as slow clock
source, so the startup calibration uses the cycle count meant for
external slow clocks. This also applies the lower
CLOCK_CONTROL_ESP32_RTC_CLK_CAL_CYCLES limit used for external
slow clocks.
Assisted-by: Claude:opus-5
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
On the PMU based SoCs other than ESP32-P4 the devicetree value
ESP32_RTC_SLOW_CLK_32K_EXT_OSC reached rtc_clk_slow_src_set()
unchanged, which aborts because the slow clock mux has no such
input, and the external clock pad setup was unreachable. Map it
to SOC_RTC_SLOW_CLK_SRC_OSC_SLOW, enable the external clock input
for that source and calibrate it with CLK_CAL_32K_OSC_SLOW. When
the external clock does not start, release its input pad before
falling back to the internal RC. ESP32-P4 has no such input, so
the value is rejected there at build time and by
clock_control_configure().
Assisted-by: Claude:opus-5
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
After a CPU frequency change the console baud divider was
computed from the APB frequency, except under MCUboot. On
ESP32-C3 and ESP32-S3 the ROM clocks the console UART from XTAL,
so with simple boot the console ran at half the configured baud
until the UART driver reconfigured it, and stayed there when that
driver did not initialize. Read the UART source clock and compute
the divider from its actual frequency.
Assisted-by: Claude:opus-5
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
CLOCK_CONTROL_ESP32_RTC_XTAL_CAL_RETRY was never read. Both
drivers hardcoded three retries. Use the option, default it to
the count the drivers always used and drop the dependency on the
crystal source, since the crystal can also be selected at runtime
through clock_control_configure().
Assisted-by: Claude:opus-5
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
When the 32 kHz crystal does not start at boot, the slow clock
selection returned -ENODEV and the clock controller failed to
initialize, leaving every peripheral it clocks unusable. Switch
to the internal RC with a warning instead, as the retry comment
and Kconfig help already describe, and power the crystal down
once the RC is selected. A runtime request through
clock_control_configure() still returns -ENODEV.
Assisted-by: Claude:opus-5
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
A COMP write takes effect only once it has synchronized to the BURTC
clock, a few cycles later. An alarm a tick or two ahead could be passed
by then and fire only after the counter wrapped.
Raise the compare flag if the counter has already reached the alarm for
relative alarms and absolute alarms configured to expire when late.
Return -ETIME for late absolute alarms.
Assisted-by: Claude:claude-opus-5.5
Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
With CONFIG_COUNTER_SILABS_BURTC_ALARM, COMP holds the alarm and the
counter wraps at its full 32-bit range. Fix get_top_value() to return
the full range of the BURTC when COMP is used for alarms.
Assisted-by: Claude:claude-opus-5.5
Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
The L2 TLB translates both the cached and the uncached alias of a
virtual page, but the Xtensa MMU page tables hold the two aliases as
separate entries. The SoC MMU table maps both aliases statically only
for the virtual space backed 1:1 by physical L2, while
sys_mm_drv_map_page() mapped just the cached alias in the MMU.
Pages mapped beyond the end of physical L2 were therefore reachable only
through the cached alias. This leads to faults when use of coherent
(uncached) addresses is attempted.
Map and unmap the uncached alias together with the cached one when
mapping, unmapping or updating the flags of a page. The uncached
alias is never made executable. Unmapping it within the statically
mapped range restores the static entry.
Tested on NVL-S with the SOF check-playback test using the
sof-hda-generic-ace3-4ch topology.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
With CONFIG_ETH_NXP_ENET_HW_ACCELERATION the ENET inserts the IPv4
header checksum and the TCP, UDP and ICMP checksum into every IP frame
it sends. It computes them over the checksum fields as they are, so the
fields must be zero.
The stack leaves them zero only when it offloads the checksum for the
interface the packet was built on. Two kinds of frames reach the ENET
with the checksums filled in: frames forwarded by an Ethernet bridge,
which carry the sender's checksums, and frames sent by the bridge
interface itself, which is a virtual interface and so gets software
checksums. The ENET then sent them with wrong IPv4 header and ICMP
checksums, and the receiver dropped them.
Clear the fields in the TX copy of the frame before handing it to the
ENET. Frames with an 802.1Q tag are handled the same way, as the ENET
inserts their checksums too. Frames whose checksums the stack offloaded
are unchanged. IPv4 fragments keep their protocol checksum, which the
stack computes in software before fragmenting.
ICMPv6 is left alone: the ENET does not insert its checksum.
Tested on mimxrt1170_evk@B/mimxrt1176/cm7 bridging ENET and ENET_1G
between two Linux hosts, capturing every frame the board sent. Before:
the bridge's own ICMP replies had IPv4 and ICMP checksums 0xffff, and
the receiving NIC dropped all forwarded IPv4 frames and the forwarded
IPv6 TCP and UDP frames; forwarded ICMPv6 and IPv6 fragments were fine.
After: forwarded ICMP, UDP and TCP over IPv4 and IPv6, ICMP to the
bridge address, and 3000 byte IPv4 and IPv6 fragmented pings all pass,
with no bad checksum in 547 frames. Forwarded ICMP, UDP and TCP frames
tagged with VLAN 100 had 0xffff checksums before and pass after.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
DEVICE_DT_GET_OR_NULL(nwp) emits a reference to the NWP device even
when the pointer is unused. At -O0 , with debug optimization disabled,
that reference is kept, so builds without CONFIG_SILABS_SIWX91X_NWP fail
to link.
Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
Nothing uses them; removing them also drops non-inclusive terminology
from the driver.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5.5
gpio_ite_isr() and gpio_ite_pin_interrupt_configure() previously
submitted data->interrupt_worker to k_sys_work_q unconditionally on
every GPIO interrupt and configuration call, even when only
edge-triggered interrupts were enabled on the port. Under high-rate
edge interrupts, this floods k_sys_work_q with hundreds of no-op work
submissions per second.
Only submit data->interrupt_worker when the pin is configured for
level-triggered interrupts, clear level_isr_low and level_isr_high
when disabling a pin's interrupt with GPIO_INT_MODE_DISABLED, and skip
pins with disabled IRQs in gpio_ite_interrupt_worker().
TEST=./twister -s drivers.gpio.ite_it8xxx2_v2
TEST=Boot hylia and verify k_sys_work_q is not flooded by edge IRQs
Signed-off-by: Rob Barnes <robbarnes@google.com>
Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
COND_CODE_1() strips the parentheses around its code argument, leaving
the ?: of SMC_DATA_BUS_WIDTH(), SMC_BYTE_ACCESS_TYPE() and
SMC_PAGE_MODE() bare in the bank's mode expression, where it binds
looser than the surrounding |. Introduced in commit 0947bcca5a
("drivers: memc: sam_smc: configure SAME70 SMC mode fields").
This drops the NRD/NWE controlled read and write modes: banks get
SMC_MODE_PMEN | SMC_MODE_PS_4_BYTE, or only SMC_MODE_DBW_16_BIT when
atmel,smc-data-bus-width is set. On a SAM4S with an 8-bit device on
NCS0 every read returned garbage.
Select each field with COND_CODE_1() on its enum index or boolean, as
done for the read and write modes, so no ?: is left to expose.
Assisted-by: Claude:claude-opus-5.5
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
BIT(11) is an unsigned long, so on 64-bit targets multiplying the
signed acceleration by it makes the conversion unsigned and negative
values end up as large positive register values. Multiply by a signed
value.
Assisted-by: Claude:opus-5.5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
BIT(31) is an unsigned long, so on 64-bit targets dividing the signed
temperature by it converts negative values to large positive ones and
the emulator reports the wrong temperature. Divide by a signed value.
Assisted-by: Claude:opus-5.5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The stream decoder stored a pointer to the next sample in the uint32_t
fit cursor. On 64-bit targets the pointer is truncated, and the casts
back to a pointer fail to build with -Werror=int-to-pointer-cast.
Store the offset of the next sample in the encoded buffer instead.
Assisted-by: Claude:opus-5.5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>