Commit graph

1231 commits

Author SHA1 Message Date
Dawid Niedzwiecki 4a2a512c11 drivers: serial: fix STM32 async uart driver
Fix a bug that causes not handling an IDLE line detection interrupt for
some STM chips, e.g. STM32F412. It impacts the async UART
communication - an information that data have been recieved is lost.

The issue occurs when the IDLE flag is set during handling another UART
interrupt, e.g Transmission complete. The ISR calls uart_stm32_err_check
function, which clears the noise error flag with LL_USART_ClearFlag_NE
without any additional checks. Unfortunately, clearing the noise flag
also clears the IDLE flag for some chips(an read to the USART_SR
register followed by a read to the USART_DR register for STM32F412
clears PE, FE, NF, ORE and IDLE flags), hence the ISR is not called
again for the IDLE event. The IDLE flag is no longer set.

Add checking the noise flag before clearing it.

Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com>
2023-01-04 10:33:49 +01:00
Marcin Szymczyk 6e5f432eee drivers: serial: nrfx: ifdef optional baudrates
Some baudrates are not supported in certain SoCs.

Signed-off-by: Marcin Szymczyk <marcin.szymczyk@nordicsemi.no>
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-28 10:38:09 +01:00
Declan Snyder f2e0ac5c58 drivers: uart_mcux_flexcomm: Add runtime configure
Add uart_configure and uart_config_get functionality to
MCUX flexcomm driver to be able to dynamically configure
flexcomm uart at runtime.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2022-12-21 09:38:33 -06:00
Mulin Chao 271b306b2d driver: uart: npcx: add missing tx/rx interrupt enabled checks
When checking if any UART TX/RX IRQs are pending, the driver should also
consider whether these IRQs are enabled. Or we still get pending status
set even if the related interrupts are disabled.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2022-12-21 12:19:13 +01:00
Andrzej Głąbek c984a343af drivers: uart_nrfx_uarte: Prevent re-enabling RX until UART_RX_DISABLED
Fix the driver so that after a call to uart_rx_disable() it does not
allow re-enabling RX until the UART_RX_DISABLED is generated (what
means that the disabling procedure is complete). Otherwise, it is
possible that the RXTO event from the previous RX is handled right
after a new RX is started, and the RX buffer pointer gets corrupted
in the `rx_flush()` function.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-12-21 11:47:34 +01:00
Erwan Gouriou 66d4c64966 all: Fix "#if IS_ENABLED(CONFIG_FOO)" occurrences
Clean up occurrences of "#if IS_ENABLED(CONFIG_FOO)" an replace
with classical "#if defined(CONFIG_FOO)".

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-12-21 10:09:23 +01:00
Pawel Czarnecki 0095eed3a1 dts: uart: silabs: make peripheral-id optional
peripheral-id property should be eventually removed.
For now set it as optional and allow skipping the usage
in UART driver.

Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
2022-12-20 22:50:19 +01:00
Filip Kokosinski 9756766892 drivers: serial: uart_gecko: Make driver dependent on pinctrl
This commit adds a series of driver-related changes to
Gecko pinctrl.

Co-authored-by: Mateusz Sierszulski <msierszulski@antmicro.com>
Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2022-12-20 22:50:19 +01:00
Pawel Czarnecki e8d3673c13 soc: arm: silabs: remove soc_gpio_configure wrapper
It would be better to use GPIO_PinModeSet() functions directly
in the drivers.

Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
2022-12-20 22:50:19 +01:00
Jiafei Pan 9d6bda0ec1 drivers: mcux_lpuart: fix compile warning
Fixed the following compile warnings:
../include/zephyr/sys/util.h:108: warning: "ARRAY_SIZE" redefined
hal/nxp/mcux/mcux-sdk/drivers/common/fsl_common.h:236: note:
this is the location of the previous definition

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2022-12-20 09:22:40 +01:00
Jiafei Pan e8d3e7d544 drivers: mcux_lpuart: remove unsed soc.h
soc.h will not used anymore, remove it.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2022-12-20 09:22:40 +01:00
Ravik Hasija 22e2b004df drivers: serial: Add Driver for CDNS UART IP6528
Adding New Serial/UART driver for Cadence UART IP6528.

