Commit graph

1871 commits

Author SHA1 Message Date
Robert Hancock
a52230b8be drivers: serial: uart_xlnx_ps: run clang-format
Updated code formatting with clang-format. No functional change
intended.

Signed-off-by: Robert Hancock <robert.hancock@calian.com>
2025-03-15 13:07:28 +01:00
Henrik Brix Andersen
d96e95ee76 drivers: serial: uart: neorv32: neorv32_uart_config_get() can be unused
Guard the neorv32_uart_config_get() function to avoid compilation warning
with CONFIG_UART_USE_RUNTIME_CONFIGURE=n.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2025-03-15 00:35:36 +01:00
Dominik Lau
b4c0ec5bd4 drivers: serial: ns16550: allow clock_control_on returning ENOSYS
Fixes a regression caused by: 88830a3b
The ns16550 driver should handle possibility of
clock_control_on being a stub (i.e. returning ENOSYS)

Signed-off-by: Dominik Lau <dlau@antmicro.com>
2025-03-14 14:40:24 +01:00
Hoang Nguyen
6a00473fa6 drivers: serial: Add support for RZ/N2L
Add serial driver support for RZ/N2L

Signed-off-by: Hoang Nguyen <hoang.nguyen.jx@bp.renesas.com>
Signed-off-by: Nhut Nguyen <nhut.nguyen.kc@renesas.com>
2025-03-14 09:23:50 +01:00
Nirav Agrawal
fbf3353ec6 drivers: serial: add support for uart_line_ctrl_set()
- For MCUX LPUART driver, added support to control RTS line
  High/Low from other driver/app code.

- This control is required to wakeup other device which is
  in sleep and configured its wakeup-source as UART-CTS line.

Signed-off-by: Nirav Agrawal <nirav.agrawal@nxp.com>
2025-03-13 07:40:49 +01:00
Furkan Akkiz
b0672f8237 drivers: serial: Add clock source selection feature to MAX32 UART
This commit adds clock source selection feature to UART of MAX32 MCUs.

Signed-off-by: Furkan Akkiz <hasanfurkan.akkiz@analog.com>
2025-03-12 19:01:40 +01:00
Nikodem Kastelik
c4ebf713b1 drivers: serial: nrf: set default frame size and endianess
Setting frame size and endianess is now supported in UARTE HAL,
so these settings must have default values configured
to avoid compiler warnings about uninitialized fields.

Signed-off-by: Nikodem Kastelik <nikodem.kastelik@nordicsemi.no>
2025-03-12 09:54:32 +01:00
Alberto Escolar Piedras
cb53e40ff9 drivers uart_native_posix: rename to native_pty and support N instances
Rename the driver from uart_native_posix to uart_native_pty.
Including renaming the DTS compatible, and kconfig options, deprecating
the old ones.

And refactor the driver, generalizing it, so we can have any number of
instances.
Note that, unfortunately generalizing to N instances cannot be done
without a degree of backwards compatibility breakage: This driver was
born with all its configuration and selection of the instances based on
kconfig.
When the driver was made to use DT, it was done in a way that required
both DT and kconfig needing to manually coherently enable the 2nd UART.
This has now been fixed, which it means only DT is used to decide how
many instances are avaliable, and UART_NATIVE_POSIX_PORT_1_ENABLE is
just ignored.

Including:
* Deprecate UART_NATIVE_WAIT_PTS_READY_ENABLE: the options is always on
  now as it has no practical drawbacks.
* Deprecate UART_NATIVE_POSIX_PORT_1_ENABLE: DTS intanciation defines it
  being available now.
* Rename a few functions and in general shorten pseudo-tty/pseudo-
  terminal to PTY instead of PTTY.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-03-11 18:54:02 +01:00
Henrik Brix Andersen
63c24d9d34 soc: neorv32: update to support NEORV32 v1.11.1
Update the NEORV32 SoC, peripheral drivers, and board to support NEORV32
v1.11.1. Notable changes include:

- Optional RISC-V ISA Kconfigs are now selected on the board level.
- Peripheral registers are now automatically reset in hardware, no need for
  software initialization code.
- The NEORV32 GPIO controller now supports 32 pins, not 64. Interrupt
  support will be submitted in a separate PR.
- Default board configuration has 64k RAM and is clocked at 18 MHz.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2025-03-10 11:11:22 +01:00
Nils Ruf
1972a3f5fc drivers: uart: uart_native_tty: allow multiple instances
Adds one RX thread per instance. Previously, only one global RX thread was
used resulting in crashes due to the thread instance being overwritten by
other instances.

