Commit graph zephyr/drivers/serial
Author SHA1 Message Date
Bo Sun
c02a99fa56 drivers: serial: ns16550: add automatic DLF calculation
The static 'dlf' property is valid only for a specific PCLK/baud rate
combination. The current calculation accounts for this fixed value when
selecting the integer divisor, but cannot adapt to runtime baud rate
changes.

A low fixed PCLK may require a fractional divisor to reduce baud rate
error for the requested baudrate.

Add an opt-in 'dlf-auto' property to calculate the integer divisor and
DLF value together whenever the baud rate changes, using 1/64-resolution
fixed-point arithmetic. When enabled, 'dlf-auto' overrides 'dlf'.

Also enable DLF support when an instance uses either 'dlf' or
'dlf-auto'. Existing 'dlf' users are unaffected.

Signed-off-by: Bo Sun <bo.sun@kernel.li>
2026-08-19 18:40:54 -04:00
Fiona Behrens
a36a77e9b8 drivers: reset: add ch32 reset controller
Add reset driver for the reset part of the ch32 rcc.

Use this new reset driven in `wch,usart` to reset the usart peripheral
before use.

Signed-off-by: Fiona Behrens <me@kloenk.dev>
2026-08-19 18:40:22 -04:00
Aksel Skauge Mellbye
5c8ea82aa9 drivers: serial: silabs: Use sl_hal_eusart instead of emlib
Update driver to use new HAL library that supports both
Series 2 and Series 3 SoCs.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2026-08-19 17:12:37 +01:00
Fabio Baltieri
25040cac20 drivers: serial: stm32: declare few lock functions as maybe unused
This fixes a potential build warning introduced in 7b2a3c0cca, where
the static functions would get declard but not used if the board has:
- CONFIG_PM=y
- CONFIG_UART_ASYNC_API=y
- CONFIG_DMA=y
- the dma node enabled in devicetree

Reproduced with:

west build -p -b stm32f4_disco samples/hello_world -DCONFIG_PM=y
-DCONFIG_UART_ASYNC_API=y -DCONFIG_DMA=y

zephyrproject/zephyr/drivers/serial/uart_stm32.c:218:13: warning:
'uart_stm32_rx_wakeup_lock_get' defined but not used

Found this downstream, finding the specific combination of option and
dt override to reproduce this was a big mess, there's no benefit chasing
down the specific combination of ifdeffery here so let's just mark them
as maybe unused and if that combo hits the compiler can just drop them.
Between ifdefs form Kconfig and the HAL this driver is already VERY hard
to follow.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2026-08-19 17:06:13 +01:00
Anas Nashif
4024c955c9 drivers: name the parameters in function declarations
MISRA C:2012 Rule 8.2 requires every parameter in a function type to be
named, including the parameters of function pointer parameters.
The cache, clock control, comparator, entropy, Ethernet, I2S and serial
drivers left callback parameters unnamed, or carried forward
declarations that dropped the names the definitions already use. The two
virtio callbacks get ARG_UNUSED() for the arguments they deliberately
ignore.

Name them after the arguments the documentation or the
definitions already use. No functional change.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-08-18 20:22:43 -04:00
Tony Han
71a994f06f drivers: serial: mchp: add UART driver for sama5d2 SoC
Add driver for sama5d2's UART (Universal Asynchronous Receiver
Transmitter).

Signed-off-by: Tony Han <tony.han@microchip.com>
2026-08-18 17:20:08 -04:00
Eden Frosst
7b2a3c0cca drivers: serial: stm32: release the RX wake lock on hardware timeout
A UART that woke the SoC keeps PM_STATE_SUSPEND_TO_IDLE locked forever
once the hardware receiver timeout is in use.

The WKUP interrupt takes the lock and sets rx_woken. The IDLE arm of
uart_stm32_isr() would release it, but set_timeout_itr() disables the
IDLE interrupt when it programs RTOR, so the RTO arm reports the end of
reception instead and only clears the flag and flushes. The lock is never
released, so the system never enters a Stop state again.

Move acquire and release into helpers and call them from both paths, so
the behaviour at the end of reception is consistent.

Also move enable_wakeup_line out of the block with the PM policy helpers.

Tested on a nucleo_l476rg, cyclic asynchronous reception with PM enabled.