Signed-off-by: Ravik Hasija <ravikh@fb.com>
2022-12-12 12:19:35 -05:00
Duong Vu Nam b24f4625f0 arch: support nocache for Cortex-R52
Config NOCACHE_MEMORY depend on ARCH_HAS_NOCACHE_MEMORY_SUPPORT. Enable
ARCH_HAS_NOCACHE_MEMORY_SUPPORT for Cortex-R52 to run NXP S32Z/E with
nocache attibute.

Enable nocache in each driver use it.

Signed-off-by: Duong Vu Nam <duong.vunam@nxp.com>
2022-12-12 10:39:31 +01:00
Patryk Duda 1aebcec02f drivers: serial: Reset UART using RCC before initialization
In multi-image environment, after jump to the image we can have UART in
unexpected state. Reset UART to default state to make sure that UART is
initialized properly and won't cause system to crash or hang.

Signed-off-by: Patryk Duda <pdk@semihalf.com>
2022-12-09 09:43:36 -08:00
Filip Brozovic c60e100ab3 drivers: serial: numicro: fix poll_in function
The poll_in function of the NuMicro UART driver was using the UART_Read
function from the Nuvoton HAL, which is blocking. Replace it with a
non-blocking implementation.

Signed-off-by: Filip Brozovic <fbrozovic@gmail.com>
2022-12-08 18:46:33 +01:00
Filip Brozovic 617aa8cc65 drivers: serial: numicro: use pinctrl instead of hard-coded values
This commit enables the numicro serial driver to configure the UART
pins using the pinctrl API.

Signed-off-by: Filip Brozovic <fbrozovic@gmail.com>
2022-12-08 18:46:33 +01:00
Grixa Yrev 4fe862e396 drivers: lpuart: enable rs485 mode
NXP LPUART IP supports rs485 mode when transceiver driver enable
using RTS. Allow setting rs485 mode up via the "nxp,rs485-mode"
dts property. "nxp,rs485-de-active-low" dts property can be used
for set RTS polarity.

Signed-off-by: Grixa Yrev <GrixaYrev@yandex.ru>
2022-12-07 10:12:14 +00:00
Andriy Gelman 9b43e3ac0f drivers: serial: uart_xmc4xxx: Fix write to fifo with more than one byte
Currently only the first byte was written when pushing more than
one byte into the fifo.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-12-05 11:03:22 +01:00
Francois Ramu e00f91da41 drivers: serial: uart driver for stm32U5 suspends dma channel
When DMA transfer is enabled on the stm32U5,
the UART Tx channel must be suspended before stopping.
This will let the on-going transfer ends properly

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-11-23 11:32:27 +01:00
Francois Ramu 0300b34cf0 drivers: serial: stm32 UART driver do not start Rx timer if null
This commit is optimizing the uart isr execution to avoid starting
the Rx timeout if it is null. In anycase the async_timer_start
function is checking the tiemout value. This will just save some
execution lines.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-11-23 11:32:27 +01:00
Francois Ramu 939b274507 drivers: serial: stm32 uart async is valid for stm32U5 serie
The UART_ASYNC is supported on the stm32U5 serie through the
GPDMA driver.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-11-23 11:32:27 +01:00
Andrzej Głąbek 595fbf9b97 drivers: uart_nrfx_uarte: Remove redundant HW_RX_COUNTING_ENABLED calls
Merge three adjacent `if (HW_RX_COUNTING_ENABLED(data))` blocks into
a common one.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-11-22 12:46:38 +09:00
Andrzej Głąbek 9628ecdc39 drivers: uart_nrfx_uarte: Fix call to HW_RX_COUNTING_ENABLED()
Since the macro references `data->async->hw_rx_counting`, it cannot
be called when `data->async` is NULL, and this could happen when the
PM_DEVICE_ACTION_RESUME action was requested for an instance that uses
the interrupt-driven API while for another instance that uses the
asynchronous API the hardware counting of bytes was configured.
Prevent this by calling the macro from a proper `if` block.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-11-22 12:46:38 +09:00
Jan Hilsdorf a429528e3d drivers: serial: convert Zephyr constants to rpi-hal constants
rpi-hal function "uart_set_format" expects data width in the range
of 5..8. So I created a new function “uart_rpi_set_format” which
contains common parts of “uart_rpi_configure”.

