Commit graph

2,167 commits

Author SHA1 Message Date
Stefan Giroux
63325cb465 drivers: uart: sam0: Fix interrupt handling in uart_sam0.c
allow txc_cache to be set for non-SERCOM_REV500 peripherals

see https://github.com/zephyrproject-rtos/zephyr/issues/87210 for more details

Signed-off-by: Stefan Giroux <stefan.g@feniex.com>
2026-05-23 17:12:25 -07:00
Sylvio Alves
cd51d08a05 drivers: serial: lpuart_esp32: reset register after clock enable
The LP_UART parameter configuration enabled the bus clock and
selected the source clock without asserting the reset register
in between. After a soft reset the LP_UART hardware could keep
stale state from the previous boot, leading to garbled output
until a power cycle cleared the registers.

Insert the missing lp_uart_ll_reset_register() between the bus
clock enable and the source clock selection.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2026-05-20 14:08:52 +02:00
Zayne Stites
1b78978026 drivers: serial: uart: make Infineon poll_in non-blocking
Per the uart_polling header documentation, this API should
not block.  Updating this API to simply check and return
instead of spinning until it gets a value.

Assisted-by: Claude:claude-opus-4.7

Signed-off-by: Zayne Stites <Zayne.Stites@infineon.com>
2026-05-20 10:58:09 +02:00
Fin Maaß
0dcf6a345a serial: uart: change return type of irq_update to void
the return value of uart_irq_update() is not relevant,
therefore change it to void.

Also as most uart drivers don't need irq_update, make
it optional to implement this function in the driver.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-05-19 17:46:51 -04:00
Fin Maaß
4156093121 serial: uart: remove empty irq_update implementations
remove empty  irq_update implementations.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-05-19 17:46:51 -04:00
Fin Maaß
675231df7a drivers: serial: remove syscall from interrupt only functions
remove syscall from uart_irq_update() and
uart_irq_is_pending() as these are only allowed in
the interrupt.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-05-19 17:46:51 -04:00
Fin Maaß
4d859419d9 drivers: serial: don't check return value of uart_irq_update()
Remove return value checks of uart_irq_update().
Needed for changing it's return value to void.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-05-19 17:46:51 -04:00
Michal Chromec
033ebe308b serial: uart_mcux_lpuart: downgrade rx_disable() no-buffer message
uart_rx_disable() may be called when RX was never enabled (e.g. test init).
Do not report this case as an error; log it at debug level instead.

Signed-off-by: Michal Chromec <michal.chromec@nxp.com>
2026-05-19 12:53:34 +02:00
Michal Chromec
f56935c46f serial: uart_mcux_lpuart: remove call of LPUART_Deinit()
Remove call of LPUART_Deinit() from mcux_lpuart_configure().
LPUART_Deinit() disables the LPUART clocks. If the configuration is not
supported, this may leave the LPUART in an uninitialized state with its
clocks disabled. Any subsequent access to LPUART registers can then
cause a hard fault.

Signed-off-by: Michal Chromec <michal.chromec@nxp.com>
2026-05-19 12:53:34 +02:00
Michal Chromec
537f42c0f8 serial: uart_mcux_lpuart: handle async DMA RX/TX on nxp,4ch-dma
NXP MCXC devices use the 4-channel DMA controller (nxp,4ch-dma) which
does not support eDMA-style "live reload" while the channel is busy.
This causes async RX double-buffering to fail when the next buffer is
preloaded from uart_rx_buf_rsp().

Introduce a per-instance rx_dma_live_reload flag derived from the DT DMA
controller compatible, and adjust async handling accordingly:
- Preload the next RX buffer only when live reload is supported.
- For nxp,4ch-dma, re-arm RX DMA from the DMA completion callback.
- Stop the TX DMA channel on completion to prevent repeated IRQs and treat
  DMA errors as TX aborts.
- Set DMA block address adjustment fields explicitly for RX and TX.

