Commit graph

1933 commits

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