Commit graph

1933 commits

Author SHA1 Message Date
Sylvio Alves
5b876d4c4c drivers: uart: esp32: apply correct mask for TX/RX signal inversion
Build a combined mask from the tx_invert and rx_invert flags and pass it
to uart_hal_inverse_signal(). Only invoke the HAL call when the mask is
non-zero, preventing unintended inversions and eliminating redundant
calls when no inversion is requested.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2025-07-04 13:08:14 -05:00
Pisit Sawangvonganan
b8a8173c1f drivers: kconfig: fix typo
Utilize a code spell-checking tool to scan for and correct spelling errors
in `Kconfig` files within the `drivers` directory.
Additionally, incorporates a fix recommended by the reviewer.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2025-07-01 10:58:54 -10:00
Fabio Baltieri
b15404f998 uart_bridge: log the device name on bitrate changes
Add a log for the device name on bitrate changes, without this it's very
hard to understand what's going on in a system with multiple bridges.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-06-30 17:39:09 -05:00
Pieter De Gendt
1a7eb61f02 drivers: serial: Place device APIs in linker sections
Use DEVICE_API macro to place driver API instances into a linker section.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-06-27 10:09:32 -05:00
Daniel Schultz
7f31129d70 driver: serial: uart_shell: read: Return correct return code
Always return exit code 0 when cmd_uart_read stopped reading
data from UART. Instead, return with a error code in case
reading from the UART interface failed.

Currently, this command might return with exit code -1 because
uart_poll_in didn't return data and the read duration expired.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
2025-06-27 12:23:14 +02:00
Chun-Chieh Li
7179ef51fe drivers: serial: numaker: support hw-flow-control
This honors dts config hw-flow-control to enable flow control cts/rts
at driver init stage.

Signed-off-by: Chun-Chieh Li <ccli8@nuvoton.com>
2025-06-27 12:22:12 +02:00
Steven Chang
43f311bf61 drivers: uart: uart driver
Add uart driver for ENE KB1200

Signed-off-by: Steven Chang <steven@ene.com.tw>
2025-06-27 10:57:20 +02:00
Duy Nguyen
5c293b9915 drivers: serial: Fix issue qemu rx cannot input console
The source code is missing the Receive enable in serial
poll-in function so the status flag will never become affect
and data will never be read
Add the RE write before checking for receive status flag

Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
2025-06-26 14:07:03 +02:00
Daniel Leung
12ed0528b3 Revert "drivers: serial: ns16550: Fix TX IRQ not triggered...
...when FIFO is empty"

This reverts commit 47e43d552e.

This is breaking sample.sensor.shell.pytest where characters
are either missing or repeated when printing to the console.

Originally this is just for RISC-V with PLIC interrupt
controller. That was made more general to avoid having arch
specific code in a generic driver. And now it is breaking
on non-RISC-V platforms. Note that the QEMU RISC-V boards
all have PLIC as interrupt controller and are passing sensor
shell pytest without this workaround. So this does not seem
to be an issue with PLIC and NS16550.  So revert the commit
for now.

Fixes #92187

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2025-06-26 12:42:11 +02:00
Nhut Nguyen
f7120c716b driver: serial: rz: Fix serial issue with sci and scif
Fix issues that Renesas RZ boards cannot run the below serial
samples properly with sci and scif.

- `samples/subsys/console/echo`
- `samples/subsys/shell/shell_module`

The modification is to make the callback invoked in tei interrupt.

Signed-off-by: Nhut Nguyen <nhut.nguyen.kc@renesas.com>
2025-06-26 11:11:47 +02:00
Fabio Baltieri
1914050f3c bindings: uart-bridge: add PM hooks
Add PM hooks to release or reattach the serial ports from the bridge.
Does not save power per se but allows switch the lower level serial
ports for something else in runtime.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-06-24 14:19:24 +02:00
Bjarki Arge Andreasen
0829c2bb8c drivers: nrfx: help select clock control when needed
CLOCK_CONTROL is required for fast instances of UART and COUNTER,
help select it when possible. The fast instances are UARTE120,
TIMER120 and TIMER121, and CLOCK_CONTROL is not supported for
CPUFLPR and CPUPPR even when the fast instances are used.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2025-06-23 15:47:01 +01:00
Anas Nashif
41922b35e4 drivers: uart: make ISR function static to match existing declaration
Declaration of the same function should match and be static.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-06-18 17:48:03 -04:00
Benjamin Cabé
0cdf804c00 drivers: serial: ra8_sci_b: fix overrun error flag clearing
Overrun error flag clearing happens by writing 1 to the ORERC register,
not 0.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-18 07:39:49 +02:00
Benjamin Cabé
2967d83ab1 drivers: serial: uart_shell: adopt SHELL_HELP
Adopt SHELL_HELP macro for UART shell

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-18 07:37:49 +02:00
Hao Luo
fe632259c9 drivers: uart: ambiq: optimize ambiq uart runtime pm
This commit optimizes the runtime pm for ambiq uart driver
by adding pinctrl sleep/resume.