Signed-off-by: Michal Chromec <michal.chromec@nxp.com>
2026-05-19 12:53:34 +02:00
Michal Chromec
8dae7e7907 serial: uart_mcux_lpuart: handle SDKs without RX FIFO count API
Some devices do not provide LPUART FIFO support and therefore
lack LPUART_GetRxFifoCount(). Guard the FIFO-drain loop with
FSL_FEATURE_LPUART_HAS_FIFO and fall back to draining the RX data
register based on status flags.

Signed-off-by: Michal Chromec <michal.chromec@nxp.com>
2026-05-19 12:53:34 +02:00
Michal Chromec
dcf24f6af3 serial: uart_mcux_lpuart: support nxp,4ch-dma DT cell naming
MCUX LPUART async DMA configuration currently assumes eDMA-style DMA
specifiers (<mux source>). MCXC boards using nxp,4ch-dma describe DMA as
<channel source> instead.

Select the correct DT cell name based on the DMA controller compatible
and guard DMA config generation for instances without a 'dmas' property.

Signed-off-by: Michal Chromec <michal.chromec@nxp.com>
2026-05-19 12:53:34 +02:00
Henrik Brix Andersen
3244a59bbf Revert "os: boot_banner: remove selecting EARLY_CONSOLE"
This reverts commit 19d4060532.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2026-05-14 19:41:20 +02:00
Fin Maaß
19d4060532 os: boot_banner: remove selecting EARLY_CONSOLE
the boot banner is printed at the end of
the init process with
``SYS_INIT(boot_banner, APPLICATION, 0);``
we don't need the early console for it.
When CONFIG_EARLY_CONSOLE is enabled,
the console will init with PRE_KERNEL_1, otherwise
with POST_KERNEL. Both are before APPLICATION.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-05-14 15:15:28 +02:00
Mathieu Choplain
a93e31f280 drivers: uart: stm32: don't read TC interrupt flag multiple times
The UART driver's ISR could read the TC interrupt flag multiple times,
but doing so is unsafe as the interrupt flag could be clear during the
first read but set during the second, whereas the ISR expects the same
value all along.

Read the flag's status exactly once at the start of the ISR and use the
cached value in all checks instead of reading the hardware register.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-05-13 19:01:54 +01:00
Davide Di Lello
a5e83d7d20 drivers: uart: infineon: Add UART wide data
Add UART Wide data functions

Signed-off-by: Davide Di Lello <Davide.Dilello@Infineon.com>
2026-05-12 09:08:23 +02:00
Fabin V Martin
9c2257afc3 drivers: serial: microchip: sercom g1: support per-instance DMA mode
Use dt_compat_any_has_prop for CONFIG_UART_MCHP_DMA_DRIVEN to allow
mixed DMA/interrupt configurations. Added has_dma field and runtime
checks to select transfer mode per UART instance based on device tree
dmas property presence.

Signed-off-by: Fabin V Martin <Fabinv.Martin@microchip.com>
2026-05-12 08:58:44 +02:00
Krzysztof Chruściński
9697c188fe drivers: serial: nrfx_uarte: Use TIMER address from DT
For bsim targets MDK define (NRF_TIMERx) which is an address
of TIMER peripheral is not the same as register address for
timer node. Driver expects that address is set to the HW
peripheral address and it is later on converted to RAM
structure used by the bsim. Use address from the device tree
as it actually is set to the HW address, contrary to the
NRF_TIMERx macro which already points to the RAM structure
used by the simulator.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2026-05-07 13:18:41 +01:00
Adrien Ricciardi
5f1f342ac5 drivers: serial: R-Car: Add generic clock support
Convert the driver clock accesses to use the new generic API, so the
driver can be used on R-Car boards generations 3, 4 and 5 without changes.

This code has been tested on a Spider S4 and on an Ironhide X5H.

Signed-off-by: Adrien Ricciardi <aricciardi@baylibre.com>
2026-05-07 14:16:55 +02:00
Andrei-Edward Popa
e1cebbe7ad drivers: serial: uart_cmsdk_apb: fix init flow after pinctrl apply
uart_cmsdk_apb_init() returns early when pinctrl_apply_state()
succeeds, because the return value check is wrong.

As a result, the rest of the UART initialization is skipped and
the device remains only partially initialized.

Ignore -ENOENT as intended, but continue init on success and
abort only on real pinctrl errors.

