Commit graph

1335 commits

Author SHA1 Message Date
Marek Matej 6b57b3b786 soc: xtensa,riscv: esp32xx: refactor folder structure
Refactor the ESP32 target SOCs together with
all related boards. Most braking changes includes:

- changing the CONFIG_SOC_ESP32* to refer to
  the actual soc line (esp32,esp32s2,esp32s3,esp32c3)
- replacing CONFIG_SOC with the CONFIG_SOC_SERIES
- creating CONFIG_SOC_FAMILY_ESP32 to embrace all
  the ESP32 across all used architectures
- introducing CONFIG_SOC_PART_NUMBER_* to
  provide a SOC model config
- introducing the 'common' folder to hide all
  commonly used configs and files.
- updating west.yml to reflect previous changes in hal

Signed-off-by: Marek Matej <marek.matej@espressif.com>
2023-07-25 18:12:33 +02:00
Andrzej Głąbek aa7d675935 drivers: serial: nrfx: Clean up driver instantiation
- use CONFIG_HAS_HW_NRF_* symbols consistently in nRF multi-instance
  drivers when creating particular driver instances
- remove unnecessary hidden Kconfig options that indicated the type of
  peripheral to be used by a given instance (e.g. SPI, SPIM, or SPIS)
  and enabled proper nrfx driver instance; instead, use one option per
  peripheral type and include the corresponding shim driver flavor into
  compilation basing on that option (not the one that enables the nrfx
  driver as it was incorrectly done so far in some cases)

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-07-25 13:41:51 +02:00
Fabio Baltieri ab9028518e drivers: uart_nrfx_uart{,e}: on clear async pointers when enabled
Fix a build error introduced in 9f02eeadf8, the async pointers are only
available when UARTE_ANY_ASYNC is set.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-24 17:31:08 +00:00
Daniel Leung 20021abf0a serial: ns16550: check return of clock_control_get_rate()
This adds a check of the return of clock_control_get_rate(),
and returns error in uart_configure() if unsuccessful in
getting clock rate.

Fixes #60478

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-07-24 09:07:11 +00:00
Daniel Leung 343772213a serial: CONFIG_UART_USE_RUNTIME_CONFIGURE on API for cfg funcs
This adds the CONFIG_UART_USE_RUNTIME_CONFIGURE guard to
disable the API function pointers if the kconfig is not enabled.
Both .configure and .config_get should only be usable if runtime
(re-)configuration of UART is needed.

Ifdef guards are added to drivers previously lacking this guard.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-07-21 17:46:12 -04:00
Sean Nyekjaer d0651a8d96 drivers: serial: stm32: void return value from reset_line_toggle_dt
Suggested-by: Francois Ramu <francois.ramu@st.com>
Signed-off-by: Sean Nyekjaer <sean@geanix.com>
2023-07-20 10:57:12 +00:00
Daniel Leung 9f02eeadf8 serial: allow callback setting to be exclusive
Both the IRQ API and Asynchronous API support callback.
However, since they are both interrupt driven, having
callbacks on both API would interfere with each other
in almost all cases. So this adds a kconfig to signal
that the callbacks should be exclusive to each other.
In other words, if one is set, the other should not
be active. Drivers implementing both APIs have been
updated to remove the callbacks from the other API.
Though, this still leaves the option to disable
the kconfig and allows both APIs to have callbacks
if one desires.

Fixes #48606

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-07-18 11:13:02 +00:00
L Lakshmanan 24759511f4 drivers: uart: Add support for UART_NS16550 TI K3 variant
TI K3 family of SoCs requires an extended set of registers to operate.
Extended functionality of the current driver to support the variant.

Signed-off-by: L Lakshmanan <l-lakshmanan@ti.com>
2023-07-14 09:37:44 +02:00
Tim-Marek Thomas 5d75940ae3 boards: riscv: neorv32: Updates compatibility to neoverse v1.8.6
With NEORV32 v1.8.2 the UART module was changed to a simpler
implementation. This updates the UART driver for the open-source NEORV32
RISC-V compatible processor system (SOC).