Signed-off-by: Nils Ruf <nils.ruf@endress.com>
2025-03-07 20:25:04 +01:00
TOKITA Hiroshi
e56260544f drivers: serial: pl011: Add fifo disable configuration
Add a setting to the devicetree for disabling the PL011 FIFO.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2025-03-07 19:42:26 +01:00
Khoa Nguyen
c768144002 drivers: Correct value of event macro for all Renesas SoC
Since the RA2L1 uses the macro "ICU_EVENT" instead of
"ELC_EVENT" (which is currently used) to input into
the IELSR register, the ek_ra2l1 board cannot assign
any interrupts for any driver.

This commit aim to correct the Event macro to input correct
value for IELSR register on all the Renesas SoC by using
"BSP_PRV_IELS_ENUM" macro.

Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
2025-02-28 18:29:17 +01:00
Miguel Gazquez
9b2fdace1d drivers: uart: wch_usart: Fix typo in USART_WCH_IRQ_HANDLER
Previously, 'USART_WCH_IRQ_HANDLER' used 'DT_INST_IRQ(index, priority)',
which incorrectly referenced 'index' instead of 'idx'. This issue went
undetected because 'IRQ_CONNECT' drops the priority value on all boards
supported by this driver.

Fix by using 'DT_INST_IRQ(idx, priority)'.

Signed-off-by: Miguel Gazquez <miguel.gazquez@bootlin.com>
2025-02-22 07:13:51 +01:00
Martin Hoff
bb760440b8 drivers: serial: silabs: Add new Kconfig symbol for async
Add a new Kconfig symbol (UART_SILABS_USART_ASYNC) to enable the async
API for the Silabs USART driver.
It is needed because the symbol (UART_ASYNC_API) is shared between uart
driver. In the case that you have multiple UART drivers enabled,
condition to enable async API for different uart driver may differ.

Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
2025-02-20 14:54:58 +00:00
Xudong Zheng
e885c8c42f drivers: serial: pl011: prevent concurrent interrupt callback execution
Since the callback can be executed from either software or a hardware
interrupt, it's possible for multiple instances of the callback function
to run concurrently. That should not happen and can be particularly
problematic on SMP systems. This commit adds a spinlock to prevent
concurrent execution.

This addresses a Twister CI failure discovered in #85539.

Signed-off-by: Xudong Zheng <7pkvm5aw@slicealias.com>
2025-02-19 04:59:59 +01:00
Yasin Ustuner
3efeb245a7 drivers: serial: Change Tx Status macro for MAX32
TX status macro is different for MAX32650 SoC.
The common macro is added to the hal.
This commit changes the tx status macro with
the common one.

Signed-off-by: Yasin Ustuner <Yasin.Ustuner@analog.com>
2025-02-14 13:35:26 +01:00
Xudong Zheng
b783bc8448 drivers: serial: pl011: fix missing TX callback with FIFO enabled
When using the interrupt UART API, it is expected that the driver will
call the callback function repeatedly while TX interrupt is enabled.
However that is not necessarily the case with the FIFO is enabled.

If the application calls uart_fifo_fill() each time with only one byte
of data, the TX interrupt will never trigger. This is because the 1/8 TX
interrupt trigger threshold is never reached. For this reason, the
callback function should be called multiple times from software as
needed.

Fixes zephyrproject-rtos/zephyr#85479

Signed-off-by: Xudong Zheng <7pkvm5aw@slicealias.com>
2025-02-13 01:14:09 +01:00
Aksel Skauge Mellbye
6f3798b990 drivers: serial: silabs_usart: Prevent deep sleep
Take PM locks to prevent deep sleep during TX and RX operations.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2025-02-12 20:17:36 +01:00
Aksel Skauge Mellbye
2aa31be37c drivers: serial: silabs_usart: Introduce pm_device_driver_init
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

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2025-02-12 20:17:36 +01:00
Aksel Skauge Mellbye
bfc9aa3dc4 drivers: serial: silabs_usart: Simplify peripheral init
Reuse the same peripheral init function between init and the
runtime configure API. Remove redundant enable calls, the init
function enables the USART internally.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2025-02-12 20:17:36 +01:00
Pieter De Gendt
7cef0e3614 drivers: serial: Wrap driver instances in device API macro
Use the device API macro to place the driver API instance into an iterable
section.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-02-12 16:06:25 +01:00
Jérôme Pouiller
88830a3b25 uart: ns16550: Enable clock if defined
Currently, ns16550 allows the user to specify a clock attribute in the
Device Tree. This node is use to retrieve the internal frequency of the
hardware block.

However, ns16550 expects the clock is already initialised and it doesn't
try to enable it. Let's fix that issue.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
2025-02-11 22:07:11 +01:00
Xudong Zheng
a6a47d36af drivers: serial: add placeholder file for new device stack USB CDC ACM
This is necessary to suppress CMake build warning due to no source file
defined for drivers__serial.

