Commit graph

1871 commits

Author SHA1 Message Date
Krzysztof Chruściński
aa8b25850f drivers: serial: nrfx_uarte: Add support for direct interrupts
Add option to use direct ISR.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2025-05-07 11:45:18 +02:00
Bas van Loon
c020dfab41 drivers: serial: uart_mcux_lpuart: Fix pinctrl flow control
Currently the driver code does not actually request the flow control
state, it only checks if the state exists. To fix this we should
simply call pinctrl_apply_state() and if that fails, meaning no
flow control state exists, fall back to default pin mux settings.

Another case that needed fixing is run time flow control enabling
ie in the case where we have a WIFI/bluetooth module connected
and we initially operate without flow control but later enable
it after firmware download.

This patch addresses this as well by making a generic function
to achieve this.

Signed-off-by: Bas van Loon <bas@arch-embedded.com>
2025-05-05 18:07:33 +02:00
Stefan Giroux
6ec4436085 drivers: serial: fix uart_sam0 async rx timeout calculation
Zephyr moved to microseconds to represent uart async timeout.
This one has some additional logic that was not adjusted in
the transition from milliseconds.

c590b3545a was integrated in
https://github.com/zephyrproject-rtos/zephyr/pull/39041

Signed-off-by: Stefan Giroux <stefan.g@feniex.com>
2025-05-03 17:47:42 +02:00
Duy Nguyen
7e0d006851 driver: serial: Add support for uart interface for qemu_rx
Support uart driver for qemu_rx environment base on the SCI0
HW on RX MCU

Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
2025-05-02 09:18:16 +02:00
Duy Nguyen
84c4c6fa77 drivers: serial: Initial support for Renesas RX serial driver
Intial serial driver support for RX MCU, this driver utilize
the SCI HWIP for uart communication
Current support include polling API and Interrupt driven API,
some of the code is using Renesas RX Driver Package (RDP) as
hal layer

Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
Signed-off-by: Sang Tran <sang.tran.jc@renesas.com>
2025-05-02 09:18:16 +02:00
Axel Le Bourhis
0ecaef0053 drivers: mcux_flexcomm: fix character glitches at low power entry
Character glitches are observed when entering suspend and standby low
power modes.
To fix it, we make sure the `poll_out` API waits for the character
transfer to complete. This is aligned with the uart driver API
description.

Signed-off-by: Axel Le Bourhis <axel.lebourhis@nxp.com>
2025-05-01 18:16:57 +02:00
Camille BAUD
857c7c2f42 drivers: serial: add missing default y
Adds missing default y to bflb Kconfig

Signed-off-by: Camille BAUD <mail@massdriver.space>
2025-05-01 07:15:25 +02:00
Gerson Fernando Budke
aa9d327abf drivers: serial: bouffalolab: Add support to interrupts
Enable interrupt support in the driver.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2025-04-29 20:08:45 -04:00
Sylvio Alves
a831122029 drivers: uart/dma: esp32: revert to PRE_KERNEL_1
printf is failing in hello_world sample due to current
uart driver init level. This reverts back to PRE_KERNEL_1.
As uart depends on GDMA, set it also to same level.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2025-04-28 16:40:20 +02:00
Jordan Yates
9bbc6d1579 serial: uart_native_pty: ASYNC RX support
Add support for transmitting using the asynchronous API. The
asynchronous portion is simulated through a dedicated polling thread.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-04-25 18:58:47 +02:00
Jordan Yates
5536e5b5cd serial: uart_native_pty: ASYNC TX support
Add support for transmitting using the asynchronous API. The
asynchronous portion is simulated through the system workqueue.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-04-25 18:58:47 +02:00
Jordan Yates
3d344186fc serial: uart_native_pty_bottom: length parameter
Add a length parameter to the poll in read function so that data can be
read in larger chunks.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-04-25 18:58:47 +02:00
Hoang Nguyen
2e26a4497a drivers: serial: Add support for RZ/A2M
Add serial support for RZ/A2M

Signed-off-by: Hoang Nguyen <hoang.nguyen.jx@bp.renesas.com>
Signed-off-by: Binh Nguyen <binh.nguyen.xw@renesas.com>
2025-04-25 14:05:01 +02:00
Hao Luo
b64a56362d dts: power: ambiq: change to use ambiq HAL to do power-on config
Changed to use ambiq HAL to do power-on config, no need to bind
pwrcfg any more

Signed-off-by: Hao Luo <hluo@ambiq.com>
2025-04-24 16:55:08 +02:00
Gerson Fernando Budke
531915deda drivers: serial: bouffalolab: Add bflb serial driver
Add Bouffalo Lab serial driver. The driver uses pinctrl to configure
pins and have power management capabilities.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2025-04-24 01:26:37 +02:00
Cong Nguyen Huu
b985b9437c drivers: uart_nxp_s32_linflexd: support config via devicetree
Added support for initialization configuration via Devicetree.