Signed-off-by: Tim-Marek Thomas <thomas@sra.uni-hannover.de>
2023-07-11 18:19:55 +00:00
Mykola Kvach cb9d1607b3 drivers: uart_rcar: do MMIO mapping inside driver
Add MMIO mapping for UART Renesas driver in order to avoid
mappings inside mmu_regions.c file(s).

There are a lot of changes inside SCIF driver inside this
commit, because reg addr and size may be stored in RAM or
ROM and appropriately in different driver structures data
or cfg, and, because the name of field reg base is changed.

Note: it is common approach according to Zephyr documentation.

Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
2023-07-11 11:17:41 +02:00
Alberto Escolar Piedras 1842c602ec drivers serial native ptty: Split in top and bottom
Split the native ptty serial driver in a top and bottom
to enable using it with embedded libCs.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-07-10 09:53:22 +02:00
Najumon B.A b4ed6c4300 drivers: serial: driver init level based on parent node
Boot level based on parent node (PCI or no PCI device). Some platforms the
PCI bus driver depends on ACPI sub system to retrieve platform information
such as interrupt routing information. But ACPI sub system currently
support only post kernel and hence such platforms the UART driver instance
init should be invoked only post kernel in case parent node is PCI.

Signed-off-by: Najumon B.A <najumon.ba@intel.com>
2023-07-08 09:00:03 +03:00
Armin Brauns b95cdb2a33 drivers: serial: stm32: add support for RS485 configuration
The stm32 UART can output a "driver enable" signal on the RTS pin that
allows controlling e.g. external RS-485 drivers.

This can already be configured through the devicetree using the `de-*`
properties, but not through uart_configure(). This commit enables the use
of .flow_ctrl=UART_CFG_FLOW_CTRL_RS485.

This is supported on all devices other than l1, f1, f2, and f4 as found by
this search:

