Commit graph

1933 commits

Author SHA1 Message Date
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
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