Signed-off-by: Andrei-Edward Popa <andreip@axonne.com>
2026-05-07 09:13:09 +02:00
Daniel Schultz
61726d8b81 drivers: serial: uart_shell: read: Add err_check
The poll_in function doesn't return any error codes related to
the transmission itself. Call 'err_check' afterwarwds to make
sure no error flags are present.

Example: in case an FIFO overrun happens, poll_in would return
no data but this command should report the error.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
2026-05-06 19:56:49 +02:00
Daniel Schultz
4d323bc15f drivers: serial: uart_aesc: Add volatile in poll_out
When the transmit FIFO is full and poll_out checks for availability,
it will read the register value only once and block forever. Make
the uart_aesc_regs struct volatile to read the FIFO availability
during each check.

Signed-off-by: Daniel Schultz <dnltz@aesc-silicon.de>
2026-04-30 14:06:10 -04:00
Ashirwad Paswan
0e3ccfe455 serial: stm32: toggle UE when re-enabling RX DMA to handle U5/H5 errata
On STM32H5 / STM32U5 with GPDMA the USART can stop generating DMA RX
requests after uart_rx_disable() clears DMAR and DMAR is later re-enabled.
Toggling the USART enable (UE) before re-asserting DMAR resets the USART
internal state machine and allows RX DMA requests to resume.

Fixes: #101345

signed-off-by: Ashirwad Paswan <ashi06712@gmail.com>
2026-04-27 17:23:26 +02:00
Fin Maaß
5da9adcb85 drivers: serial: add dependency for UART_PIPE
The uart pipe need the chosen of zephyr,uart-pipe,
add that dependency to the Kconfig option.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-04-27 07:24:23 +02:00
Fabin V Martin
5251d2bc00 drivers: uart: microchip: sercom g1: changes for pic32cmjh
Updated async mode to read the first byte manually and the
remaining bytes using dma as buffer overflow was happening
for rx enable with 1 byte.

Signed-off-by: Fabin V Martin <Fabinv.Martin@microchip.com>
2026-04-21 10:20:06 +01:00
Antonio Tessarolo
d8a56ad0ea drivers: serial: nxp: added uart runtime configuration
Add uart runtime configuration to uart_imx

Signed-off-by: Antonio Tessarolo <anthonytexdev@gmail.com>
2026-04-20 11:50:39 +02:00
Ryan Erickson
68e702294b drivers: serial: pl011: fix CTS loop
If CTS hardware flow control is in use, prevent an
infinite loop of callbacks.

Enable the CTS interrupt if TX is unavailable from
CTS blocking.

Signed-off-by: Ryan Erickson <ryan.erickson@ezurio.com>
2026-04-18 12:38:40 -04:00
Fin Maaß
6d89a4b2b3 drivers: uart: litex: use mem_addr_t
use mem_addr_t for register addresses.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-04-15 17:15:46 -04:00
Carlo Caione
36f3bebfb7 drivers: serial: mbox: convert NXP drivers to device MMIO API
Convert three NXP drivers from raw DT_REG_ADDR() register access
to the Zephyr device MMIO API (DEVICE_MMIO_ROM / DEVICE_MMIO_RAM /
DEVICE_MMIO_MAP):

With the MMIO API, the drivers create their own mapping at init time via
DEVICE_MMIO_MAP() thus the corresponding mmu_regions entries are removed
from the five NXP SoC files that carried them.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2026-04-15 17:15:37 -04:00
Krzysztof Chruściński
67f1cee897 drivers: serial: nrfx_uarte: Add support for variable frame size
nRF54x devices supports 4-9 bit frame size. Extend UART driver to
support data sizes supported by the Zephyr UART API (5-9 bits).

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2026-04-15 17:15:26 -04:00
Anand Kumar
dadf30044c drivers: serial: stm32: add UART IRQ sharing support
Add shared interrupt support for STM32 UART on SoC families where
multiple USART/LPUART peripherals share a single IRQ line (F0, G0,
L0, U0, C0).

Add a compile-time BUILD_ASSERT in the STM32 UART driver that detects
when two or more enabled UART instances share an IRQ and
CONFIG_SHARED_INTERRUPTS is not set.

