Commit graph

1871 commits

Author SHA1 Message Date
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
Anas Nashif
2aacbcaab5 style: add missing curly braces in if/while/for statements.
Add missing curly braces in if/while/for statements.

This is a style guideline we have that was not enforced in CI. All
issues fixed here were detected by sonarqube SCA.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-05-17 14:10:33 +02:00
Anas Nashif
e48c90700d doc: remove more occurances of Nios II
Remove all occurances of Nios II from docs and code.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-05-15 20:01:05 -04:00
Anas Nashif
5fe84d5b69 arch: nios2: remove arch
Remove architecture and dependencies.
Remove altera HAL supporting nios2

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-05-15 20:01:05 -04:00
Fabio Baltieri
3cb8f745a6 serial: add an uart-bridge driver
Add a reusable uart-bridge driver that echoes data between two serial
devices. It's mainly meant to be used with one of the devices being an
USB CDC-ACM, the data is buffered, there's a pause feature to stop the
USB endpoint when the hardware UART is filling up to avoid overrun and
there's a helper function used to propagate the USB uart configuration
to the hardware one.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-05-14 20:11:00 +01:00
Bas van Loon
0b9fce4612 drivers: serial: uart_mcux_lpuart: Restore lpuart CTRL register.
When RTS/CTS is toggled it disables the receiver and transmitter
bits to be able to change the flow control bits in the MODIR register.

After it has done so, it should restore the original value of the
CTRL register to re-enable the transmitter and/or receiver if they
were enabled before calling the mcux_lpuart_line_ctrl_set_rts()
function.

Signed-off-by: Bas van Loon <bas@arch-embedded.com>
2025-05-14 15:18:46 +02:00
Daniel Schultz
86b31465f4 drivers: serial: Add aesc UART driver
Add minimal support for the aesc silicon UART IP core.

This core includes an internal clock divider and supports flexible
frame configurations, allowing for variable data length, parity, and
stop bit settings.

The current driver version does not support interrupts.

Signed-off-by: Daniel Schultz <dnltz@aesc-silicon.de>
2025-05-14 14:09:41 +02:00
Alberto Escolar Piedras
e521d5c838 drivers/serial/uart_native_tty: do not discard const qualifier
So it is clearer the data is not modified

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-05-13 12:09:30 +02:00
Adam Berlinger
c1a173a884 driver: uart: stm32: Add workaround for DMAT errata in low-power modes
This change adds additional workaround for following errata:
"USART does not generate DMA requests after setting/clearing DMAT bit"
Instead of keepint DMAT bit set, it sends first byte by polling
in firmware. This prevents additional power consumption in STOP mode,
caused by keeping DMAT bit set.

Signed-off-by: Adam Berlinger <adam.berlinger@st.com>
2025-05-09 17:59:49 +02:00
Adam BERLINGER
ccf07d45b5 driver: uart: stm32: Clear buffer length only in UART TC event
The buffer_length != 0 is used to check if there is transfer ongoing
inside the uart_stm32_async_tx function. uart_stm32_dma_tx_cb clears
it to 0 when TX DMA is finished, but before the USART send all
the data from shift register.
buffer_length is also cleared in callback async_evt_tx_done,
which is called when USART finished sending all the bytes.
If the uart_stm32_async_tx would be called after
uart_stm32_async_tx, but before async_evt_tx_done there
could be race condition on buffer_length.

Signed-off-by: Adam BERLINGER <adam.berlinger@st.com>
2025-05-09 17:59:49 +02:00
Robert Hancock
35b843b52e drivers: serial: serial_test: Support irq_update call
This driver doesn't need to do anything in its irq_update
implementation, but add a dummy one so that calls to uart_irq_update
don't fail with -ENOSYS.

Signed-off-by: Robert Hancock <robert.hancock@calian.com>
2025-05-09 01:40:57 +02:00
Robert Hancock
c3f9e6d1ba drivers: serial: serial_test: support IRQ callback user data
This driver previously caused an assertion error if non-NULL user_data
was passed to uart_irq_callback_set. Add support for this by storing the
user data and passing it back to the IRQ callback function.

Signed-off-by: Robert Hancock <robert.hancock@calian.com>
2025-05-09 01:40:57 +02:00
Camille BAUD
3f3b04ee5b drivers: serial: Fix litex driver
This fixes several ways to hang the driver, such as:
- typing too fast
- going over the read buffer capacity
- pasting anything
- using arrow keys (sending 2 chars at once)
etc

Signed-off-by: Camille BAUD <mail@massdriver.space>
2025-05-07 13:33:56 +02:00