Commit graph

1871 commits

Author SHA1 Message Date
Krzysztof Chruściński
266847665a drivers: serial: nrfx_uarte: Use nrfx_gppi helper
Use nrfx_gppi as abstraction over (D)PPI.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-09-26 11:10:10 +01:00
Krzysztof Chruściński
cae53af136 drivers: serial: nrfx_uarte2: Remove CONFIG_UART_n_GPIO_MANAGEMENT
Remove Kconfig option that no longer has any use after pinctrl
driver is introduced.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-09-26 03:31:39 -04:00
Krzysztof Chruściński
76db5b24e0 drivers: serial: nrfx_uarte: Remove CONFIG_UART_n_GPIO_MANAGEMENT
This is a leftover from pre-pinctrl era and no longer makes sense.
Driver always manages gpio through pinctrl.

Support removed from uart and uarte shims.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-09-26 03:31:39 -04:00
Bill Waters
eb19d32588 drivers: Remove CONFIG_PINCTRL in defconfig files
The CONFIG_PINCTRL setting is removed from the board
_defconfig files.  And "select PINCTRL" is added to
the appropriate driver files.

Signed-off-by: Bill Waters <bill.waters@infineon.com>
2024-09-23 18:08:14 -04:00
Krzysztof Chruściński
701beecb5c drivers: serial: nrfx_uarte: Split async control block structure
Split async control block structure into tx and rx structures.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-09-23 14:09:54 +01:00
Filip Kokosinski
0abc9fb8be boards: remove CONFIG_PINCTRL from defconfig files of FE310-based boards
This commit removes the y-selection of the `CONFIG_PINCTRL` Kconfig option
in FE310-based boards defconfig files.

It also makes drivers used in FE310 y-select `CONFIG_PINCTRL` if pinmuxing
is needed.

Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2024-09-20 13:14:41 +02:00
Pisit Sawangvonganan
a9800e2ea7 style: drivers: adjust return usage in void functions
For code clarity, this commit adjusts the use of `return` statements
in functions with a void return type as follows:
- Transform `return foo();` into separate statements:
  `foo();`
  `return;`
- Remove unnecessary `return` statements when
  they don't affect control flow.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-09-18 09:56:16 +02:00
Luis Ubieda
53f547b737 serial: bluetooth: Maximize notification payload size based on ATT MTU
By keeping track of run-time ATT MTU of all connected peers, it's
possible to increase the notification payload size; thus increasing
data-throughput sent over Bluetooth.

Note that this assumes the Bluetooth connection is properly configured
(with the corresponding connection parameters) to optimize performance.
This is application-specific and shall be examined on each scenario for
optimal performance.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2024-09-17 20:12:55 -04:00
Sven Ginka
7443a2c703 driver: serial: Add support for sy1xx
Add uart driver for Sensry's RISCV32 based SY1xx.

Signed-off-by: Sven Ginka <s.ginka@sensry.de>
2024-09-16 20:19:31 +02:00
Krzysztof Chruściński
ffdf9a978d drivers: serial: nrfx_uarte: Use ENDTX_STOPTX short if possible
Use short which is available on some devices.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-09-11 20:14:30 -04:00
Pisit Sawangvonganan
847a4eaad2 style: drivers: comply with MISRA C:2012 Rule 15.6
Add missing braces to comply with MISRA C:2012 Rule 15.6 and
also following Zephyr's style guideline.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-09-11 07:40:35 -04:00
Richard Wheatley
968f674c66 drivers: serial: ambiq uart update
The number of modules is different for each soc.
There is a macro in the HAL that should have been used.

Signed-off-by: Richard Wheatley <richard.wheatley@ambiq.com>
2024-09-09 18:40:46 -04:00
Sylvio Alves
8233b70ece espressif: clean up unused code
Remove all entries that as not being used.
This also update hal to re-enable warning flags
as such as -Wno-unused-variable.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2024-09-09 13:55:39 -04:00
Anas Nashif
5fdbbf7d7e uart: nrfx: fix config check
we should be checking for config, not data.