Signed-off-by: Cong Nguyen Huu <cong.nguyenhuu@nxp.com>
2025-04-23 11:48:24 +02:00
Hao Luo
1e8fb26b67 drivers: serial: pl011: Add support for Ambiq Apollo510 SoC UART
Added more clock sources for Apollo510 support

Signed-off-by: Hao Luo <hluo@ambiq.com>
2025-04-21 20:04:31 +02:00
Maochen Wang
90cd350c5a drivers: serial: fix console hang when waken up from PM3
The console can't input when waken up from PM3, as get the wrong
usart_intenset when process PM_DEVICE_ACTION_TURN_ON and the
USART interrupt is not enabled. Only saving usart_intenset after
PM action of PM_DEVICE_ACTION_TURN_OFF can fix this issue.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2025-04-17 09:06:38 +02:00
Hao Luo
6f4b92d64d soc: ambiq: Optimize the inclusion relationship of header files
Optimized the inclusion relationship of header files

Signed-off-by: Hao Luo <hluo@ambiq.com>
2025-04-17 09:06:18 +02:00
Krzysztof Chruściński
e0f5241b28 drivers: serial: nrfx_uarte: Fix use of PM_DEVICE_ISR_SAFE
PM_DEVICE_ISR_SAFE shall not be used when non-asynchronous API is used
because RX is disabled in suspend action and that takes relatively
long time. In case of PM_DEVICE_ISR_SAFE it is done with interrupts
disabled. RX is not used at all if disable-rx property is set and in
that case PM_DEVICE_ISR_SAFE can be used.

Added macro which determines if ISR safe mode can be used.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2025-04-15 19:09:43 +02:00
Scott Worley
ab071da3be drivers: serial: Microchip MEC5 add select PINCTRL to Kconfig
Zephyr has changed the rules for PINCTRL to use Kconfig select
feature at the driver level instead of setting the Kconfig
item directly in the board or application level. We updated
the MEC5 UART serial driver Kconfig to select PINCTRL.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
2025-04-11 17:31:37 +02:00
Lucas Tamborrino
232e2c5a3c drivers: uart: espressif: Add LP UART driver
Add LP UART driver for LP Core

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2025-04-11 13:34:17 +02:00
Peter van der Perk
818d9dc286 drivers: serial: uart_mcux_lpuart: RX IRQ Enable RxOverrun flag
If the RX FIFO buffer is full and there's nothing being transmitted
no LPUART interrupt will fire anymore. Thus the application will not
receive any bytes anymore. By enabling kLPUART_RxOverrunInterruptEnable
we will receive interrupts even though RX FIFO is full so we can recover
from this.

Signed-off-by: Peter van der Perk <peter.vanderperk@nxp.com>
2025-04-09 15:24:11 +02:00
Tim Lin
d64d87f655 drivers/serial: Add ITE UART wrapper to enable serial driver of ns16550
Add ITE UART wrapper to enable serial driver of ns16550.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2025-04-08 10:48:26 +02:00
Samuel Chee
9bac31e5a2 drivers: uart: adds pinctrl support for Arm cmsdk uart driver
Adds necessary pinctrl support for Arm cmsdk uart driver

Signed-off-by: Samuel Chee <samche01@arm.com>
Signed-off-by: Sudan Landge <sudan.landge@arm.com>
2025-04-07 15:18:10 +02:00
Martin Hoff
13bdc3cebd drivers: serial: silabs: add __maybe_unused to eusart dma callback
The callback function for the DMA is not used in the case where no DMA
properties are given in the esuart node in the device tree. It causes
a warning in the CI build.

Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
2025-04-03 17:48:36 +02:00
Jordan Yates
8f53407fa6 serial: cmsdk_apb: fix irq_is_pending
Implement `irq_is_pending` in terms of the `irq_rx_ready` and
`irq_tx_ready` function calls.

Using `intstatus` directly results in an implementation that does not
conform to the interrupt driven UART API. Since `intstatus` bits are
only only set when a buffer transitions from full to empty, any calls to
`irq_is_pending` before any bytes have been sent will return 0. This is
problematic since the documented implementation for the API IRQ handler
is:
```
while (uart_irq_update(dev) && uart_irq_is_pending(dev)) {
    if (uart_irq_rx_ready(dev)) {
        ...
    }
    if (uart_irq_tx_ready(dev)) {
        uart_fifo_fill(dev, ...);
    }
}
```
If `uart_irq_is_pending` does not return 1 until the first byte is sent,
we never end up pushing data to be transmitted into the `uart_fifo_full`
function.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-04-03 08:43:37 +02:00
Khanh Nguyen
7ae800a0c9 drivers: timer: Add ULPT timer for power management on Renesas RA MCUs
drivers:
- Added ULPT timer driver in `renesas_ra_ulpt_timer.c`.
- Updated `clock_control_renesas_ra_cgc.c` for ULPT clock settings.
- Updated `uart_renesas_ra8_sci_b.c` for power management support.
- Updated `CMakeLists.txt` and `Kconfig` to integrate ULPT timer.
- Added `Kconfig.renesas_ra_ulpt` for ULPT-specific configurations.