Signed-off-by: Hao Luo <hluo@ambiq.com>
2025-06-17 07:22:44 +02:00
Jacky Lee
47e43d552e drivers: serial: ns16550: Fix TX IRQ not triggered when FIFO is empty
When uart_ns16550_irq_tx_enable() is called and the TX FIFO is already
empty, no new interrupt is generated, causing data transmission to stall
in some cases. This patch introduces a workaround to simulate an ISR
callback if the FIFO is empty when enabling the TX IRQ.

Signed-off-by: Jacky Lee <jacky.lee@egistec.com>
2025-06-16 14:12:12 +02:00
Aksel Skauge Mellbye
dadd657d89 drivers: serial: silabs: Don't fail to init if clock is on
It is not an error if the clock source for the UART is already
enabled. This may happen if a bootloader has used the UART and
not de-initialized it before booting the application.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2025-06-13 10:15:36 -07:00
Daniel Schultz
e1db87e515 driver: serial: uart_shell: Add read command
This command waits for a given time (in seconds) and will continuously
poll from the UART device and print on the Shell console. This command
can be used to also test the RX line.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
2025-06-13 14:29:09 +02:00
Bjarki Arge Andreasen
b41feb9abc drivers: serial: nrfx_uarte: assert clock control enabled
clock control is required for "fast instances" so assert clock
is enabled alongside PM DEVICE RUNTIME. Update UART tests to
reflect this requirenment.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2025-06-13 11:12:43 +02:00
Bjarki Arge Andreasen
020e99c147 drivers: serial: nrfx: remove deprecated config
The UART_NRFX_UARTE_USE_CLOCK_CONTROL is no longer used and
incorrectly selects CLOCK_CONTROL if UARTE120 exists. Remove
it.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2025-06-13 11:12:43 +02:00
Bjarki Arge Andreasen
979a565289 drivers: clock_control: nrf2: align with hw binding names
Currently there is a mismatch between the naming of the hardware and
the drivers targetting the hardware. nrf2_ is used instead of
the actual bindings names, like nrf2_audiopll instead of
nrfs_audiopll. This makes it hard to map drivers to the hardware
they are targetting.

There is historical reason for some of this, namely the same binding
name was used for different hardware, which is why nrf2_ was used
on newer platforms. This is no longer the case though, so drivers
and configs can be named according to the hardware without conflict.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2025-06-13 11:12:43 +02:00
Fabrice DJIATSA
26a43ca88e drivers: serial: stm32: prevent race condition
The async_user_callback could be triggered from
both the DMA transfer complete interrupt and
a k_work queue timeout. Since the timeout runs
outside of an ISR context, it could be interrupted
by the DMA ISR. This might leads to a race condition
where both paths access and modify shared
DMA buffer state (offset and length) simultaneously,
causing data corruption or out-of-sequence processing.

Introduces proper synchronization to prevent concurrent
access to shared DMA buffer variables,
ensuring consistent and reliable data handling.

Signed-off-by: Fabrice DJIATSA <fabrice.djiatsa-ext@st.com>
2025-06-12 09:41:45 -07:00
Krzysztof Chruściński
94d355a0bd drivers: serial: nrfx_uarte: Add workaround for FRAMETIMEOUT corner case
When reception is restarted (STARTRX after ENDRX but no STOPRX) it is
possible that FRAMETIMEOUT countdown counter will not be started by
the first received byte if byte was already being transmitted when
STARTRX was called. If that is the only byte then it is expected that
timeout will be triggered but since FRAMETIMEOUT counter is not started
there is no FRAMETIMEOUT event which has short to STOPRX. This
situation will happen in case short buffers are used (< 5 bytes)
because then short ENDRX_STARTRX is not used then.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2025-06-12 09:27:27 -07:00
Benjamin Cabé
b33e28d233 drivers: serial: bouffalolab: UART_INT_CLEAR is write-only
Fix incorrect read being made to "write 1 to clear" register UART_INT_CLEAR

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-11 16:24:09 -07:00
Michael Estes
bd0efcc948 drivers: serial: uart_xlnx_uartlite: set irq flags per device tree
PG142 from AMD specifically says the uartlite IP generates a
"rising-edge sensitive interrupt" when interrupts are enabled. When
using this IP on a ZynqMP platform with
CONFIG_UART_INTERRUPT_DRIVEN enabled, the GIC does not get
configured correctly to detect these interrupts. Update driver to heed
the flags set by the interrupts property in the device tree.