Fixes: #116273
Signed-off-by: Eden Frosst <eden.frosst@rbr-global.com>
2026-08-17 20:51:00 -05:00
Andreas Weissel
c6abf9a0fd drivers: serial: ns16550: include dlf in baudrate divisor calculation
The baudrate divisor calculation should take the fractional parameter
into account when a DLF-capable UART is used. Otherwise non-optimal
integer divisors can be derived, especially for low pclk or high
baud_rate values.

Signed-off-by: Andreas Weissel <andreas.weissel@synaptics.com>
2026-08-17 16:28:34 -04:00
Krzysztof Chruściński
34c88f5de0 drivers: serial: nrfx_uarte: Delay the initilization if GPPI relies on IPC
If GPPI is using IPC communication then delay the initialization of an
UARTE instance which is using GPPI connection after GPPI is initialized
which happens after IPC service is setup.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2026-08-17 14:14:08 +02:00
Johan Hedberg
f0dc851ead drivers: serial: gecko: fix TX interrupt storm
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>
2026-08-14 16:19:08 -04:00
Johan Hedberg
b669d8fa12 drivers: serial: silabs: usart: fix TX interrupt storm
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>
2026-08-14 16:19:08 -04:00
Hans Wilmers
357467a011 serial: uart_native_pty: Add runtime UART configuration stub
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>
2026-08-14 15:27:06 +02:00
Jakub Zymelka
016e1056d6 drivers: serial: nrfx_uarte: fix CBWT RX disable with pending ENDRX
Do not defer STOPRX when CBWT is active because CBWT does not process
ENDRX interrupts. Trigger STOPRX immediately to complete RX teardown
and prevent subsequent uart_rx_enable() calls from returning -EBUSY.

Fixes #115897 and #115899

Signed-off-by: Jakub Zymelka <jakub.zymelka@nordicsemi.no>
2026-08-13 13:12:20 -04:00
Steven Macías
63f51d2bc2 drivers: uart: mspm0: add fifo threshold properties
By default, the UART RX FIFO is configured to trigger an interrupt
when it is half full. This end up breaking implementations that
assumed a per-byte interrupt delivery. These changes make these
properties adjustable in the DTS for RX and TX FIFOs.

Signed-off-by: Steven Macías <esmu@bang-olufsen.dk>
2026-08-13 06:32:32 -04:00
Aksel Skauge Mellbye
3a6406439c drivers: serial: silabs: Only clear processed flags
In interrupt handlers, only clear interrupt flags that have been
processed. This fixes a race condition where an interrupt that was
raised after flags were read for processing was prematurely
cleared without the corresponding action being taken.

When this condition was met, irq_tx_complete() never reported that
transmission was complete, while err_check() failed to report errors.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2026-08-11 07:50:00 -04:00
Krzysztof Chruściński
fbe8357d21 drivers: serial: nrfx_uarte: Fix calculation of an internal variable
bounce_buf_swap_len variable is used when mode that uses TIMER to
count RX bytes was used. Macro for calculating that variable was
invoked with incorrect argument as UARTE_US_TO_BYTES was applied
to baudrate argument. Because of that
CONFIG_UART_NRFX_UARTE_BOUNCE_BUF_SWAP_LATENCY was in fact not
applied.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2026-08-11 07:48:37 -04:00
Nhut Nguyen
4966603fac drivers: uart: renesas: Map MMIO region through MMIO device APIs
Map MMIO region through MMIO device APIs to support ARM64 with MMU

Signed-off-by: Nhut Nguyen <nhut.nguyen.kc@renesas.com>
2026-08-11 07:40:28 -04:00
Alberto Escolar Piedras
94293cbd93 drivers serial uart_native_pty: Fix a backwards comment
The variable is the oposite of what the comment said.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-08-10 16:17:08 -04:00
Mihai Renea
15fa7763e9 drivers: uart_mchp_sercom_g1: fix RX error forwarding
Fix RX error not getting forwarded as reason to the UART_RX_STOPPED event.

Signed-off-by: Mihai Renea <mihai.renea@ml-pa.com>
2026-08-10 09:14:00 -07:00
Jakub Zymelka
2dfb81ef57 drivers: serial: nrf_uarte: restore IRQ state on DMM error
Restore the previous interrupt state when DMM RX buffer preparation
fails. Returning with the IRQ lock held could leave interrupts disabled
after uart_rx_buf_rsp() reports the error.