Fixes #78114

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-09-06 17:52:03 -04:00
Krzysztof Chruściński
345dd11e20 drivers: serial: uart_nrfx_uarte: Fix dropping flushed data
When rx_flush() was called with NULL buffer it was an indication to
drop data from the FIFO. However, it is still important to get the
correct amount of dropped data because when PPI+TIMER are used to
count bytes those flushed bytes are also counted (because each
byte generates RXDRDY event). If those bytes are not counted then
total amount of reported bytes is not correctly aligned with bytes
counted by TIMER.

Reworking rx_flush() to correctly count number of dropped bytes and
then add this flushed bytes to the total amount of RX bytes
reported to the user in RXTO event handler.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-09-06 11:31:10 -04:00
Krzysztof Chruściński
282bc783b1 drivers: serial: uart_nrfx_uarte: Fix interrupt driven TX only mode
When interrupt driven instance is using only TX then low power mode
is automatically enabled and then TXSTOPPED interrupt is disabled in
idle so uarte_nrfx_irq_tx_ready_complete() was returning wrong value.
Adding a dedicate flag which holds information is user enabled TX
interrupt.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-09-06 11:31:10 -04:00
Krzysztof Chruściński
e48053fdb5 drivers: serial: async_to_irq: Fix initialization
Callback was set in uart_async_to_irq_rx_enable() which is only called
when RX is enabled. Callback shall be called in the init function.
uart_async_to_irq_init() signature changed to take device as the
input argument instead of data and config for the adaptation layer
(which can be retrieved from the device). Device is needed when
setting a callback during the initialization.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-09-06 11:31:10 -04:00
Krzysztof Chruściński
5ce801fa2b drivers: serial: uart_async_to_irq: Add RX error handling
Adaptation layer was not correctly handling RX error and when error
occured uart_irq_is_pending() was still returning false.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-09-06 11:31:10 -04:00
Krzysztof Chruściński
3b232d5e07 drivers: serial: uart_nrfx_uarte2: Disable RX when error is reported
According to the API specification when RX error occurs receiver
shall be disabled. Adding missing disabling to the error handler.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-09-06 11:31:10 -04:00
Michal Smola
88f838b0d2 drivers: uart: Fix build error for lpuart without modem support
LPUART without modem support is used in some NXP socs. Build error
occurs for such socs because of accessing unavailable register.
Fix it by adding #if directive for checking modem support availability.

Signed-off-by: Michal Smola <michal.smola@nxp.com>
2024-09-05 17:01:33 -04:00
Andriy Gelman
3a4f868084 drivers: uart_xmc4xxx: Forward DMA overrun errors to user
Currently DMA overrun errors are ignored. Forward the error
to the user using the UART_RX_STOPPED with UART_ERROR_OVERRUN
reason.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2024-09-04 19:09:49 -04:00
Bjarki Arge Andreasen
28b9f55a0a drivers: serial: uart_nrfx_uarte: Patch RX init
The initialization of the UARTE is attempting to handle potential
improper handover from the bootloader. This handling is additional
complexity which should be fixed in the bootloader or whatever
component is failing to deinit the UART properly.

This commit removes the handling of improper handover from the
bootloader, while additionally clearing the ERROR flag when suspending
the UARTE component.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2024-09-04 06:55:43 -04:00
Erwan Gouriou
d13f9d9b9b drivers: stm32: Select PINCTRL when required
Select PINCTRL subsystem by drivers which require it.
Prevent the need from enabling this symbol at board or soc level.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2024-09-03 14:40:55 +01:00
Mathieu Choplain
b1b85fcf48 drivers: intc: stm32: remove STM32_EXTI_LINE_NONE macro
The EXTI driver API defined in exti_stm32.h is reserved for exclusive usage
by the STM32 GPIO driver, which doesn't use this macro. Since there is no
usecase for it anyways, it can be removed for future-proofing.

The STM32 UART driver is an unintended user of this definition, however.
Replace it with a private #define which is more appropriate anyways.