Signed-off-by: Michael Estes <michael.estes@byteserv.io>
2025-06-11 08:19:28 +02:00
Leifu Zhao
3555c26053 drivers: serial: sedi: add ifndef to uart busy set
The uart_busy_set and uart_busy_clear are only used when runtime
pm is not enabled. So add #ifndef CONFIG_PM_DEVICE_RUNTIME to
enclose these two functions.

Signed-off-by: Leifu Zhao <leifu.zhao@intel.com>
2025-06-10 12:10:01 +02:00
Julien Panis
fa199b6f6c drivers: serial: cc23x0: Add support for DMA mode
Two DMA channels are assigned to TX and RX respectively:
- A TX DMA request is asserted when there is space in the FIFO.
- A RX DMA request is asserted when data is in the FIFO.

When DMA is enabled for a peripheral, the DMA transfer completion is
signaled on the peripheral's interrupt only (here UART's interrupt).
It is not signaled on the DMA dedicated interrupt.

Also, when DMA is enabled for a peripheral, the DMA controller stops
the normal transfer interrupts for this peripheral from reaching the
NVIC (the interrupts are still reported in the interrupt registers of
the peripheral). Thus, when a large amount of data is transferred using
DMA, instead of receiving multiple interrupts from the peripheral as
data flows, the NVIC receives only one interrupt when the transfer
completes (unmasked peripheral error interrupts continue to be sent
to the NVIC).

Signed-off-by: Julien Panis <jpanis@baylibre.com>
2025-06-10 12:08:22 +02:00
Benjamin Cabé
e744c53fc0 drivers: serial: fix Rx pin configuration in lpuart_esp32
Updated the Rx pin configuration in the lpuart_esp32 driver to fix a
typo and use correct MUX function.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-09 14:46:35 -07:00
Martin Hoff
91f4082a52 drivers: serial: ns16550: clock subsys correction
Fix clock subsys property selection when having multiple uart device
that uses ns16550 driver.

Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
2025-06-09 14:40:36 -07:00
Alvis Sun
9f1935923b driver: serial: npcx: add PM support for npck3 series.
This commit adds power management support to the UART driver for npck3
series chip.

Signed-off-by: Alvis Sun <yfsun@nuvoton.com>
Signed-off-by: Tom Chang <CHChang19@nuvoton.com>
Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2025-06-06 12:03:25 +02:00
Alvis Sun
bf0fd155ae drivers: serial: npcx: add serial driver support for npck3
This commit adds serial driver support for npck3.

Signed-off-by: Alvis Sun <yfsun@nuvoton.com>
Signed-off-by: Tom Chang <CHChang19@nuvoton.com>
Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2025-06-06 12:03:25 +02:00
Henrik Lindblom
24b4ce189f drivers: stm32: dma: fix external dcache support
Several drivers checked for the presense and availability of data cache
through Kconfig symbol. This is supported according to the current
documentation, but the symbol DCACHE masks two types of cache devices: arch
and external caches. The latter is present on some Cortex-M33 chips, like
the STM32U5xx. The external dcache is bypassed when accessing internal
SRAM and only used for external memories.

In commit a2dd232410 ("drivers: adc: stm32: dma support") the rationale
for gating dcache for adc_stm32 behind STM32H7X is only hinted at, but
reason seems to be that it was the only SOC the change was tested on. The
SOC configures DCACHE=y so it is most likely safe to swap the SOC gate for
DCACHE.

The DCACHE ifdefs are now hidden inside the shared stm32_buf_in_nocache()
implementation.

Signed-off-by: Henrik Lindblom <henrik.lindblom@vaisala.com>
2025-06-06 10:19:58 +02:00
Yishai Jaffe
7fe85f8cb4 drivers: serial: stm32: simplify logic
Simplify the logic for the `uart_stm32_cfg2ll_databits` function
regarding `LL_USART_DATAWIDTH_9B` being defined or not.

Signed-off-by: Yishai Jaffe <yishai1999@gmail.com>
2025-06-06 10:11:29 +02:00
Tien Nguyen
645acc5e9d drivers: serial: Add support for Renesas RZ/V2H
Add support for Renesas RZ/V2H