dts bindings:
- Added `renesas,ra-ulpt.yaml` for ULPT node bindings.
- Added `renesas,ra-ulpt-timer.yaml` for ULPT timer bindings.

modules:
- Updated `Kconfig.renesas_fsp` to support ULPT and LPM.

Signed-off-by: Khanh Nguyen <khanh.nguyen.wz@bp.renesas.com>
2025-04-03 08:41:08 +02:00
Raffael Rostagno
4b8dc5f3ff drivers: esp32: Update for shared intc
Drivers update to use shared interrupt allocator for Xtensa
and RISCV devices.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2025-04-02 19:02:27 +02:00
Martin Hoff
cb07e991c2 drivers: serial: silabs: introduce pm for silabs eusart
Make use of pm_device_driver_init to perform driver initialization.
Implement PM suspend and resume, which performs the following actions:

* Enables/disables the USART
* Gates the USART clock
* Configures USART pins

Also take PM locks to prevent deep sleep during TX and RX operations.

Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
2025-04-02 13:04:19 +02:00
Martin Hoff
87141ed455 drivers: serial: silabs: introduce asynchronous silabs eusart
Introduce silabs asynchronous eusart with dma support.

Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
2025-04-02 13:04:19 +02:00
Martin Hoff
4ec3405d16 drivers: serial: silabs: replace prefix in silabs eusart driver
Replace prefix from "uart_silabs_eusart" to "eusart" in order to
simplify the code, and make it more readable.

Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
2025-04-02 13:04:19 +02:00
Martin Hoff
a1389541ff drivers: serial: silabs: introduce silabs eusart runtime configure
Introduce runtime configuration API for the silabs eusart driver.

Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
2025-04-02 13:04:19 +02:00
Martin Hoff
02c8d02565 drivers: serial: silabs: harmonize silabs eusart code with silabs usart
Apply code cleaning done in silabs usart driver to silabs eusart driver.

Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
2025-04-02 13:04:19 +02:00
Martin Hoff
6fc53a6ed2 drivers: serial: silabs: split init in silabs eusart driver
Split of uart_silabs_eusart_init function to have better visibility of
initialization.

Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
2025-04-02 13:04:19 +02:00
Martin Hoff
3382b6769d drivers: serial: silabs: correction of silabs eusart code indentation
Apply correct indentation to silabs eusart driver.

Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
2025-04-02 13:04:19 +02:00
Etienne Carriere
4e37a1bb4b drivers: serial: uart_stm32: support DMA when CONFIG_MEM_ATTR=n
Allow STM32 UART driver to operate with DMA support even when
CONFIG_MEM_ATTR is disabled which happen when CONFIG_ARM_MPU is
intentionally disabled despite the CPU supports MPU.

By the way, remove some #ifdef directive on header files inclusion
that add noise in the header file inclusion section without any
benefit.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2025-04-02 12:54:50 +02:00
Jordan Yates
784f64650b serial: stm32: unconditional policy locks for async TX
When using the asynchronous TX API, skip the `data->pm_policy_state_on`
checks for PM policy updates. This fixes two issues:
 * State conflicts with the `poll_out` implementation when both APIs are
   used on the same port, resulting in the SoC sleeping while
   transmissions are running.
 * Scheduling a TX from the `TX_DONE` callback resulting in the PM
   policy not being applied, resulting in TX errors.

Every call to `uart_tx` should have a corresponding `TX_DONE` event
generated, which makes the raw (reference counted) calls to
`pm_policy_state_lock_put/get` the correct API to use here.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-04-02 05:29:36 +02:00
Kesavan Yogeswaran
aa3d3b0bdb drivers: Fix declaration after label compile error
Fix two instances where switch-case labels were followed immediately by
a declaration, which is generally invalid and can cause compilation
failure.