Signed-off-by: Mathieu Choplain <mathieu.choplain@st.com>
2024-08-27 10:50:39 -04:00
Richard Wheatley
1aebfcdb99 drivers: serial: UART PL011 Ambiq PM Fix
apollo3 driver added PM to UART for only apollo3
but defined PM function for both causing an error
in twister

Signed-off-by: Richard Wheatley <richard.wheatley@ambiq.com>
2024-08-27 10:49:38 -04:00
David T. Pocock
b2475804f8 serial: bluetooth: Print warning once when ring buffer is full
This avoids cluttering the logging subsystem.

Signed-off-by: David T. Pocock <davidtpocock@gmail.com>
2024-08-26 17:24:47 -04:00
Michael Zimmermann
aa3f46cbbf drivers: serial: Add initial SiM3U1xx support
This supports polling and interrupt APIs, but not the async API.

Signed-off-by: Michael Zimmermann <michael.zimmermann@grandcentrix.net>
2024-08-26 18:51:36 +02:00
Raffael Rostagno
90c6106926 drivers: esp32: Interrupts flags configuration
Allows configuring interrupts flags in the device tree for
ESP32 devices.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2024-08-22 14:25:25 -04:00
Raffael Rostagno
bb746cdcc5 drivers: esp32: esp_intr_alloc return condition
Add checks to return value of esp_intr_alloc to avoid drivers init
returning 0 when interrupt allocation fails.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2024-08-22 14:25:25 -04:00
Raffael Rostagno
0b3a34cdca drivers: esp32: Interrupts priority configuration
Allows configuring interrupts priority in the device tree for
ESP32 devices.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2024-08-22 14:25:25 -04:00
Emanuele Di Santo
c0410e1a22 drivers: serial: nrf: disable legacy shim for nRF92
Disable the legacy shim due to DPPI support currently missing.

Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
2024-08-22 14:24:38 -04:00
Pisit Sawangvonganan
1bcae0ea9f style: drivers: comply with MISRA C:2012 Rule 15.6
Add missing braces to comply with MISRA C:2012 Rule 15.6 and
also following Zephyr's style guideline.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-08-20 10:33:51 +02:00
Zhengwei Wang
03a1fe6cd7 drivers: serial: pm: Add power management support for Apollo3 SoCs UART
Add power management support for Apollo3/Apollo3P UART, and
automatically enables device runtime power management

Signed-off-by: Zhengwei Wang <zwang@ambiq.com>
2024-08-20 10:32:52 +02:00
Ha Duong Quang
dcc4b9c5ec drivers: uart_nxp_s32_linflexed: update to RTD 2.0.0
Update user_data pointer to 'const void (*)' type

Signed-off-by: Ha Duong Quang <ha.duongquang@nxp.com>
2024-08-20 10:32:32 +02:00
Duy Phuong Hoang. Nguyen
7060672c37 drivers: serial: Initial support for SCI UART
First commit to support serial driver running on r_sci_uart for Renesas
RA devices.

Signed-off-by: The Nguyen <the.nguyen.yf@renesas.com>
Signed-off-by: Duy Phuong Hoang. Nguyen <duy.nguyen.xa@renesas.com>
2024-08-19 09:59:27 -04:00
Raffael Rostagno
0d274a1d7e drivers: uart: esp32c2: Add support
Add UART support to ESP32C2 and ESP8684

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2024-08-16 14:08:22 -04:00
Duy Nguyen
a95cade729 driver: serial: Convert Kconfig of renesas RA8 to rsource
Change Kconfig of renesas RA8 to rsource

Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
2024-08-14 10:46:27 +01:00
Reto Schneider
9aa2f5ffb0 drivers: serial: Add name to choice symbol
Add name to choice symbol, so that default value can be changed
downstream.