Signed-off-by: Jakub Zymelka <jakub.zymelka@nordicsemi.no>
2026-08-09 17:45:37 -04:00
Jakub Zymelka
beed381352 drivers: serial: nrf_uarte: use DMAEND on frame timeout
Model DMAEND and FRAMETIMEOUT_DMAEND support as a devicetree
capability. Use DMAEND for finite asynchronous RX frame timeouts on
capable UARTE instances and retain STOPRX on unsupported hardware.

Disable TIMER-based byte counting when DMAEND is available. Preserve
buffer accounting when uart_rx_disable() races with an ENDRX rollover,
reject buffer responses during teardown, and restore the interrupt
state after DMM preparation failures.

Signed-off-by: Jakub Zymelka <jakub.zymelka@nordicsemi.no>
2026-08-09 17:45:37 -04:00
Fabrice DJIATSA
27965929cb drivers: serial: stm32: don't force RXNE IRQ on async rx disable
uart_stm32_async_rx_disable() forced RXNE on and left the ERROR
interrupt enabled, causing per-byte/per-overrun ISR load on continuous
RX streams.

Keep async and interrupt-driven RX ownership separate: async disables
RXNE on enable and, on disable, only tears down async state and
disables ERROR. RXNE remains off; callers that switch back to
interrupt-driven RX must re-enable it via uart_irq_rx_enable().

This avoids ISR flooding for async users and matches API ownership.


Signed-off-by: Fabrice DJIATSA <fabrice.djiatsa-ext@st.com>
2026-08-08 16:32:32 -04:00
Yuzhuo Liu
eb525902e0 drivers: uart: bee: add async API for Realtek Bee series
Add UART asynchronous driver support for Realtek Bee series SoCs,
including RTL87x2G and RTL8752H.

This driver supports:
- Asynchronous TX/RX transfers

Signed-off-by: Yuzhuo Liu <yuzhuo_liu@realsil.com.cn>
2026-08-08 16:31:05 -04:00
Raffael Rostagno
35987fa585 drivers: serial: esp32: Hold UART pads during light sleep
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>
2026-08-07 06:49:39 -04:00
Vladyslav Goncharuk
f57b260f2d drivers: serial: use Xen sched yield helper
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
2026-08-06 14:38:03 +02:00
Muhammad Waleed Badar
f6457d5e82 drivers: serial: remove BCM2711 auxiliary UART driver
Remove the dedicated BCM2711 auxiliary UART driver and its associated
Kconfig entry now that support has been integrated into the generic
NS16550 driver.

Signed-off-by: Muhammad Waleed Badar <walid.badar@gmail.com>
2026-08-05 09:28:40 +02:00
Muhammad Waleed Badar
d7c5d59863 drivers: serial: ns16550: add BCM283x auxiliary UART support
Add support for the Broadcom BCM283x auxiliary UART variant to the
NS16550 driver by introducing a dedicated Kconfig option and variant-
specific register definitions required for the extended register set.

This enables the generic NS16550 driver to support the auxiliary UART
found on Broadcom BCM283x SoCs.

Signed-off-by: Muhammad Waleed Badar <walid.badar@gmail.com>
2026-08-05 09:28:40 +02:00
Ibrahim Abdalkader
ae44cc2f2b drivers: serial: uart_bridge: forward modem control lines to the peer
The bridge already forwards the port configuration (baudrate,
parity, etc...) to the peer, but not the modem control lines.
Forward DTR RTS state to the peer port as well, so a bridged
serial port carries the control lines through like a USB-serial
adapter does.

Note the forwarding is compiled in only if CONFIG_UART_LINE_CTRL
is enabled.

Signed-off-by: Ibrahim Abdalkader <i.abdalkader@gmail.com>
2026-08-04 18:47:52 +01:00
Benjamin Cabé
121c894bce drivers: serial: uart_sedi: Accumulate error flags in err_check
Each detected error was assigned with '=', so simultaneous conditions
reported only the last one checked. OR the flags together.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-08-04 06:50:31 -04:00
Elie Carrot
d863ec49cb drivers: uart: add WCH CH5xx UART driver support
Add UART driver support for the CH5xx.
This enables the hello_world and the drivers/uart/echo_bot samples.

