Commit graph

2,140 commits

Author SHA1 Message Date
Yuzhuo Liu
3cf997ed6c drivers: serial: add realtek bee serial driver
Add realtek bee serial driver.

Signed-off-by: Yuzhuo Liu <yuzhuo_liu@realsil.com.cn>
2026-02-17 15:22:38 +00:00
Mathieu Choplain
a11688fab5 drivers: *: stm32: don't check if clock device is ready
If the clock device (i.e., RCC) failed to initialize, we have bigger
problems than trying to call clock_control_{off,on,configure} on it.
Don't bother checking to save some footprint.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-02-13 18:59:16 +00:00
Elmo Lan
a4465cfe28 drivers: uart: ns16550: clear TX and RX FIFOs when initial
Clear the TX and RX FIFOs to ensure a clean state.
Without this reset, residual data or incomplete
characters from a previous session or the bootloader could remain
in the hardware buffers.

Signed-off-by: Elmo Lan <elmo_lan@realtek.com>
2026-02-13 18:56:41 +00:00
Krzysztof Chruściński
245cd21b0d drivers: serial: nrfx_uarte: Fix wrong endif use
Preprocess endif should be before return so that uarte_periph_enable
returns always when asynchronous API is used. It leads to faulty
behavior in certain configurations.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2026-02-13 13:55:53 +01:00
Nikodem Kastelik
3171e65045 drivers: gppi: cleanup some resources before conn alloc
Some of the peripherals might be used in the bootloader
and not cleaned up properly for the next image in the boot chain.
Ensure that affected registers are always cleaned up before use.

Signed-off-by: Nikodem Kastelik <nikodem.kastelik@nordicsemi.no>
2026-02-12 14:26:44 +00:00
Tim Pambor
2bef40ef78 drivers: serial: uart_shell: avoid utilization of C23 extension
Fix warnings reported by clang about the use of a C23 extension about
usage of a label at the end of a compound statement.

Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2026-02-11 15:04:40 -06:00
Rob Barnes
da79ce7c80 drivers: serial: stm32: fix C23 extension usage in uart_stm32_dma_rx_flush
Moving the declaration of half_pos out of the switch case to avoid
C23 extensions that cause build failures in some environments.

BUG=None
TEST=None

Signed-off-by: Rob Barnes <robbarnes@google.com>
2026-02-11 15:03:49 -06:00
Krzysztof Chruściński
44bbc13394 drivers: serial: nrfx_uarte: Handle unexpected RXTO events
In some cases UARTE peripheral is generating RXTO events together with
ENDRX events. Those events are unexpected and should not be handled.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2026-02-09 15:59:02 +01:00
Krzysztof Chruściński
13e4b7a3ff Revert "drivers: serial: nrfx_uarte: Workaround for spurious RXTO during restart"
This reverts commit c58ae7467b.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2026-02-09 15:59:02 +01:00
Ayush Singh
27ee07a66c drivers: serial: ns16550: Enable interrupts only if defined
It is possible that some uart devices ns16550 do not support interrupts.
As an example, using main domain uarts from mcu domain m4f core in AM62
processors does not support uarts.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2026-02-06 08:53:07 -06:00
Muhammad Waleed Badar
0bb2943334 drivers: uart: add pinctrl support for bcm2711 aux uart
Add pinctrl support to the bcm2711 aux UART driver to allow
uart pin configuration via the pinctrl driver.

Signed-off-by: Muhammad Waleed Badar <walid.badar@gmail.com>
2026-02-06 08:52:07 -06:00
Hau Ho
36be3745de drivers: serial: Support serial driver for RX140 SoC
Modify driver code to adapt with RX140 SoC

Signed-off-by: Hau Ho <hau.ho.xc@bp.renesas.com>
2026-02-06 11:09:14 +01:00
Krzysztof Chruściński
53efd4818c drivers: serial: nrfx_uarte: Fix compilation with deprecated option
Recent changes (6e65fbe585) deprecated Kconfig configuration for
TIMER that is used for bytes counting. In one place code was not
cleared correctly which results in compilation failure when
deprecated symbol is used.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2026-02-05 13:03:08 +00:00
Benjamin Cabé
1274be64ad drivers: serial: use proper essential type in boolean variables assignments
As per Zephyr coding guideline #59, "operands shall not be of an
inappropriate essential type". This makes sure boolean variables are
assigned true/false values, not 1/0.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-02-05 10:20:22 +00:00
Wilfried Chauveau
0d48949589 drivers: serial: uart_cmsdk: apply clang-format
Following the last change, a clang-format pass is required.