Developed-by: Andreas Rudolf <andreas.rudolf@husqvarnagroup.com>

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2024-08-14 09:40:34 +02:00
Pisit Sawangvonganan
c20126f950 drivers: serial: ns16550: apply __maybe_unused to ns16550_out,inword
Instead of disabling code with a specific compilation switch, enable it
and apply `__maybe_unused` in the `ns16550_outword` and `ns16550_inword`
functions to make the codebase cleaner.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-08-14 09:40:00 +02:00
Pisit Sawangvonganan
e868b6b49d drivers: serial: ns16550: fix typo
Correct the following typo in Kconfig and
the corresponding function.
- Kconfig.it8xxx2 from `BUADRATE` to `BAUDRATE`
- Correspoding function from `burdrate` to `baudrate`

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-08-14 09:40:00 +02:00
Benjamin Gwin
47a0813561 drivers: serial: pl011: Fix ignored const qualifiers
When trying to build Zephyr with -Wignored-qualifiers this leads to a
compiler warning like:

zephyr/drivers/serial/uart_pl011_registers.h:40:1: error: type
qualifiers ignored on function return type [-Werror=ignored-qualifiers]

Since the return value is copied by the caller, making it const has no
effect and the compiler warns that this is being ignored. This enables
applications to build with additional compiler warnings turned on.

Signed-off-by: Benjamin Gwin <bgwin@google.com>
2024-08-12 19:25:34 -04:00
Krzysztof Chruściński
04a930fe74 drivers: serial: nrfx_uarte: Optimize code size
Code size can significantly reduced (220 bytes per instance) if data
structure (stored in RAM) is not initilized (can be moved to .bss).
Data for asynchronous API had two fields which can easily be moved
to the configuration structure (which is in ROM) because they do not
change duing runtime.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-08-12 12:44:02 +02:00
Krzysztof Chruściński
78ba6082d9 drivers: serial: nrfx_uarte: Optimize static peripheral configuration
When runtime configuration is not enable then we can determine at
compile time what are the hardware settings. Function which
translates zephyr values to nRF register values is not needed as
macros can do that at compile time.

This optimization saves almost 400 bytes of code.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-08-12 12:44:02 +02:00
Gerard Marull-Paretas
65b45e5760 drivers: serial: nrfx_uarte: add support for arbitrary peripheral clock
Some UARTE instances may be clocked at higher speeds than 16MHz, so the
baudrate setting needs to be scaled accordingly. This patch parses the
`clocks` property and obtains the clock-frequency property of the
associated clock, assuming it is a fixed-clock. We should ideally have a
proper clock control subsystem where frequency can be queried using an
API, but we're far from there.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-08-06 14:32:40 +02:00
Fin Maaß
7869e05649 dts: bindings: litex: rename uart compatible
Zero got removed from the litex
uart compatible, as it now supports
multiple instances.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-08-02 03:32:21 -04:00
Fin Maaß
9b6d783ceb drivers: serial: litex: support multiple instances
support multiple instances of the litex uart driver.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-08-02 03:32:21 -04:00
Fin Maaß
072abdcaec drivers: serial: litex: rename uart driver
As there is no LiteUART it is more fitting
to rename the uart driver. This way it is also
more coherent with the other drivers and will
match the conditions in the MAINTAINERS.yml.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-08-02 03:32:21 -04:00
Anke Xiao
c7562f7122 drivers: serial: uart_mcux.c: add a feature macro wrap specific code
The enableRxRTS and enableTxCTS can only be configured when the
'UART_HAS_MODEM_SUPPORT' feature is enabled.
Uart has no 'error' IRQ on frdm_ke17z512, so update irq configuration
to configure the error interrupt when it exists.

Signed-off-by: Anke Xiao <anke.xiao@nxp.com>
2024-08-02 03:31:38 -04:00
Fabio Baltieri
e466efaf74 libc, console: declare __stdout_hook_install in libc-hooks.h
Declare __stdout_hook_install in libc-hooks.h and use it in the console
drivers rather than redeclare it every time.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-08-01 16:49:08 +01:00
Nikodem Kastelik
43128052e7 drivers: serial: nrf: add default value for frame timeout cfg
This is needed to avoid warnings about uninitialized
structure member, which was added in nrfx 3.6.

Signed-off-by: Nikodem Kastelik <nikodem.kastelik@nordicsemi.no>
2024-08-01 16:45:04 +01:00