Add configdefault SHARED_INTERRUPTS and SHARED_IRQ_MAX_NUM_CLIENTS
to the SoC Kconfig for STM32F0x, STM32L0x, STM32U0x, and STM32C0x.

Update DTS comments in the F0 family that previously stated shared
UART IRQs are unsupported.

The SHARED_IRQ_MAX_NUM_CLIENTS combinations in the F0x Kconfig were
generated with:

  from itertools import combinations
  usarts = ['usart3','usart4','usart5','usart6','usart7','usart8']
  for n in range(6, 2, -1):
      for combo in combinations(usarts, n):
          conds = ' && '.join(
              f'$(dt_nodelabel_enabled,{u})'
              for u in combo)
          print(f'\tdefault {n} if {conds}')

Fixes zephyrproject-rtos#39565

Signed-off-by: Anand Kumar <anandvtu16158@gmail.com>
2026-04-14 22:21:03 -04:00
Nick Stoughton
12ba507599 drivers: serial: nrfx_uarte: remove unused variable
Removes compiler warning if `CONFIG_UART_USE_RUNTIME_CONFIGURE` is not
defined.

Signed-off-by: Nick Stoughton <nick.stoughton@eargo.com>
2026-04-01 11:51:24 -05:00
Ahmed Ahmed
c64d271a03 drivers: serial: nrfx_uarte: Fix high-speed UART baudrate calculation
The UARTE_GET_CUSTOM_BAUDRATE macro used an incorrect formula that
did not match the one specified in the nRF54x UARTE datasheet.

The correct formula is:
  2^12 * floor(2^20 / round(f_PCLK / desired_baudrate))

Update the macro to match the datasheet formula, to reduce the
baudrate error for high-speed UART instances on nRF54x devices.

Signed-off-by: Ahmed Ahmed <ahmed.ahmed@dewinelabs.com>
2026-03-30 09:58:40 -05:00
Pisit Sawangvonganan
4328b32b5c drivers: fix typo in (serial, spi, tee, timer, usb, usb_c, video)
Utilize a code spell-checking tool to scan for and correct spelling errors
in all files within:
- `drivers/serial`
- `drivers/spi`
- `drivers/tee`
- `drivers/timer`
- `drivers/usb`
- `drivers/usb_c`
- `drivers/video`

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2026-03-27 20:21:24 -04:00
Raffael Rostagno
90036ba970 drivers: uart: esp32: Remove sleep pinctrl init
Remove pinctrl sleep group init. Low power state for pinctrl will
be managed using harware feature.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2026-03-24 09:05:47 -04:00
Fabin V Martin
e7e3032e61 drivers: uart: microchip: sercom g1: changes for pic32cz_ca80
Updated the interrupt handler to connect all interrupt lines added
in the corresponding sercom uart node.

Signed-off-by: Fabin V Martin <Fabinv.Martin@microchip.com>
2026-03-24 07:06:16 -04:00
Missael Maciel
af089536ca drivers: uart: mcux_flexcomm: Avoid reading registers when no clock
Clock attach verification added previous to read flexcomm registers.
This ensures the flexcomm has a clock attached and is ready for
transmission, avoiding the system gets stuck in an infinite loop
while reading the registers.

Signed-off-by: Missael Maciel <davidmissael.maciel@nxp.com>
2026-03-24 05:26:46 +01:00
Tony Han
bc3586a8c2 drivers: serial: mchp: add minimal drivers for G1 DBGU (Debug Unit)
Add uart driver with minimal features for DBGU for sam9x7 SOCs.

Signed-off-by: Tony Han <tony.han@microchip.com>
2026-03-23 12:27:55 -05:00
Aaron Brice
01b611100c drivers: serial: renesas_ra: Fix tx_enable
In uart_ra_sci_irq_tx_enable() it clears the Transmit Data Empty and
Transmit End flags.  Doing this results in the uart re-sending the last
byte written to the TDR if the fifo is not being used.  Avoid clearing the
status in the fifo-disabled case.

Signed-off-by: Aaron Brice <aaron@embeddedts.com>
2026-03-23 10:16:50 +01:00
Hau Ho
53399d85d1 drivers: serial: Support serial driver for RX14T SoC
Modify driver code to adapt with RX14T SoC