Signed-off-by: Elie Carrot <elie.carrot@smile.fr>
2026-08-03 15:00:06 -04:00
Perry Naseck
a9a76ea2e6 serial: mcux_lpuart: Fix UART noise error marked as parity error
This commit fixes a small bug where a noise error is misclassified as
a parity error.

Signed-off-by: Perry Naseck <pnaseck@media.mit.edu>
2026-07-31 20:00:53 -04:00
Pisit Sawangvonganan
698b2a3a13 drivers: uart: align async timeout units documentation
Align the public UART async API with its microsecond-based implementation.
Update the wide-data (u16 variant) TX and RX API documentation to
specify microseconds and SYS_FOREVER_US.

Replace millisecond-named forever sentinels in the serial test driver and
asynchronous UART callers, while retaining existing microsecond timeout
values in drivers, tests, and samples.

Assisted-by: Copilot:GPT-5.6 Terra
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2026-07-31 14:59:13 -04:00
Alberto Escolar Piedras
7e0c1b09f4 drivers: serial: native_tty: Add missing dependency
This driver needs the nsi_errno conversion component.
Let's make sure we build it by selecting it.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-07-31 13:22:16 -04:00
Etienne Carriere
aa3187f793 drivers: Include include/zephyr/sys/clock.h
Header file include/zephyr/sys_clock.h is deprecated and will be removed
someday. Update the whole file tree to include zephyr/sys/clock.h
straight instead of zephyr/sys_clock.h.

This change was made running the sed shell command below:
$ sed -i 's/zephyr\/sys_clock\.h/zephyr\/sys\/clock\.h/' \
      `grep -rsl "zephyr/sys_clock\.h" drivers/`

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2026-07-30 07:45:05 -05:00
Johnny Chuang
f84834f2f4 drivers: serial: Add UART driver for ELAN EM32 series
Add initial UART driver support for the ELAN EM32 SoC family. The driver
implements basic polling TX/RX via the Zephyr serial API and instantiates
devices from devicetree when an EM32 UART node is present and okay.

Devicetree:
- Compatible: "elan,em32-uart" (binding included)

Notes:
- The driver is initialized at PRE_KERNEL_1
  with CONFIG_SERIAL_INIT_PRIORITY
so the device is ready before the console backend binds.

Signed-off-by: Johnny Chuang <johnny.chuang@emc.com.tw>
2026-07-28 12:28:40 -07:00
TOKITA Hiroshi
d58fbb8cfc include: zephyr: xen: public: remove and migrate to the zephyr-xenlib
This PR migrates the MIT-licensed Xen public headers into the
`include/zephyr/xen/public` directory to the zephyr-xenlib module.

Since the xen public headers require GCC extensions,
enable GNU_C_EXTENSIONS along with enabling CONFIG_XEN.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2026-07-27 14:40:21 +02:00
Henrik Brix Andersen
8ba1698fbf Revert "drivers: uart: unify xilinx ps uart driver with cadence uart driver"
This reverts commit 189ccda20b as it is
causing breakage on qemu_cortex_r5/zynqmp_rpu.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2026-07-27 06:09:38 -05:00
Muhammad Waleed Badar
189ccda20b drivers: uart: unify xilinx ps uart driver with cadence uart driver
Remove the dedicated xlnx_xuartps driver and consolidate support
into the Cadence UART driver (uart_cdns), as both drivers target
the same underlying Cadence UART IP used by Xilinx platforms.

Update device tree bindings and DTS files to use the Cadence
compatible string on supported platforms, remove obsolete driver
sources, and adjust build system configuration accordingly.

Also update test overlays to reflect the driver consolidation.