Signed-off-by: Wilfried Chauveau <wilfried.chauveau@arm.com>
2026-02-04 13:56:48 +01:00
Wilfried Chauveau
f63344cf4f drivers: serial: uart_cmsdk: remove code duplication
This change makes the driver rely on DT_INST_FOREACH_STATUS_OKAY(...)
rather than copy-paste the same code several time.
This also has the advantage of allowing more that 5 instances of this
uart driver.

Signed-off-by: Wilfried Chauveau <wilfried.chauveau@arm.com>
2026-02-04 13:56:48 +01:00
Bernardo Perez Priego
9ae9d167e3 serial: uart_mchp_xec: fix TX complete status check
Fix the logic in `uart_xec_irq_tx_complete` when evaluating the UART line
status register against the TX-empty mask. The previous condition could
report "TX complete" even when the TX path was not fully empty, which can
cause flush users to loop or make incorrect progress decisions.

This change corrects the comparison against the TX-empty mask so that the
function only reports completion when the hardware indicates the expected
empty state.

Signed-off-by: Bernardo Perez Priego <bernardo.perez.priego@intel.com>
2026-02-04 13:53:23 +01:00
Marcelo Roberto Jimenez
ebdbab5b52 drivers: serial: uart_shell.c: Enhance the uart shell
This patch enhances the UART shell by:

- Adding a config command to display the UART configuration;
- Displaying the current configuration when the command misses the last
  parameter (usefull for command line editing).

Signed-off-by: Marcelo Roberto Jimenez <marcelo.jimenez@gmail.com>
2026-02-03 12:12:53 +00:00
Krzysztof Chruściński
6e65fbe585 drivers: serial: nrfx_uarte: Refactor byte counting with TIMER
Some time ago a receiver mode for newer SoCs was introduced. It is
using TIMER to count RX bytes via PPI. Due to changes in the system
behavior it is not the same implementation as the one used on
legacy targets (nRF52x, nRF53x and nRF91x). New implementation is
using the Device Tree to assign a TIMER instance and old feature was
using Kconfig which is now obsolete and error prone since it is
easy to get resource usage conflict is some instances are managed
in Device Tree and some in Kconfig.

As a result to reliably receive data without HWFC user had to use
different configuration depending on the target.

Legacy implementation was using nrfx_timer and new one used HAL.

Patch attempts to align better those two similar but different
implementations by:
- deprecating Kconfig symbols for selecting TIMER instance in favor
  of the Device Tree
- extracting common part like PPI initialization and some control
 block fields
- Using TIMER HAL in both implementations.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2026-02-03 12:12:41 +00:00
Krzysztof Chruściński
7979d37f42 drivers: serial: nrfx_uarte: Fix short RX buffers handling
Interrupt handler was handling events in a following order:
ENDRX, RXSTARTED, RXTO. This could lead to error if RX buffer
is short then with high baudrate RXSTARTED for the current
buffer could be handled together with ENDRX and in that case
uart_rx_buf_rsp called from RXSTARTED would return error as
reception is already finished due to handled ENDRX.

Reworking the driver to change that order to RXSTARTED, ENDRX,
RXTO.

Additionally, driver is optimize to only check HW events for
enabled interrupts. To achieve that, RX path interrupts are
all disabled then RX is disabled.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2026-02-03 12:12:41 +00:00
Krzysztof Chruściński
dba9997a50 drivers: serial: nrfx_uarte: Cleanup
Remove parts of implementation which are no longer in use.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2026-02-03 12:12:41 +00:00
Hoang Nguyen
5a9d20b4ed drivers: serial: renesas: Initialize p_reg in extended configuration
Initialize p_reg with the register base address from devicetree.