Signed-off-by: Jan Hilsdorf <jan.hilsdorf@gmail.com>
2022-11-19 14:18:00 +09:00
Johan Hedberg fcfff0633e drivers: uart_ns16550: Convert to use runtime PCIe BDF lookup
Convert the ns16550 driver to use the new centralized runtime BDF lookup
of PCIe devices.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2022-11-16 11:18:43 +01:00
Akos Melczer d7d6a84b36 drivers: serial: rpi_pico: added functions for runtime uart configuration
Added functions for runtime uart configuartion for raspberry pico

Signed-off-by: Akos Melczer <webmastertd000@gmail.com>
2022-11-15 12:12:47 +00:00
Daniel Leung bbb2f8277a uart: ns16550: move command macro to public header
This moves the CMD_SET_DLF command macro to public header
so application can use it without weird include path to
include the "private" header file under drivers/serial.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-11-10 22:40:21 -05:00
Henrik Brix Andersen 3c99a1e015 drivers: pcie: reintroduce support for I/O BARs
Reintroduce support for accessing I/O BARs which was removed in
43d84147d9.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-11-01 15:22:31 -04:00
Gerard Marull-Paretas b1a0d0ae86 include: add missing zephyr/kernel.h
Some files were using the Kernel APIs/types without including
zephyr/kernel.h.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-20 22:52:09 +09:00
Jun Lin 42bb67ca85 driver: UART: npcx: remove unnecessary guard CONFIG_UART_INTERRUPT_DRIVEN
Currently, uart_npcx_pm_policy_state_lock* functions are guarded by
CONFIG_UART_INTERRUPT_DRIVEN && CONFIG_PM. However, it is unnecessary to
guard them with CONFIG_UART_INTERRUPT_DRIVEN as the polling mode UART
driver also uses these functions.
This commit removes it and leaves those functions guarded by CONFIG_PM
only.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2022-10-20 15:42:17 +02:00
Michal Sieron 88e8b69daf drivers: serial: Add QuickLogic USBserialport_S3B support
USB interface that may be used to send messages from a USB host to
the M4 processor in the S3B, and vice-versa.

Signed-off-by: Michal Sieron <msieron@antmicro.com>
2022-10-20 15:41:09 +02:00
Wouter Cappelle 984b612c48 drivers: uart: stm32 async uart driver should free next buffer
When disabling async rx, the next buffer is not free-ed by
the stm32 uart driver.

Signed-off-by: Wouter Cappelle <wouter.cappelle@crodeon.com>
2022-10-19 16:05:25 +02:00
Gerard Marull-Paretas 178bdc4afc include: add missing zephyr/irq.h include
Change automated searching for files using "IRQ_CONNECT()" API not
including <zephyr/irq.h>.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-17 22:57:39 +09:00
Lukas Gehreke 6fa4d722a6 drivers: serial: uart_pl011: implemented pinctrl
Added pinctrl to pl011 uart driver. This makes it usable
with the rp2040.