Signed-off-by: Muhammad Waleed Badar <walid.badar@gmail.com>
2026-07-27 09:20:04 +02:00
Krzysztof Chruściński
2d4e1c7249 drivers: serial: nrfx_uarte: Improvement for running on VPR
Minor improvements in the driver found when running UART stress test
(uart_async_dual). Mainly, preventing running RX timeout handler when
RX is already being disabled and missing barrier when reading CC TIMER
register.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2026-07-24 15:34:21 -04:00
Benjamin Cabé
9425818f6f drivers: serial: uart_max32: Fix hw-flow-control property lookup
The init macro read the property with DT_INST_PROP_OR(index, ...)
instead of the _num macro parameter, so devicetree flow control was
always ignored.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-22 19:06:38 +01:00
Benjamin Cabé
715db1617a drivers: serial: uart_max32: Fix RX DMA transfer direction
api_rx_enable() configured the RX channel as MEMORY_TO_PERIPHERAL,
copied from the TX path. Use PERIPHERAL_TO_MEMORY.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-22 19:06:38 +01:00
Benjamin Cabé
0993ce94a3 drivers: serial: silabs: Fix IRQ lock leak in usart rx_buf_rsp
uart_silabs_async_rx_buf_rsp() returned -EBUSY/-EACCES without
releasing the irq_lock taken at entry, leaving interrupts disabled.
Unlock before the early returns.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-22 11:06:30 +01:00
Benjamin Cabé
b41c729139 drivers: serial: silabs: Fix IRQ lock leak in eusart rx_buf_rsp
eusart_async_rx_buf_rsp() returned -EBUSY/-EACCES without releasing
the irq_lock taken at entry, leaving interrupts disabled. Unlock
before the early returns.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-22 11:06:30 +01:00
Benjamin Cabé
b6938fb624 drivers: serial: uart_rzt2m: Fix baud table bounds check
The enum index guard used '>' against ARRAY_SIZE, allowing a read one
element past the end of baud_settings[]. Use '>='.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-22 11:06:08 +01:00
Raffael Rostagno
f9506e67ac drivers: serial: uart: esp32: Reject non-DMA TX buffers
Return -ENOTSUP when async TX uses a buffer GDMA cannot read.
Allow flash/DROM TX only on SoCs with SOC_DMA_CAN_ACCESS_FLASH.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2026-07-21 18:04:20 -04:00
Raffael Rostagno
0f3a61dfc3 drivers: serial: esp32: Attach sleep retention modules
Attach sleep retention modules to effectively enable TOP PD power down.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2026-07-21 10:12:17 -04:00
Raffael Rostagno
fdf02cd84b drivers: serial: esp32: Fix async UART peripheral power-down
Pair RX_INT on async RX disable/error paths. irq_rx_enable takes the
lock during async RX, but async_rx_disable does not call
irq_rx_disable, so the lock was left held after transfers.

Also restore UHCI on PM resume when peripherals are powered down in
light sleep. UHCI has no sleep-retention link (unlike UART/GDMA) and
comes back reset with its UART port detached.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2026-07-17 11:57:09 -04:00
Raffael Rostagno
aa8b0f3eb0 drivers: serial: esp32: Hold PM lock for IRQ TX/RX duration
Do not release the TX_INT_STREAM policy lock on TXFIFO_EMPTY; that
interrupt only means the TX FIFO has space. Keep the lock until
irq_tx_disable. Also take an RX_INT lock across irq_rx_enable/disable
so light sleep cannot run while IRQ-driven RX is armed.

Rename tx_ongoing to pm_lock_bits now that the mask covers RX as well.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2026-07-17 11:57:09 -04:00
Sreeram Tatapudi
9e8fd6a861 drivers: serial: infineon: fix irq_is_pending to use FIFO state
ifx_cat1_uart_irq_is_pending() read the latched interrupt-cause
register, but the ISR clears RX_NOT_EMPTY and TX_EMPTY before
invoking the callback. The cause register could then read
not-pending while bytes remained in the RX FIFO. Callers gating on
uart_irq_is_pending() then stopped servicing the FIFO and dropped
received data.

Report the pending state by reusing irq_rx_ready() and
irq_tx_ready(), gated by the interrupt enable mask.

Assisted-by: Copilot:claude-opus-4.8
Signed-off-by: Sreeram Tatapudi <sreeram.praveen@infineon.com>
2026-07-17 11:52:55 -04:00
Flavio Ceolin
b7989d78a3 serial: Remove redundant casts in syscall handlers
The syscall handler functions forward parameters with identical casts
that are redundant since the variables already have those types.  Drop
the casts to let the compiler type-check the arguments unobstructed.

Signed-off-by: Flavio Ceolin <flavio@hubble.com>
2026-07-15 19:04:12 -04:00