Signed-off-by: Hoang Nguyen <hoang.nguyen.jx@bp.renesas.com>
Signed-off-by: Nhut Nguyen <nhut.nguyen.kc@renesas.com>
2026-02-03 09:29:36 +01:00
Pascal Bodin
01a86ffd18 drivers: serial: uart_cc13xx_cc26xx: make irq_tx_ready check interrupt
Make cc13xx_cc26xx_irq_tx_ready check that the TX Ready interrupt
occurred, instead of checking whether there is some free space in
the UART TX FIFO. This prevents a race condition from occurring in
OpenThread Spinel protocol implementation, when a UART RX interrupt
is received right after otPlatUartSend was called, between the
assignement of 1 to ot_uart.tx_busy and the initialization of
write_length.

Signed-off-by: Pascal Bodin <pbodin@baylibre.com>
2026-02-02 14:43:24 +01:00
Holt Sun
d73e311f4a drivers: serial: uart_mcux_lpuart: fix async RX race condition
Fix race condition between DMA ISR and work queue that caused RX
length underflow when calculating len = counter - offset.

Both mcux_lpuart_async_rx_timeout (work queue) and dma_callback
(ISR) modified rx_dma_params without locking, causing the ISR to
update counter/offset mid-calculation, resulting in integer
underflow and system crash.

Solution: Add irq_lock() protection around all rx_dma_params
accesses in async_evt_rx_rdy(), mcux_lpuart_async_rx_flush(),
and async_evt_rx_buf_release().

Signed-off-by: Holt Sun <holt.sun@nxp.com>
2026-02-02 12:55:52 +01:00
Holt Sun
b07ed4bf93 drivers: serial: uart_mcux_lpuart: improve rx_enable error reporting
Split error handling in mcux_lpuart_rx_enable() to distinguish
between DMA status query failures (error) and busy status (debug).

- Use LOG_ERR for get_status failures with specific error code
- Use LOG_DBG for busy status (expected condition, valid -EBUSY)
- Improves debuggability by providing clearer diagnostic messages

Signed-off-by: Holt Sun <holt.sun@nxp.com>
2026-02-02 12:55:52 +01:00
Grygorii Strashko
db1bea3ae2 drivers: xen: add XEN_EVENTS Kconfig option
The Xen events channel driver consume 72K of RAM, but may not be
required in all use cases.

Added a XEN_EVENTS Kconfig option so that Xen events can be gracefully
disabled if not required. Updated the relevant CMakeLists.txt and
Kconfig files to guard the inclusion of the Xen events driver and its
source files by this option.

Signed-off-by: Grygorii Strashko <grygorii_strashko@epam.com>
Signed-off-by: Svitlana Drozd <svitlana_drozd@epam.com>
2026-01-30 16:56:52 -06:00
Aksel Skauge Mellbye
54bc3154e3 drivers: serial: silabs: Fix async race condition
When an async transfer finished quickly, the internal state of
the driver could come out of sync with the hardware. The tx/rx
enabled flag and PM lock was taken after starting the DMA
transaction, which caused issues if the DMA complete callback
was called before the flags were updated. Set the flag and take
the PM lock prior to starting the DMA transaction to avoid this.

Also release the PM rx lock upon successful completion of a
transfer. The lock was previously only released when the user
manually called `uart_rx_disable()`.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2026-01-30 06:00:41 -06:00
Alberto Escolar Piedras
4921a09793 drivers serial native_pty: Add DT property to connect to stdin/out
Add a device tree property to request connecting an instance to stdin/out
(on top of the command line option, and the kconfig option).

And clarify that the kconfig option applies to whichever is the
first instance in whatever order the DT logic happens to order them.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-01-30 06:00:04 -06:00
Bjarki Arge Andreasen
15d8d12096 drivers: serial: uart_nrfx_uarte: patch disable and pinctrl order
The UARTE instance must be disabled before the pinctrl state is
updated like it is done other places in this driver.

While the uarte is enabled, it controls the pins, keeping TX high
for example. Trying to apply pinctrl will have no effect other
than enabling pin retention, so the TX pin which should now be low
and configured as disconnected input, stays an output driven high.

Issue was discovered as the suspended UARTE was backpowering
devices connected to it because of the driven output pins.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2026-01-30 09:19:03 +01:00
Fabrice DJIATSA
ed7dd4f011 drivers: serial: stm32: split cyclic RX wrap into two contiguous events
This change updates uart_stm32_dma_rx_flush() to detect the wrap case
and emit two contiguous UART_RX_RDY events in order:
- tail: [offset .. buffer_length)
- head: [0 .. counter)
This guarantees that each RX_RDY event satisfies offset + len <=
buffer_length.
Non-cyclic behavior and cyclic non-wrapping cases remain
unchanged.