Signed-off-by: Xudong Zheng <7pkvm5aw@slicealias.com>
2025-02-11 15:42:30 +01:00
Leifu Zhao
a3619ee963 drivers: serial: sedi: enable runtime pm support
Enable runtime pm support for sedi uart driver.

Signed-off-by: Leifu Zhao <leifu.zhao@intel.com>
2025-02-11 15:41:03 +01:00
Martin Hoff
4a31f0227c driver: serial: silabs: implement asynch usart with dma
First implementation of asynchronous usart driver with dma support.

Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
2025-02-05 15:02:35 +01:00
Johan Hedberg
4618a272ce drivers: serial: silabs: Fix build for efm32wg_stk3800/efm32wg990f256
The gecko_uart.c driver supports both `silabs,gecko_uart` and
`silabs,gecko_usart` compat strings, however `PM_DEVICE_DT_INST_DEFINE()`
was missing when defining `uart` type instances. The
efm32wg_stk3800/efm32wg990f256 platform enables by default one
`gecko_uart` DT node and no `gecko_usart` nodes. This results in the
following build warning/error:

uart_gecko.c:673:12: warning: 'uart_gecko_pm_action' defined but not used

Add the missing call to `PM_DEVICE_DT_INST_DEFINE()`.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2025-02-05 14:58:28 +01:00
Vebjorn Myklebust
4d146175f9 drivers: serial: Add support for cc23x0 UART
Add support for UART to cc23x0 SoC.

Signed-off-by: Lars Thalian Morstad <l-morstad@ti.com>
Signed-off-by: Vebjorn Myklebust <v.myklebust@ti.com>
Signed-off-by: Stoyan Bogdanov <sbogdanov@baylibre.com>
Signed-off-by: Julien Panis <jpanis@baylibre.com>
2025-02-04 11:56:05 +01:00
Krzysztof Chruściński
e235e7b384 drivers: serial: nrfx_uarte: Fix spurious RXTO event
Fast instance in nrf54h (uart120) can generate a spurious RXTO event
some time after RXTO event that indicates that RX path is disabled.
The time when event is generated depends on baudrate and when slower
baudrates are used peripheral is disabled on time to not notice it
in the test but with higher baudates issue become visible. In order
to avoid spurious interrupt, RXTO interrupt is disabled during RXTO
event handling and enabled when RX is enabled. This workaround is
applied only for fast instance to avoid unnecessary register
accesses for slower instances.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2025-02-03 11:17:31 +01:00
Krzysztof Chruściński
972ec824f1 drivers: serial: nrfx_uarte: Add support for higher baudrates
nrf54x devices have UARTE instance capable of using baudrate higher
than 1M. Higher baudrates does not have predefined values for
BAUDRATE register. A formula can be used to calculate BAUDRATE
value that shall be used for desired baudrate. Add UARTE_ANY_HIGH_SPEED
macro which is set when high speed is enabled (uart00 in nrf54lx or
uart120 in nrf54h20). For high speed instance use formula for getting
value that shall be written to BAUDRATE register.

When runtime configuration is not used then same formula is used to
calculate fixed BAUDRATE value.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2025-02-03 11:17:31 +01:00
Krzysztof Chruściński
1573be5e9f drivers: serial: nrfx_uarte: Rename FAST to FAST_PD
Rename UARTE_ANY_FAST to UARTE_ANY_FAST_PD. There are 2 types of
'fast' UARTE instances. In nrf54h20 instance uart120 is in fast
power domain that requires additional power and clock management
of that domain. In nrf54lx fast uart00 instance does not require
that. Add _PD to indicate fast power domain.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2025-02-03 11:17:31 +01:00
Ajay Neeli
b7d13ea6ca serial: xilinx: uartlite: update irq_enable to use DT_INST_IRQN_BY_IDX
Update the irq_enable macro to use the DT_INST_IRQN_BY_IDX helper.

This ensures proper handling of IRQ numbers in systems with multi-level
interrupt configurations.

Signed-off-by: Ajay Neeli <ajay.neeli@amd.com>
2025-02-03 09:05:19 +01:00
Martin Hoff
2594eae6f1 drivers: uart: silabs: revert pm deletion for usart_gecko
Revert delete of the uart_gecko_pm_action function.

Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
2025-01-31 19:51:27 +01:00
Jamie McCrae
560db8509a drivers: kconfig: Fix bleeding options
Fixes a multitude of Kconfigs that wrongly appear on devices
where support is literally impossible

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-01-31 11:50:12 +01:00
Nazar Palamar
fb1c9c880f drivers: serial: CAT1 UART driver: add ASYNC_API functionality
Add ASYNC_API functionality

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2025-01-30 02:00:50 +01:00
Peter Johanson
484fb29f5f drivers: serial: Pico PIO UART wait for initial high
Adjust the PIO assemble for the UART RX to wait for the line
to initially be high before starting the wrap loop and wait
for a low start bit.