Signed-off-by: Kesavan Yogeswaran <hikes@google.com>
2025-03-31 19:50:50 -04:00
Jordan Yates
32229d0b6c serial: stm32: block sleep modes while RX is active
Block the SoC from re-entering sleep modes while the RX line is active,
if the RX activity previously woke the device from the sleep states.
This stops the device from continuously transitioning between the two
modes and improves responsiveness.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-03-28 08:41:31 +01:00
Jordan Yates
83ea0f7f80 serial: stm32: fix dropped UART_TX_DONE events
Fix dropped `UART_TX_DONE` events when poll out and async APIs are used
on the same port. Clearing `tx_poll_stream_on` is required to prevent
`uart_stm32_isr` from prematurely clearing the TC status bit.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-03-28 08:41:31 +01:00
Jamie McCrae
f6730f7db3 drivers: serial: kconfig: Fix unsorted additions
Fixes Kconfig files that have not been added in the right place

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-03-26 11:33:11 +01:00
Derek Snell
b259b18752 drivers: serial: uart_mcux_lpuart: add DTR, DSR, and DCD signals
Add support for additional line control signals.  Improved configuring
uart_config_flow_control options.

Signed-off-by: Derek Snell <derek.snell@nxp.com>
2025-03-24 19:22:42 +01:00
Hao Luo
4744d138c2 drivers: ambiq: Change the way to power on ambiq drivers
This commit changes to use ambiq hal power control APIs
to replace the previous register settings to power on
ambiq drivers.

Signed-off-by: Hao Luo <hluo@ambiq.com>
2025-03-24 09:54:17 +01:00
Mahesh Mahadevan
90042077b8 drivers: uart: Add PM action for NXP UART Flexcomm driver
Add power action callback handlers to the driver.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2025-03-21 09:51:38 +01:00
Nhut Nguyen
9ae595db9d drivers: serial: Add support for RZ/A3UL
This is the initial commit to support UART driver for Renesas RZ/A3UL.

Signed-off-by: Nhut Nguyen <nhut.nguyen.kc@renesas.com>
Signed-off-by: Tien Nguyen <tien.nguyen.zg@renesas.com>
2025-03-19 03:34:15 +01:00
Kent Stark Olsen
04e3a68f27 drivers: serial: xuartps: removing redundant include
This include seems redundant as the driver builds fine without
it being included. When including soc.h it also causes issues
if one utilises the xenvm board when compiling. I suggest this
is removed completely as it seems unnecessary to create this
tight coupling to a specific SoC as the driver implementation
is describing itself perfectly well, and works well without
this soc.h-file.

Signed-off-by: Kent Stark Olsen <kent.stark.olsen@gmail.com>
2025-03-19 01:27:01 +01:00
Kent Stark Olsen
5599bf5914 drivers: serial: xuartps: fixing set_baudrate function
The Xilinx xuartps driver fails to find the correct pre-scaler
parameters for the BAUDDIV and BAUDGEN registers. This fix
corrects that behaviour. The reason why it fails is due to
the stop condition for the search being ill-conditioned.
The stop condition is based on a baudrate error, and this
was chosen to be 3 percent. This would cause the parameter
search to stop too early returning ill-condotioned pre-scaler
parameters. This has been corrected by setting the stop condition
to be 3 permille instead of 3 percent. This change was tested
with an AMD Zynq Ultrascale+ MPSoC ZU3EG.

Signed-off-by: Kent Stark Olsen <kent.stark.olsen@gmail.com>
2025-03-19 01:27:01 +01:00
TOKITA Hiroshi
cbcf36e1a7 dts: arm: renesas: ra: Remove old R7FA4M1AB3CFM configurations
Due to historical reasons, there were two implementations of
R7FA4M1AB3CFM. However, the migration has been completed,
so the old one is now being removed.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2025-03-17 16:24:42 +01:00
Robert Hancock
df5ffc9165 drivers: serial: uart_xlnx_ps: Fix interrupt mode issues
This driver had some issues with interrupt-driven operation, which
manifested by the console breaking when enabling the Zephyr shell on the
kv260_r5 target for example. Fixed the following:

-Ensure device is fully hardware reset during initialization

-Changed poll_out to be more consistent with other drivers, i.e. only
wait for the UART to accept the character, not for it to be fully
transmitted.

-Added implementation for err_check function, as otherwise there was no
way to detect or clear the error interrupts enabled by irq_err_enable.

-Fixed logic for enabling/disabling interrupts. This should only be done
by explicit enable/disable calls, not as part of fifo_fill etc.

-This hardware does not produce interrupts for TX FIFO empty or RX FIFO
threshold when enabling them if the TX FIFO is already empty or RX FIFO
already contains data. When enabling interrupts in these cases, use a
timer to trigger a user callback to match the normal UART API usage,
similar to the xlnx_uartlite driver.

-Other minor cleanups to interrupt-driven functions.

Signed-off-by: Robert Hancock <robert.hancock@calian.com>
2025-03-15 13:07:28 +01:00