Move the per-SoC clock logic out of the single clock_control_esp32.c
into two family files selected at build time: one for the RTC_CNTL
based parts (esp32, s2, s3, c2, c3) and one for the PMU/LP_CLKRST
based parts (c5, c6, h2, p4). Shared device API ops, init and the
common includes move to a shell file and a private header.
This removes the cross-series preprocessor chains that dominated the
CPU and slow-clock routines and matches how other multi-SoC clock
drivers are organized in the tree.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
data is only used if CONFIG_I2C_TARGET is enabled.
Let's move its declaration into that ifdef to avoid a compiler
warning.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
The SPI_STM32_BUSY_FLAG_TIMEOUT option had no help text, leaving
users with no explanation of its purpose when browsing menuconfig. Add
a description that documents how long the driver polls for the BSY flag
to clear after a DMA transfer on STM32F7 and STM32L4 devices affected
by the busy-flag errata.
Assisted-by: OpenAI Codex:gpt-5
Signed-off-by: Collins Culbert <coculbert@icloud.com>
The STM32 I2C V1 and V2 peripherals can generate spurious Bus Error
(BERR) flags in controller mode. This is documented in multiple
errata sheets:
- ES0182 (STM32F40x/41x), Rev 18, section 2.10.1
- ES0392 (STM32H74x/75x), Rev 15, section 2.19.4
The recommended workaround is to clear the BERR flag and take no
further action, letting the transfer continue normally. If a real
bus error occurs, the transfer will time out.
This change (including description above) port commit 74ae38ceeb
("drivers: i2c: stm32: ignore spurious BERR in controller mode") in
the STM32 I2C RTIO drivers.
Reword inline comments and make them consistent across STM32 I2C v1 and
v2 drivers, non-RTIO and RTIO.
Co-authored-by: Raguraj Rajendran <raguraj.rajendran@rapyuta-robotics.com>
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
When BTF fires after the last byte is transmitted, it calls handle_txe()
with data->xfer_len already at 0. The else branch generates a stop
condition and signals completion, but does not disable ITBUFEN first.
Since TXE is level-triggered and remains asserted until DR is written,
the event ISR can re-fire on the stale TXE flag.
During a write-read combined transfer (e.g., register read), the write
phase completes and msg_read() calls enable_transfer_interrupts() which
re-enables ITBUFEN. However, the TXE flag from the write phase is still
asserted (hardware only clears it on DR write or ADDR clear). The event
ISR sees TXE=1 but is_write is now false, so no handler matches and the
ISR returns without clearing TXE — causing an infinite interrupt loop.
Catch TXE active during a read transfer Iin i2c_stm32_event() and
disable ITBUFEN to quench the stale TXE interrupt source.
Re-enable ITBUFEN after clearing ADDR in handle_addr(). The ADDR
clear implicitly clears TXE, so re-enabling ITBUFEN at this point
is safe and ensures RXNE interrupts work correctly for the read
phase.
This change (including the above description) ports commit 83f8c21a23
("drivers: i2c: stm32_v1: fix ISR storm on write-read repeated START")
in the STM32 I2C v1 RTIO driver.
Co-authored-by: Gowtham Palanichamy <gowtham.palanichamy@rapyuta-robotics.com>
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
When BTF fires after the last byte is transmitted, it calls handle_txe()
with data->xfer_len already at 0. The else branch generates a stop
condition and signals completion, but does not disable ITBUFEN first.
Since TXE is level-triggered and remains asserted until DR is written,
the event ISR can re-fire on the stale TXE flag.
Add LL_I2C_DisableIT_BUF() at the top of the else branch as a defensive
measure so the level-triggered TXE cannot re-enter the ISR after the
transfer is logically complete.
This change (including the description above) ports commit 83f8c21a23
("drivers: i2c: stm32_v1: disable ITBUFEN in handle_txe on completion")
in the STM32 I2C v1 RTIO driver.
Co-authored-by: Gowtham Palanichamy <gowtham.palanichamy@rapyuta-robotics.com>
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Fix handling of cancelled transfers in MCUX USB device controller
drivers (EHCI and IP3511). When a transfer is cancelled, the MCUX
controller returns USB_CANCELLED_TRANSFER_LENGTH as the transfer
length. Previously, this special value was treated as a valid
transfer length and callback 0 for this transfer, causing incorrect
transfer operations in class codes.
Add proper detection of cancelled transfers by checking for
USB_CANCELLED_TRANSFER_LENGTH and returning -ECONNABORTED error
code.
Signed-off-by: Mark Wang <yichang.wang@nxp.com>
Add a native Zephyr WiFi driver for the BL616/BL618 SoC family.
The driver interfaces with the vendor macsw blob through wl80211 and
implements the Zephyr wifi_mgmt API for station connect/disconnect,
scanning, and AP mode. WPA supplicant integration is provided via
the hostap subsystem.
Signed-off-by: William Markezana <william.markezana@gmail.com>
Extend bflb_rf_init() to support WiFi mode (WL_API_MODE_ALL) with
TX power targets and country code configuration when CONFIG_BFLB_WIFI
is enabled.
Add WiFi platform glue: MAC ISR wiring, task creation, low-power
stubs, wl80211 RTOS primitives (heap, RNG, timers), and the linker
section for WiFi shared RAM.
Introduce CONFIG_BFLB_BL61X_WL_RMEM_SIZE for PHY/RF retention memory
sizing.
Signed-off-by: William Markezana <william.markezana@gmail.com>
Correct inline comment that should refer to DT_DRV_INST() macro
instead of DT_DRV_COMPAT macro.
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
The comma was removed during the migration in commit ad1e5ac253. All
usages of this driver inside the Zephyr tree use only one channel,
which doesn't trigger the issue.
Signed-off-by: Marek Maškarinec <marek@mrms.cz>
The variable ret was not used, and the compiler warned as much.
Let's just remove it.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Update the driver used for ESP32, ESP32-S2 and ESP32-S3 to the
latest version and add support for ESP32-P4.
Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
- Removes the compile-time guard so the peripheral clock is always
enabled in the driver init path, ensuring the WWDT registers
are accessible.
Otherwise, at least for MCXA, WWDT register access by
mcux_wwdt_config_func()->WWDT_ClearStatusFlags() triggers
data bus fault.
- Tested on frdm-mcxa266.
Signed-off-by: Andrej Butok <andrey.butok@nxp.com>
Add bus recovery in STM32 I2C RTIO drivers using a work to ensure it
does not execute from an interrupt context. For sake of simplicity,
always use this sequence even if the initial call already executes
from a thread context.
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Move the STM32 bus recovery sequence to STM32 I2C common driver
to factorize when used with the RTIO drivers flavors.
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Support collection of the most common ethernet statistics.
This currently does not utilize any hardware statistics counters,
but rather collects the stats in software.
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
Add blobs presence dependency to the KConfig IEEE802154_STM32WBA
Add zephyr_blobs_verify() CMake function for STM32 HAL
Signed-off-by: Vincent Tardy <vincent.tardy@st.com>
Add pre-checks on w_index before accessing target_in_buffer to prevent
OOB memory access triggered by an oversized I2C transaction.
Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
Lis2dh interrupts were only fired for up events. Fixed it by adding
down event enable bits to the ANYM_CFG.
Signed-off-by: Matthias Alleman <matthias.alleman@basalte.be>
* Use if, endif to scope the configuration options.
* Add an option to use mbedtls_ct_memcmp instead of memcmp.
Signed-off-by: Georgij Černyšiov <geo.cgv@gmail.com>
Adds AES GCM and CCM support to the STM32 crypto driver.
As the implementation has only been validated on a
limited number of STM32 SoCs, it is enabled only
for platforms that set the DT boolean property
`gcm_ccm_supported`.
Note: To use CCM with additional authenticated data (AD),
the heap memory pool size must be large enough to
accommodate the AD length, rounded up to the nearest
multiple of 16 bytes. For an AD length of 8 bytes,
the heap size must be at least 16 bytes. For an AD
length of 17 bytes, you'll need at least 32 bytes.
Signed-off-by: Georgij Černyšiov <geo.cgv@gmail.com>
Device semaphore handling is being moved out of the do_aes function.
This is necessary to support upcoming GCM and CCM modes,
which require the semaphore to be held during tag generation.
Signed-off-by: Georgij Černyšiov <geo.cgv@gmail.com>
Calling MXC_USB_Ackstat(0) immediately on SETUP receipt causes the
hardware to send the STATUS IN ZLP autonomously. The host then
issues the next SETUP before the Zephyr stack enqueues its own
STATUS IN.
Fix by deferring MXC_USB_Ackstat(0) to udc_event_xfer_in() when
the stack enqueues the STATUS IN ZLP. A nodata_setup flag tracks
whether the pending transfer is a no-data SETUP status stage.
Signed-off-by: Furkan Akkiz <hasanfurkan.akkiz@analog.com>
Add standard Zephyr GPIO driver for Allwinner H618 SoC.
This driver supports pin configuration, reading/writing,
and basic external interrupt configuration.
Signed-off-by: Khai Do <dovankhai97@gmail.com>
- systick: split multi-statement lines into one per line (Zephyr style)
- ch32v103.dtsi: add missing reg property alongside ranges in flash0 node
Signed-off-by: Lucy Wong <mova845@outlook.com>
Extend the WCH RCC clock controller with CH32V10x flash wait-state
configuration. Update the systick driver to handle the V3A register
difference: CTLR.CNTIF is used instead of SR for interrupt clearing.
Signed-off-by: Lucy Wong <mova845@outlook.com>
Add initial clock controller driver support for the Microchip
SmartFusion2 platform.
This commit introduces a SmartFusion2-specific clock control
driver together with the required Devicetree binding definitions
for clock and interrupt integration. The implementation enables
basic clock management infrastructure required for SoC and future
peripheral support.
Signed-off-by: Anton Vynohradov <vynohradov.external@bavariamatic.com>
This works, because the API stayed the same between gecko_sdk and
simplicity_sdk.
This driver allows xg13 SoCs to use an RTCC based counter while the RTCC
peripheral is used for the silabs sleeptimer service.
Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
The sleeptimer service from the gecko_sdk is a generic API which supports
multiple hardware timer peripherals internally. The reason we want to use
this rather than a Zephyr native driver, is that sleeptimer is what's used
by the power_manager service from the SDK which in turn is used by librail.
Combined with other, future commits, this will allow reducing the power
consumption of gecko_sdk based SoCs while they are idle.
Since the APIs between gecko_sdk and simplicity_sdk are the same, all
that's needed is to adjust the Kconfig dependencies and compile the
relevant sdk code. For now, this supports the RTCC peripheral only, which
is used on efr32mg13p, which is what I test with.
Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
The NXP MCXE31x Wake-up Unit (WKPU) is register-compatible with the
S32K3 WKPU already supported by the intc_wkpu_nxp_s32 driver: same
register map, base address 0x402B4000, IRQ 83, and 64 wake-up
sources. Bind the MCXE31x WKPU node to that driver by switching its
compatible from the placeholder "nxp,wkpu" (which had no binding or
driver behind it) to "nxp,s32-wkpu".
Every SoC that instantiates this controller exposes 64 wake-up
sources, so generalise NXP_S32_WKPU_SOURCES_MAX to a plain
"default 64" instead of a per-SoC-series default; the range 32-64
still lets a future 32-source part override it.
The node lives in the shared nxp_mcxe31x_common.dtsi, so this enables
the WKPU on MCXE315/316/317/31B. The driver source itself is not
modified.
Verified on frdm_mcxe31b: the WKPU device binds and initializes, and
an RTC-timeout event (WKPU internal source 1) triggers the WKPU ISR.
Signed-off-by: Holt Sun <holt.sun@nxp.com>
NXP's USDHC SDK driver knows how to do its own cache maintenance and
does so on platforms that set HAS_MCUX_CACHE[1]. Recently, a copy of
that cache maintenance logic was added on the Zephyr side because
certain cores, like the Cortex-M33 of the i.MX RT1180, use an external
cache controller and instead set HAS_MCUX_XCACHE.
However, the Zephyr-side cache logic is buggy: it clobbers the response
data in cases when the SDK can't use DMA (specifically, when the RX
buffer isn't 4-byte aligned[2]): in those cases, the SDK code writes to
the buffer, those writes go to cache, then Zephyr invalidates the cache
discarding the written data.
NXP's SDK abstracts over different cache drivers just like Zephyr does,
so it's fine to enable its cache control for platforms with any type of
cache. Do that instead of reimplementing cache maintenance in Zephyr.
This partially reverts commit 0b8babdcc3 ("drivers: sdhc: imx_usdhc:
add cache maintenance on DMA path"), leaving only the new default value
for CONFIG_SDHC_BUFFER_ALIGNMENT.
[1] 2d8b1b1133/modules/hal_nxp/mcux/CMakeLists.txt (L140-L142)
[2] cddb388583/mcux/mcux-sdk-ng/drivers/usdhc/fsl_usdhc.c (L1343-L1346)
Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
airoc_mgmt_scan() sets data->scan_rslt_cb before calling whd_wifi_scan().
If whd_wifi_scan() fails, the function returnes -EAGAIN without clearing
scan_rslt_cb. The next scan request may return -EINPROGRESS even if no scan
was actually running.
Clear data->scan_rslt_cb in the whd_wifi_scan() error path so driver
state remains consistent.
Signed-off-by: Daniele Cloralio <d.cloralio@arduino.cc>
The ADTM is a superset of the GPTM and has the same core register
layout. See section 11.2.2 of the CH32V003RM for details on the
differences.
Use the same technique as the GD32 driver, i.e. use the same basic
driver with tweaks based on the features.
Add the common 3x GTPM and 1x ADTM Devicetree and pinctrl entries for
the 20x and 30x series and the extra 1x GPTM for the CH32V208 used in
linkw. I can follow up with the other chips in a separate PR.
Tested on the ch32v006evt and linkw by running
`samples/basic/blinky_pwm` and `tests/drivers/pwm/pwm_api` and
checking the output with a logic analyser.
Signed-off-by: Michael Hope <michaelh@juju.nz>
Wire the gdma driver to the esp32p4 AXI and AHB DMA instances,
selecting the per-bus LL calls and 8-byte aligned descriptors so
both buses work through the common driver.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
Right now, the SBI hard-codes the usage of ld/sd instructions, which are
not available on 32-bit platforms. This commit changes this to sr/lr from
`asm_macros.inc`, which automatically resolves them to proper load/store
instructions on 32-bit and 64-bit configurations. It also ensures proper
timer handling through 32-bit registers.
Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
Co-authored-by: Jakub Klimczak <jklimczak@internships.antmicro.com>
Signed-off-by: Jakub Klimczak <jklimczak@internships.antmicro.com>