Signed-off-by: Peter Johanson <peter@peterjohanson.com>
2025-01-27 21:03:48 +01:00
Pieter De Gendt
f1c4760304 drivers: Update APIs to use DEVICE_API macro
Some drivers APIs were not wrapped using the DEVICE_API macro.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-01-24 01:15:19 +01:00
Yishai Jaffe
12240a9058 shell: uart: add write command
Added a command to write to a uart device.

Signed-off-by: Yishai Jaffe <yishai1999@gmail.com>
2025-01-23 16:30:39 +01:00
Yishai Jaffe
1709731c5c shell: uart: fixed indentation
Fixed indentation to match line above.

Signed-off-by: Yishai Jaffe <yishai1999@gmail.com>
2025-01-23 16:30:39 +01:00
Xudong Zheng
020cb79d27 drivers: serial: nrfx_uarte: move DEPRECATED_UART_NRFX_UARTE_LEGACY_SHIM
The Kconfig option should be defined alongside
UART_NRFX_UARTE_LEGACY_SHIM for clarity.

Signed-off-by: Xudong Zheng <7pkvm5aw@slicealias.com>
2025-01-23 08:26:33 +01:00
Martin Hoff
576e475558 driver: serial: silabs: Change PM Device definition order
Change the definition order of the PM Device to fix the build error.

Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
2025-01-22 15:50:14 +01:00
Paul Wedeck
fda64760ba drivers: uart_wch: Fix compiler warning
This commit removes an unused variable.

Signed-off-by: Paul Wedeck <paulwedeck@gmail.com>
2025-01-21 19:30:53 +01:00
Martin Hoff
1318f1543c driver: serial: split silabs series 2 and series 0/1 boards usart driver
Split the USART driver into separate implementations for Silabs Series 2
and Series 0/1 boards. This change improves maintainability (especially
with the support of pin-ctrl and clock-ctrl on series 2 boards).

Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
2025-01-21 19:29:25 +01:00
Sven Ginka
a89b81b110 drivers: serial: sy1xx add support for pinctrl
Add pin ctrl to the serial driver.

Signed-off-by: Sven Ginka <s.ginka@sensry.de>
2025-01-21 19:29:14 +01:00
Declan Snyder
d02c48ee8d uart_mcux_lpuart: LPFlexcomm inst based determine
Since some platforms may have some lpuart that are wrapped in lpflexcomm
and some that are not, then change the init code to determine how to
connect the interrupt on an instance basis.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-01-21 19:28:01 +01:00
Tahsin Mutlugun
2d59b75d69 drivers: serial: uart_max32: Use cache to workaround DMA limitation
When using asynchronous API, transfer will fail if the source buffer is
located in a region that cannot be accessed by DMA. This could happen
when a buffer is declared const, and placed in flash memory, for
example.

Workaround this problem by loading the data into a set of temporary
caches before passing them to DMA.

Signed-off-by: Tahsin Mutlugun <Tahsin.Mutlugun@analog.com>
2025-01-21 09:13:34 +01:00
Tahsin Mutlugun
50596320d4 drivers: serial: uart_max32: Add async mode support
This commit adds asynchronous mode support to MAX32 UART driver. Each
direction uses a single DMA channel that is assigned in devicetree
configuration.

Asynchronous mode also depends on interrupts to refresh receive
timeouts.

Signed-off-by: Tahsin Mutlugun <Tahsin.Mutlugun@analog.com>
2025-01-21 09:13:34 +01:00
Nhut Nguyen
5a65c861a7 drivers: serial: Add interrupt-driven API support for RZ/G3S
This commit is to support UART interrupt-driven API for Renesas RZ/G3S.

Signed-off-by: Nhut Nguyen <nhut.nguyen.kc@renesas.com>
2025-01-21 09:12:15 +01:00
Jun Lin
2615ec879e driver: serial/uart: npcx: disable rx interrupt at init
In the application, after the sysjump, the RX interrupt might remain
enabled. During initialization, once the IRQ is enabled, the RX
interrupt could be triggered if there is any traffic on the RX line,
potentially causing an interrupt storm.

This change disables the UART RX interrupt at the driver initialization
to prevent this issue from occurring.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2025-01-21 07:07:47 +01:00
Yishai Jaffe
f36b7cfe36 drivers: serial: uart_gecko: add runtime configuration
Added support for runtime configuration of the baudrate

Signed-off-by: Yishai Jaffe <yishai1999@gmail.com>
2025-01-16 22:38:15 +01:00
Yishai Jaffe
1cbd13cd0e drivers: serial: uart_gecko: support uart_cfg options
Adde usage of uart_cfg struct and support its options of parity, data
bits, and start bits

Signed-off-by: Yishai Jaffe <yishai1999@gmail.com>
2025-01-16 22:38:15 +01:00