Signed-off-by: Lukas Gehreke <lk.gehreke@gmail.com>
2022-10-17 10:13:46 +02:00
Andriy Gelman 7f00371948 drivers: uart_xmc4xxx: Add fifo support
Adds fifo support for tx/rx.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-10-14 15:06:19 +02:00
Andriy Gelman 5313598f6a drivers: uart_xmc4xxx: Add interrupt driven support
Add interrupt driven support.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-10-14 15:06:19 +02:00
Andriy Gelman 9b7e5b3696 drivers: uart_xmc4xxx: Use consistent struct name
Use consistent struct names for data and config.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-10-14 15:06:19 +02:00
Dat Nguyen Duy 3e8f854506 drivers: serial: support NXP S32 LINFlexD UART
This patch introduces support for NXP S32 LINFlexD peripheral operating
in UART mode. Polling and interrupt-based serial API's are supported.

Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
2022-10-14 09:51:14 +02:00
Marek Pieta ea38e742b8 drivers: uart_native_posix: Fix reading file input
If the read function returns value of zero, there is no more data
in the file and the function should return value of -1.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2022-10-13 16:21:08 -04:00
Christopher Friedt 582f77ea38 drivers: serial: gecko: fix impmlicit declaration of IRQ_CONNECT
Previously, the build was failing due to implicit declaration
of `IRQ_CONNECT`. Simply include `<zephyr/irq.h>` to fix.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2022-10-11 21:25:59 -04:00
Gerard Marull-Paretas 357b362824 include: add missing sys/time_units.h include
Some files using time_units.h API did not include it, e.g. for
sys_clock_hw_cycles_per_sec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
Gerard Marull-Paretas 6a0f554ffa include: add missing kernel.h include
Some files make use of Kernel APIs without including kernel.h, fix this
problem.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
Gerard Marull-Paretas acc8cb4bc8 include: add missing irq.h include
Some modules use the IRQ API without including the necessary headers.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
Nick Kraus 05f3e87280 drivers: serial: Runtime Configure for SAM USART
Implements dynamic configuration for the atmet,sam-usart driver and
enables the new API calls if CONFIG_UART_USE_RUNTIME_CONFIGURE is set.

Signed-off-by: Nick Kraus <nick@nckraus.com>
2022-10-06 22:37:54 +00:00
Nick Kraus 48559f6e2f drivers: serial: Runtime Configure for SAM UART
Implements dynamic configuration for the atmet,sam-uart driver and
enables the new API calls if CONFIG_UART_USE_RUNTIME_CONFIGURE is set.

Signed-off-by: Nick Kraus <nick@nckraus.com>
2022-10-06 22:37:54 +00:00
Jay Vasanth f6e2cb9b84 drivers: uart: microchip: add support for mec15xx
update uart mchp xec driver to support mec15xx and add
pinctrl support for mec15xx uart

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-10-04 09:21:58 -05:00
Jan Peters a80fa5163b drivers: serial: uart_mcux_lpuart: fix IRQ-driven API with ASYNC_API
this allows usage of the interrupt-driven API when CONFIG_UART_ASYNC_API
is enabled.

Signed-off-by: Jan Peters <peters@kt-elektronik.de>
2022-09-27 10:04:10 +00:00
Francois Ramu 9926b90bf6 drivers: uart: stm32 uart driver must include ll_exti with CONFIG_PM
Missing include to compile correctly when the
CONFIG_PM && IS_UART_WAKEUP_FROMSTOP_INSTANCE are defined

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-09-16 10:49:18 +00:00
Francois Ramu 0e119b53c6 drivers: serial: stm32 uart driver set EXTI line for wakeup from lowPower
The USART or LPUART, especially on stm32wl, must set the EXTI
lines corresponding to the wakeUp source.
This LL_EXTI_LINE_xx is given by the Device Tree property.
This makes the system exiting lowpower stop mode on EXTI irq.
The LL_EXTI_LINE_x is exactly the bit(X) set.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-09-15 15:02:47 +00:00
Andriy Gelman 888a17cfda drivers: serial: uart_xmc4xxx: Use pinctrl driver
Use xmc4xxx pinctrl in uart driver.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-09-09 16:28:41 -04:00