Signed-off-by: Tien Nguyen <tien.nguyen.zg@renesas.com>
Signed-off-by: Quang Le <quang.le.eb@bp.renesas.com>
2025-06-04 17:00:01 +02:00
Krzysztof Chruściński
4cf184773e drivers: serial: nrfx_uarte: Support for low power polling mode
Add support for getting to the lowest power mode when polling is
used with disable-rx property and interrupts are not used for
that UARTE. So far disabling of the UARTE peripheral was done in
the interrupt but in some cases interrupt may not be available
and in that case uart_poll_out shall wait until byte is transferred
and put UARTE into the lowest power state.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2025-06-03 13:50:38 +02:00
Declan Snyder
e5a35e6435 drivers: uart_mcux_flexcomm: Enable as wakeup src
Add the feature for the flexcomm uart to be able to be a wakeup source
from low power modes. To be able to do this on a relevant platform, the
DT node for the UART needs to have the wakeup-source property and define
a "sleep" clock. The details of handling the sleep clock and default
clock are still platform specific but handled by the clock control
driver of the platform, so that this code should be able to be
applicable to any platform that follows the same DT definition.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-05-30 19:40:11 +02:00
Declan Snyder
481a2faf1e uart_mcux_flexcomm: Fix TX garbage char bug in PM
There is currently a bug where when entering low power modes, there is a
garbage character sent if the UART is in the middle of a transmit when
entering low power mode. This is because the fifo interrupt happens when
last character is pulled by transmitter from fifo and then we unlock PM
constraints at that moment, instead of waiting for actual transmitter to
become idle. Fix by adding work item to check for this when needed.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-05-30 19:40:11 +02:00
Khoa Nguyen
463f518192 drivers: Update dtc transfer info alignment
Update dtc transfer info alignment for Renesas drivers

Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
2025-05-30 10:26:34 +02:00
Sreeram Tatapudi
774a62e67b drivers: serial: Update UART driver to support XMC7200
Update UART driver to support XMC7200

Signed-off-by: Sreeram Tatapudi <sreeram.praveen@infineon.com>
2025-05-28 21:29:20 +02:00
Hao Luo
ba21058cd7 drivers: uart: add dma support for ambiq uart driver
This commit adds dma support for ambiq uart driver

Signed-off-by: Hao Luo <hluo@ambiq.com>
2025-05-28 10:04:26 +02:00
Tony Han
0b2958373d drivers: serial: sam: update serial to support sama7g5
The USART is compatiable with the USART feature in sama7g5's Flexcom.
Update serial/usart_sam to support sama7g5.

Signed-off-by: Tony Han <tony.han@microchip.com>
2025-05-28 08:14:08 +02:00
Karol Lasończyk
22ffe4f531 soc: drivers: nrf: Add support for UARTE23 and UARTE24
Extends configuration to support instances used in new SOCs.

Signed-off-by: Karol Lasończyk <karol.lasonczyk@nordicsemi.no>
2025-05-27 10:29:41 +02:00
Miguel Gazquez
2b91c467f2 modules: Update hal_wch
Update hal_wch.

As the hal upstream changed name, there is now a name conflict.
Rename ch32fun.h to hal_ch32fun.h to fix this conflict.

Signed-off-by: Miguel Gazquez <miguel.gazquez@bootlin.com>
2025-05-24 18:03:53 +02:00
Krzysztof Chruściński
c58ae7467b drivers: serial: nrfx_uarte: Workaround for spurious RXTO during restart
Some SoCs generates unexpected RXTO event during restart.
Restart happens when ENDRX_STARTRX short is enabled and STOPRX
is triggered (via short or by CPU). STOPRX starts closing
procedure and ENDRX event is generated at some point which
triggers STARTRX and closing procedure is interrupted. RXTO
should not be triggered in that case. Due to internal timings
some SoC on fast UARTE instance will trigger RXTO followed
by RXSTARTED. This RXTO event shall be cleared as receiver is
actually restarted and not stopped.

Affected SoC is not in tree so Kconfig is added which enables
the workaround.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2025-05-21 09:30:15 +02:00
Saravanan Sekar
f236a56040 drivers: serial: Add initial support TI MSPM0 UART
Add initial support for TI MSPM0 UART with basic poll-in and poll-out
functionality.

Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
Signed-off-by: Jackson Farley <j-farley@ti.com>
2025-05-21 08:04:32 +02:00
Fabio Baltieri
0a14cc21cc serial: uart_bt: set the workqueue thread name
Set the bt_uart workqueue name so it does not show up as a mystery
thread on the thread list.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-05-19 18:39:16 +01:00
Fabio Baltieri
d79e9e7d3a serial: uart_bt: select SERIAL_SUPPORT_INTERRUPT
Select SERIAL_SUPPORT_INTERRUPT for uart_bt, this is required to have
the interrupt API available.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-05-19 18:39:16 +01:00
Hao Luo
92e723db93 dts: uart: create ambiq uart binding file
This commit creates ambiq uart new binding file
and renamed the previous one as ambiq,pl011-uart

Signed-off-by: Hao Luo <hluo@ambiq.com>
2025-05-19 13:32:44 +02:00
Hao Luo
be4d8b22c3 drivers: uart: create ambiq uart driver for apollo510
This commit creates ambiq uart driver for Apollo510 SoC,
not to use the pl011 driver any more.

Signed-off-by: Hao Luo <hluo@ambiq.com>
2025-05-19 13:32:44 +02:00