Signed-off-by: Fabrice DJIATSA <fabrice.djiatsa-ext@st.com>
2026-01-30 09:18:02 +01:00
Appana Durga Kedareswara rao
aa6386f2c3 drivers: serial: pl011: fix SBSA IRQ config function reference
Commit 45cde341dc ("drivers: serial: pl011: Allows mixed IRQ
settings.") introduced a bug where PL011_SBSA_CONFIG_PORT defines
the IRQ config function as pl011_irq_config_func_sbsa_##n but
IRQ_CONFIG_FUNC_INIT(n) references pl011_irq_config_func_##n,
causing a compilation error when building for boards with SBSA
UART and interrupt support enabled.

Fix by using the correct function name with the _sbsa_ suffix
in the SBSA config port macro.

Fixes: 45cde341dc ("drivers: serial: pl011: Allows mixed IRQ settings.")

Signed-off-by: Appana Durga Kedareswara rao <appana.durga.kedareswara.rao@amd.com>
2026-01-29 16:11:53 -06:00
Jamie McCrae
80f19801b2 soc: sifive: sifive_freedom: Fix SoC Kconfig naming and issues
Fixes the Kconfig name of this so that it matches the value from
soc.yml, and deprecates the old name - this is required to support
future build system features. Additionally, it fixes an issue in
Kconfigs of this SoC of duplicating existing symbols

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-01-29 17:20:11 +01:00
Miika Karanki
3ab167bd72 drivers: serial: uart_stm32: fix IRQ lock not released on error path
In uart_stm32_async_rx_buf_rsp(), when the provided RX buffer is not
located in non-cacheable memory, the function would return -EFAULT
while still holding the IRQ lock acquired at the start of the critical
section. This causes a system deadlock as interrupts remain disabled
indefinitely.

The nocache validation check has been moved outside the critical
section to ensure proper error handling. The check is performed before
acquiring irq_lock(), maintaining the same validation behavior while
preventing the lock from being held during the early error return.

Fixes a bug where async UART RX operations with improperly
placed buffers would hang the system.

Signed-off-by: Miika Karanki <miika.karanki@vaisala.com>
2026-01-28 21:58:35 +01:00
Fin Maaß
3c63100522 drivers: serial: litex: fix is pending
include enabled state for the irq
when checking for pending irqs.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-01-27 15:20:09 -06:00
John Batch
9fe2e4f596 drivers: infineon: adds clock assignment to serial device init.
Adds making a peripheral clock connection to the initialiazation for SCB
based drivers.  These drivers are the UART/Serial driver, I2C driver, and
SPI driver.

Signed-off-by: John Batch <john.batch@infineon.com>
2026-01-27 08:06:28 +01:00
Pisit Sawangvonganan
24615a4d79 drivers: serial: place API into iterable section
Add the `DEVICE_API` wrapper to the remaining `uart_driver_api` instances,
ensuring that each driver API is placed in its respective linker section.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2026-01-26 14:02:16 -06:00
Daniel DeGrasse
b4cbd206ec drivers: serial: ns16550: support odd parity
Add odd parity support into ns16550 driver.

Signed-off-by: Daniel DeGrasse <ddegrasse@tenstorrent.com>
2026-01-25 14:38:43 +01:00
Daniel DeGrasse
a436c1cc12 drivers: serial: ns16550: support interrupt API correctly for DW IP
For the base ns16550 spec, supporting the UART interrupt API correctly
is not strictly possible- the IIR register will clear after one read and
not update, so multiple calls to uart_irq_[tx/rx]_ready after
uart_irq_update will return stale data.

The Synopsis DW variant of this IP includes a USR register, which can be
used to correctly identify when the TX FIFO has space for more data and
when the RX FIFO is empty. Use this register when
CONFIG_UART_NS16550_DW8250_DW_APB is set.

Signed-off-by: Daniel DeGrasse <ddegrasse@tenstorrent.com>
2026-01-25 14:38:43 +01:00
Daniel DeGrasse
f620006c84 drivers: serial: ns16550: support loopback mode
Add support for loopback mode in ns16550 uart driver, by setting LOOP
bit in MDC register.

Signed-off-by: Daniel DeGrasse <ddegrasse@tenstorrent.com>
2026-01-25 14:38:43 +01:00
Marcelo Roberto Jimenez
62a49211b1 drivers: serial: uart_xmc4xxx: Enable run time configuration
This patch enables run time configuration for the XMC4xxx serial ports.

Signed-off-by: Marcelo Roberto Jimenez <marcelo.jimenez@gmail.com>
2026-01-22 14:30:26 -06:00
Marcelo Roberto Jimenez
7744d20840 drivers: serial: uart_xmc4xxx: Run clang-format before applying a patch
This patch just formats the uart_xmc4xxx.c file before the real
patch, otherwise the changes would be hard to read.

Signed-off-by: Marcelo Roberto Jimenez <marcelo.jimenez@gmail.com>
2026-01-22 14:30:26 -06:00
Braeden Lane
f68885f1c6 drivers: Add PSOC 4 clock control and serial support
Add clock control and UART support for PSOC 4 family:
- Clock control drivers with PSOC 4 compatibility
- PSOC4xx clock source bindings and definitions
- HF clock divider configuration support
- UART FIFO trigger level configuration for PSOC 4100S Max
  series with 8-deep FIFO (RX trigger=7, TX trigger=0)

Signed-off-by: Braeden Lane <Braeden.Lane@infineon.com>
2026-01-22 13:01:21 -05:00
Miika Karanki
c7fb653046 serial: uart_native_pty: send UART_RX_DISABLED event
When uart_rx_disable is called, or rx gets otherwise disabled,
UART_RX_DISABLED event should be emitted.

Signed-off-by: Miika Karanki <miika.karanki@vaisala.com>
2026-01-22 12:55:41 -05:00
Muhammad Waleed Badar
1350164d67 drivers: uart: bcm2711: fix poll_in
uart_bcm2711_poll_in() incorrectly returned the received byte
instead of writing it to the provided buffer.

Update the implementation to store the character in *c and
return 0 on success, matching the UART poll_in API.

Signed-off-by: Muhammad Waleed Badar <walid.badar@gmail.com>
2026-01-22 12:55:13 -05:00
Albort Xue
65438886e6 drivers: serial: uart_mcux_lpuart: configure clock before initialization
Add clock configuration step before UART initialization to ensure
proper clock setup. The clock is first disabled, then configured
if supported by the clock controller.

If clock configuration is not supported (ENOTSUP/ENOSYS), the driver
continues with default settings. Other errors are treated as failures
and propagated to the caller.

Signed-off-by: Albort Xue <yao.xue@nxp.com>
2026-01-21 20:07:26 +01:00
Camille BAUD
18652dea69 drivers: serial: bflb: do not enable rx and err interrupt by default
It breaks things when callback doesnt expect them.

Signed-off-by: Camille BAUD <mail@massdriver.space>
2026-01-21 20:06:48 +01:00
TOKITA Hiroshi
45cde341dc drivers: serial: pl011: Allows mixed IRQ settings.
Allows a mixture of IRQ-enabled and IRQ-disabled nodes.
Enabled nodes are identified by the presence or absence of
the interrupt-names property.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2026-01-20 20:10:42 -05:00
Holt Sun
4138155273 drivers: uart_mcux_lpuart: refine DMA TX busy/error handling
Split DMA status error from busy state handling. Use LOG_DBG for
busy state and LOG_ERR for status query failures. Return -EBUSY
as required by async UART API when transfer is in progress.

Signed-off-by: Holt Sun <holt.sun@nxp.com>
2026-01-20 15:33:20 +00:00
Scott Worley
c6a959dcc3 drivers: serial: microchip: mec: Common UART driver
We modified the Microchip MEC UART driver to be HAL
independent and be usuable on all MEC SoCs. The only
hardware difference is an extra register in the MEC174x/5x
family providing TX FIFO full and current byte count.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
2026-01-16 11:40:38 +00:00
Aleksandr Senin
5dc2385914 drivers: serial: gd32: add UART runtime configure support
Add uart_configure()/uart_config_get() support to usart_gd32.
Store runtime config in driver data and init it from DT defaults.

Signed-off-by: Aleksandr Senin <al@meshium.net>
2026-01-11 13:04:25 +01:00