$ grep -rLw USART_CR3_DEM ../modules/hal/stm32/stm32cube/*/soc/*.h |\
    grep -vE 'system_|partition_|stm32[^0-9]+[0-9]?xx\.h' |\
    cut -d/ -f6 |\
    sort -u

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-07-07 13:16:27 +02:00
Alp Sayin 3a4419eff0 drivers: uart_mcux_flexcomm: Merge conditions for enabling ISR
Merges the condition for `UART_INTERRUPT_DRIVEN || UART_ASYNC_API` into
`UART_MCUX_FLEXCOMM_ISR_SUPPORT`.

Signed-off-by: Alp Sayin <alpsayin@gmail.com>
2023-07-06 11:48:49 +02:00
Alp Sayin 657cbe3a8f drivers: uart_mcux_flexcomm: fix mcux_flexcomm_isr unused for polled uart
When UART_INTERRUPT_DRIVEN=n, mcux_flexcomm_isr and the data structure
inside is left unused. This patch turns off the build of the entire ISR.

Signed-off-by: Alp Sayin <alpsayin@gmail.com>
2023-07-06 11:48:49 +02:00
Jan Peters ecc665247b drivers: uart_mcux_lpuart: move critical function call out of assert()
without the call of LPUART_ClearStatusFlags(), the interrupt can
immediately trigger again, blocking the application.
CONFIG_ASSERTS=n removes the assert() including the call of
LPUART_ClearStatusFlags().
Also removed LPUART_ClearStatusFlags call for unclearable
kLPUART_TransmissionCompleteFlag.

Signed-off-by: Jan Peters <peters@kt-elektronik.de>
2023-07-06 11:48:22 +02:00
Lucas Tamborrino ae6b398f51 dts: xtensa: espressif: esp32s3: add USB CDC support
Enable USB CDC with self stack support for esp32s3.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-07-06 09:46:37 +00:00
Alberto Escolar Piedras abf6da6318 drivers for POSIX arch: Add external libc dependencies
Quite a few of the drivers meant for the POSIX arch
interacted with the host directly, and will not
work when we use an embedded libC.

Until we fix them, let's add the appropriate
kconfig dependencies to avoid users trying to build them.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-07-05 07:01:19 -04:00
Ibe Van de Veire 007dc6d98f drivers: uart: atmel_sam: Added reset after error check
Following the sam4s datasheet, the OVRE, PARE and FRAME flags should be
cleared after a uart error occured. This is done writing a 1 to the
RSTSTA bit in the UART_CR.

Signed-off-by: Ibe Van de Veire <ibe.vandeveire@basalte.be>
2023-06-29 21:07:32 +02:00
Manojkumar Subramaniam d78c0e538c drivers: serial: add uart_efinix_sapphire initial version
Add UART driver for Efinix Sapphire SoCs

Signed-off-by: Manojkumar Subramaniam <manoj@electrolance.com>
2023-06-27 12:09:57 +00:00
sukrit buddeewong c5bb959b25 driver: uart: Fix Modbus data currupted by DE-RE signal
Add UART_UARTFR_BUSY_BITS To fix modbus data was currupted

Signed-off-by: sukrit buddeewong <sukrit.omu@gmail.com>
2023-06-21 09:34:08 +00:00
cyliang tw 6176687c88 drivers: serial: support for Nuvoton numaker series UART
Add Nuvoton numaker series UART support, including interrupt-driven,
also apply pinctrl and clock-control.

Signed-off-by: cyliang tw <cyliang@nuvoton.com>
2023-06-21 09:26:00 +00:00
Marko Sagadin 54cbf45c74 drivers: uart: add support for serial ports on native posix
Add support for communication with serial ports on native POSIX platform
via UART driver API. Serial port driver supports polling API,
configuration of the serial ports used via devicetree and command line
options, and runtime configuration with `uart_configure`.
Multiple instances of the driver are supported.
Example use and configuration is also demonstrated in the
`samples/drivers/uart/native_tty` sample.

Closes: #56586

Signed-off-by: Marko Sagadin <marko.sagadin42@gmail.com>
2023-06-21 09:27:22 +02:00
Lucas Tamborrino 97be30cccb drivers: uart: esp32s3: add async support
Add uart async api support for esp32s3.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-06-17 08:00:31 -04:00
Daniel Leung 26ecaba4af drivers: syscalls: use zephyr_syscall_header
This adds a few line use zephyr_syscall_header() to include
headers containing syscall function prototypes.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-06-17 07:57:45 -04:00
Gerard Marull-Paretas ecc241e0ce drivers: serial: cc32xx: add support for pinctrl
Driver will configure pins using the pinctrl API now.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-06-17 07:55:43 -04:00
Peter McGaughey 3104ad0e39 drivers: serial: uart_sam0: fix uart_sam0_irq_update TXC reset
drivers: serial: uart_sam0: fix uart_sam0_irq_update TXC reset bug

uart_sam0_irq_update function resets flags that will cause int. re-entry
existing implementation also clears the TXC flag if it is set
this breaks transmit complete detection

Per the SAMD5x/E5x Datasheet Sect. 34.8.6, writing '1' to the TXC will
clear the flag and disable TX complete interrupts, this should be
preserved through the irq_update for use in the tx_complete check function

The proper fix will cache the TXC value before conditionally clearing the
flag based on that cached value. If you do not condition this on the
cached value a race condition will periodically occur where
the TXC is cleared but never cached.

Fixes zephyrproject-rtos#55386

Signed-off-by: Peter McGaughey <peter.mcgaughey@daikincomfort.com>
2023-06-13 15:09:28 -04:00
Daniel Leung d88840a8aa Revert "drivers: serial: ns16550: Add support for Async APIs"
This reverts commit 2d03aaf99f.

The async API for NS16550 is incomplete. We are near the next
release so it is better to revert it for now, and a proper
correct implementation can be done before next-next release.

Relates to #57103

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-06-13 06:59:33 -04:00
Declan Snyder bdaa870e59 drivers: uart_mcux_flexcomm: Unlock IRQ if error
Currently the flexcomm uart driver will not unlock IRQ
if there is an error, which might cause some problems, fix this.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-06-12 14:03:43 -04:00
Andrzej Głąbek 5a57fa2c79 drivers: uart_nrfx_uart: Request next buffer only when needed
Recent refactoring of the uart_async_api test (see commit
eb44414af9) revealed an issue
in the uart_nrfx_uart driver that it requested the next RX
buffer even if one was already set up (such request was just
ignored in the previous form of the test, so the problem did
not come out so far).
This patch prevents such incorrect requests from appearing.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-06-06 09:34:29 +02:00
Alberto Escolar Piedras 294ccc1cb8 drivers: uart_native_posix: Check return values of system calls
Let's check the return values of all system calls
to ensure they do not error, or handle it gracefully
if they do.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-06-01 18:04:25 -04:00
Francois Ramu d69f7636e3 drivers: serial: stm32 uart driver asserts when baudRate >=16
Change the assertion when evaluating the baudrate to trig if
result is greater or equal to 16.
This will also match the comment : checking BRR.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-05-30 13:16:05 -04:00
Xudong Zheng 147d4067e6 drivers: serial: rpi_pico: add support for hardware flow control
Flow control will be enabled for UART if hw-flow-control is set.

Signed-off-by: Xudong Zheng <7pkvm5aw@slicealias.com>
2023-05-30 09:00:09 -04:00
Abram Early a59c948256 drivers: serial: stm32 uart implements driver enable
Enables the use of the hardware DE pin provided by an stm32 UART using
device tree flags.

Signed-off-by: Abram Early <abram.early@gmail.com>
2023-05-26 14:55:30 -04:00
Declan Snyder cf34d2cbdc drivers: uart_mcux_flexcomm: Add ASYNC API
Support ASYNC API on Flexcomm UART

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-05-26 13:15:24 -05:00
Declan Snyder e9a8389639 drivers: uart_mcux_flexcomm: Clean up
Clean up slashes in init macro to be less messy

Update copyright to reflect recent code changes by NXP

Update outdated driver description comment

Change irq driven api variables naming to be more specific

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-05-26 13:15:24 -05:00
Declan Snyder 4f290e6173 drivers: uart_mcux_flexcomm: Simplify init macros
The flexcomm uart mcux driver init macros have a lot
of unnecessary and confusing redundancy, so let's
simplify them.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-05-26 13:15:24 -05:00
Fabio Baltieri 2ebad47eaa drivers: serial: ite_it8xxx2: add a dedicated priority symbol
The uart_ite_it8xxx2 is relying on a node that depends on a matching
ns16550 symbol, such as:

ite_uart1_wrapper: uartwrapper@f02720 {
        compatible = "ite,it8xxx2-uart";
	...
        uart-dev = <&uart1>;
};

But the two are currently setup to initialize at the same level and
priority. Add a dedicated priority symbol so that the wrapper device is
always initialized after the main one, regardless of the linker order.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-05-26 13:51:08 -04:00
Alberto Escolar Piedras 0ae060d174 drivers: Console: Move all posix arch boards to same driver
All posix arch boards are required to provide the same
tracing/print API.
So, instead of having a different driver for native_posix and the
bsim boards, let's have a common one which uses this API.
This in turn results in the printk strings being printed in
the same underlaying backend as before with individual drivers.

A part from this, the native_posix console driver was a full
backend for the now long gone Zephyr console shell
(named legacy_shell from 527256501f
until it was retired in fd0b7f7767).
The whole input handling in this driver was dead code
(since 140a8d0c8a)

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-05-26 12:57:41 +02:00
Carlo Caione 6f3a13d974 barriers: Move __ISB() to the new API
Remove the arch-specific ARM-centric __ISB() macro and use the new
barrier API instead.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-05-24 13:13:57 -04:00
Carlo Caione 2fa807bcd1 barriers: Move __DMB() to the new API
Remove the arch-specific ARM-centric __DMB() macro and use the new
barrier API instead.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-05-24 13:13:57 -04:00
Huifeng Zhang 26d8714eed driver: uart: pl011: fix interrupt driven API
API function:
    - `pl011_irq_tx_enable` is expected to enable and trigger TX interrupt.
    Due to HW limiation, PL011 won't trigger TX interrupt if some data
    wasn't filled to TX FIFO at the beginning. So that `isr_cb` must be
    called at first time to enable TX irq.

    - `pl011_irq_tx_ready` will return true when FIFO can accept more
    data. Here we don't need wait TX FIFO to be empty.

    - `pl011_irq_tx_complete` will return true when all data have been
    sent from the shift register.

Signed-off-by: Huifeng Zhang <Huifeng.Zhang@arm.com>
2023-05-17 09:49:03 +02:00
Huifeng Zhang 0da7e06992 driver: uart: pl011_sbsa: refine creating device instance
Create pl011_sbsa device instance via the DT_INST_FOREACH_STATUS_OKAY
macro.

Signed-off-by: Huifeng Zhang <Huifeng.Zhang@arm.com>
2023-05-17 09:49:03 +02:00
Mulin Chao 9da9c90639 intc: miwu: npcx: improve interrupt latency of miwu input events
To reduce the interrupt latency of MIWU events, the driver prepares a
dedicated callback function item list for each MIWU group in this PR. We
needn't check the MIWU table and group of the event in ISR. And the
maximum item number of each list is also limited to 8. After applying
this PR, the interrupt latency reduces to ~10us consistently.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2023-05-17 09:48:54 +02:00
Mahesh Mahadevan f2fd5c3779 drivers: uart_mcux: Do not enable and disable the transmitter
Do not enable and disable the UART transmitter

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-05-16 12:08:32 +02:00
Sylvio Alves 01da4df197 drivers: uart: esp32: fix baudrate return value
Baudrate value was not updated properly when requested.

Fixes #57746

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-05-12 09:59:25 +02:00
Mateusz Holenko 534952adff drivers: serial: uart_miv: Disable SERIAL_SUPPORT_INTERRUPT
In the real MiV platform, UART does not have any interrupts routed to
the interrupt controller.

Up to this stage, the driver implemented a separate thread to simulate
interrupt operation to enable shell samples. This is not required anymore,
as Zephyr can run shell on interrupt-less UARTs.

Signed-off-by: Mateusz Holenko <mholenko@antmicro.com>
2023-05-08 16:59:21 -04:00
Cyril Fougeray 1be72d9888 dma: callback with 2 status codes for successful transfers
Make use of positive status values in the DMA callback to pass
info to the DMA client after a successful DMA operation.
A completed DMA transfer uses the status 0 while a reached
water mark uses the status 1.

Signed-off-by: Cyril Fougeray <cyril.fougeray@worldcoin.org>
2023-05-08 09:57:32 +02:00
Adam Wojasinski efa3ddd516 drivers: serial: uart_nrfx_uarte: Align use of TIMER macro in ASYNC API
nrfx 3.0 introduces parameter `_frequency` in
`NRFX_TIMER_DEFAULT_CONFIG()` macro. This patch aligns use of it.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-05-05 11:47:53 +02:00
Filip Kokosinski a30862455e treewide: rename Microsemi to Microchip
Do a treewide Microsemi to Microchip rename and update obsolete links in
the board docs.

Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2023-05-04 10:47:07 +02:00