Signed-off-by: Hau Ho <hau.ho.xc@bp.renesas.com>
2026-03-23 10:16:41 +01:00
John Batch
02d10281ee drivers: serial: infineon: use shared HF clock utility
Remove the duplicated ifx_cat1_get_hfclk_for_peri_group() function and
use version from shared header file.

Assisted-by: GitHub Copilot:claude-opus-4.6
Signed-off-by: John Batch <john.batch@infineon.com>
2026-03-20 09:55:43 -05:00
Jackson Farley
ea88bf7cf6 drivers: uart: added rx timeout for MSPM0
The low RX FIFO threshold of 1 could lead to issues during higher baud
rates, thus the threshold is increased and the RX Timeout feature on the
MSPM0 is introduced.

Signed-off-by: Jackson Farley <j-farley@ti.com>
2026-03-20 20:45:39 +09:00
Jackson Farley
5384bd0b5f drivers: serial: uart bugfix for interrupt ISR
The isr implementation would clear pending interrupts that had fired
since the first check for pending interrupts, leading to missed events.
This PR amends that issue and fixes typos in comparing IIDX types rather
than bitmasks to explicit comparisons

Signed-off-by: Jackson Farley <j-farley@ti.com>
2026-03-20 20:45:39 +09:00
Fin Maaß
65860193cf drivers: serial: test: implement missing irq_is_pending
implement missing irq_is_pending.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-03-20 20:43:25 +09:00
Krzysztof Chruściński
c2bcc85da4 drivers: serial: nrfx_uarte: Return error if PM suspend fails
PM suspend operation cannot be performed for UART using asynchronous
API is there are any active operations. Instead of asserting return
error.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2026-03-20 18:17:37 +09:00
Ofir Shemesh
0a755ae198 serial: mcux_lpuart: report RX errors in async mode
The async mode ISR silently cleared RX error flags (overrun, parity,
framing, noise) without notifying the application. This violates the
Zephyr async UART API which requires a UART_RX_STOPPED event followed
by UART_RX_BUF_RELEASED and UART_RX_DISABLED.

Enable RX error interrupts alongside the idle-line interrupt, and
handle them in the ISR by reporting UART_RX_STOPPED with the
appropriate reason bitmask, then calling rx_disable() for the full
API-mandated teardown sequence.

Also set rx_dma_params.buf to NULL in rx_disable() after releasing
buffers, so stale pointers are not left behind.

Signed-off-by: Ofir Shemesh <ofirshemesh777@gmail.com>
2026-03-20 13:31:47 +09:00
Ofir Shemesh
399ceea11c serial: mcux_lpuart: clear RX DMA buffer pointer on disable
Clear rx_dma_params.buf to NULL in mcux_lpuart_rx_disable() after
releasing all buffers. Without this, the stale pointer remains set
after RX teardown, which can cause subsequent checks against buf
to incorrectly assume RX is still active.

Signed-off-by: Ofir Shemesh <ofirshemesh777@gmail.com>
2026-03-20 13:31:47 +09:00
Sylvio Alves
262b0280ba drivers: serial: add esp32c5 support
Extend UART and USB serial drivers to support ESP32-C5. Add UHCI0
compatibility macro since the ESP32-C5 HAL exports the UHCI
peripheral as UHCI instead of UHCI0.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2026-03-19 14:53:05 -05:00
Sean Kyer
ffc3abcf2c drivers: serial: uart_max32: Add backup restoration support
Extended the resume routine of UART to support for device
reset from Backup power mode.

Signed-off-by: Sean Kyer <Sean.Kyer@analog.com>
2026-03-19 17:03:30 +01:00
Miguel Gazquez
3d797110e6 drivers: serial: uart_esp32: use dev instead of data->uart_dev
Pass the function argument `dev` to the async callback instead of
`data->uart_dev`. The pointers are identical, but `dev` is already
available in this context, so it's clearer to use it directly.

Signed-off-by: Miguel Gazquez <miguel.gazquez@bootlin.com>
2026-03-19 16:59:36 +01:00