PM suspend operation cannot be performed for UART using asynchronous
API is there are any active operations. Instead of asserting return
error.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
The async mode ISR silently cleared RX error flags (overrun, parity,
framing, noise) without notifying the application. This violates the
Zephyr async UART API which requires a UART_RX_STOPPED event followed
by UART_RX_BUF_RELEASED and UART_RX_DISABLED.
Enable RX error interrupts alongside the idle-line interrupt, and
handle them in the ISR by reporting UART_RX_STOPPED with the
appropriate reason bitmask, then calling rx_disable() for the full
API-mandated teardown sequence.
Also set rx_dma_params.buf to NULL in rx_disable() after releasing
buffers, so stale pointers are not left behind.
Signed-off-by: Ofir Shemesh <ofirshemesh777@gmail.com>
Clear rx_dma_params.buf to NULL in mcux_lpuart_rx_disable() after
releasing all buffers. Without this, the stale pointer remains set
after RX teardown, which can cause subsequent checks against buf
to incorrectly assume RX is still active.
Signed-off-by: Ofir Shemesh <ofirshemesh777@gmail.com>
Extend UART and USB serial drivers to support ESP32-C5. Add UHCI0
compatibility macro since the ESP32-C5 HAL exports the UHCI
peripheral as UHCI instead of UHCI0.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
Pass the function argument `dev` to the async callback instead of
`data->uart_dev`. The pointers are identical, but `dev` is already
available in this context, so it's clearer to use it directly.
Signed-off-by: Miguel Gazquez <miguel.gazquez@bootlin.com>
Add abstraction function to check the TX/RX fifo flags and enable/disable,
and redefine a few macros (like stop bits or data width) for STM32 HAL2.
Signed-off-by: Francois Ramu <francois.ramu@st.com>
Apply PINCTRL_STATE_SLEEP on suspend and PINCTRL_STATE_DEFAULT on resume
so that pin configuration is updated for low power modes.
Previously the suspend and resume actions were empty, leaving pins in
their active configuration during sleep. On SoCs like RW6xx where pad
control registers survive low power modes, this allos boards to define
sleep pinctrl states with appropriate pull or drive setting s to minimize
leakage.
Signed-off-by: Jacob Wienecke <jacob.wienecke@nxp.com>
A lot of BeagleBoard.org boards contain SOCs with co-processors such as
M4F in AM62x (PocketBeagle 2 [0]), R5s in AM67A (BeagleY-AI [1]). In such
targets, the application is normally loaded by the Linux host using
remoteproc.
There have been some out of tree patches to have micropython and other
Zephyr applications output to allow having a console without requiring
manual connections. This patch attempts to provide a more concrete and
upstream way to have that functionality.
The implementation uses existing rpmsg service subsystem.
Only implemented poll_out
Tested on PocketBeagle 2 M4F core.
[0]: https://docs.zephyrproject.org/latest/boards/beagle/pocketbeagle_2/doc/index.html
[1]: https://docs.zephyrproject.org/latest/boards/beagle/beagley_ai/doc/index.html
Signed-off-by: Ayush Singh <ayush@beagleboard.org>
Enabling and disabling interrupts may happen concurrently from thread
and interrupt context. Add locks to synchronize the access to the ctrl
register.
This was observed to improve the stability of the zephyr,bt-hci-uart
driver when used with the cmsdk_apb uart driver.
Signed-off-by: Marco Widmer <marco.widmer@bytesatwork.ch>
Similar to the TX interrupt, the RX interrupt is also an edge interrupt
that only fires when a new bytes is received. When enabling the RX
interrupt, data may be already present in the RX FIFO. Call the
interrupt handler manually to start processing.
Also check if calling the interrupt handler is really required.
Signed-off-by: Marco Widmer <marco.widmer@bytesatwork.ch>
irq_is_pending should not return 1 when interrupts are disabled through
irq_XX_disable. Check the interrupt enable bit before returning.
Signed-off-by: Marco Widmer <marco.widmer@bytesatwork.ch>
Adapt all Espressif SoC and driver code to the updated
hal_espressif module synced with IDF master branch.
Main changes:
- clock control: delegate peripheral clock gating to HAL
layer using new clock/reset APIs
- SPI/GDMA: adapt to restructured DMA HAL with new channel
allocation and configuration interfaces
- ethernet: add RMII clock configuration and PHY management
- GPIO: simplify using direct HAL function calls
- flash: adapt to updated SPI flash HAL interfaces
- linker scripts: update IRAM/DRAM mappings for new HAL
object files
- DTS: fix ESP32-S2 PSRAM dcache1 address to match actual
MMU mapping region (0x3f800000 DRAM1 instead of 0x3f500000
DPORT which lacks 8-bit access capability)
- west.yml: update hal_espressif revision
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
Update the Infineon PDL UART driver to support Zephyr's standard
UART hardware flow control configuration.
Flow control is now derived from uart_config.flow_control allowing
applications to enable RTS/CTS using the generic UART API and
devicetree settings
configure the RTS rx fifo trigger level when flow control is enabled
Signed-off-by: Merin George <merin.george@infineon.com>
STANDBY state can place the peripheral into a
low‑power state, and transitioning to it before
a TX transmission completes may cause data loss
Signed-off-by: Yassine El Aissaoui <yassine.elaissaoui@nxp.com>
When UART_INTERRUPT_DRIVE, PM and UART_CONSOLE_INPUT_EXPIRED are all
defined the driver uses the device flags without the necessary declaratoins
or fetching the hardware register.
Signed-off-by: Keith Packard <keithp@keithp.com>
Add serial driver support for Renesas RZ/G3E
Signed-off-by: Hoang Nguyen <hoang.nguyen.jx@bp.renesas.com>
Signed-off-by: Nhut Nguyen <nhut.nguyen.kc@renesas.com>
Initial SAU UART driver support for Renesas RA0 series
Signed-off-by: Khoa Tran <khoa.tran.yj@bp.renesas.com>
Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
Some MAX32 targets may fail to raise TX half/almost empty interrupts,
so add an optional workaround for those scenarios to ensure no missed
TX completion when using the interrupt API.
Signed-off-by: Pete Johanson <pete.johanson@analog.com>
In cc13xx_cc26xx, the TX interrupt seems to be generated once initially on
enable and subsequently, when buffer goes from full to empty (since we are
operating in 1-byte buffer mode).
Due to this, if the TX interrupt is cleared in the configure function, a
new TX interrupt will not be generated untill we transition from a full to
empty buffer, even though the buffer itself is empty.
When using Zephyr Interrupt-driven UART API, one first needs to enable TX
interrupts `uart_irq_tx_enable()`, and then write data from the interrupt
callback, after checking `uart_irq_tx_ready()`. In case of cc13xx_cc26xx,
calling `uart_irq_tx_enable()` unmasks the TX interrupt, however, it will
not generate a new TX interrupt. Thus the callback will not be called
unless we first write something to the uart (using polling-API), causing a
transition in buffer state.
According to TI docs, writing 1 byte to the buffer will also clear the
TX interrupt, so it does not make sense to try clearing the interrupt
manulally in `configure` function.
Signed-off-by: Ayush Singh <ayush@beagleboard.org>
Refactor MAX32 UART driver to use pm_device_driver_init so that the
device is moved to the appropriate power state expected by the system
during initialization.
Signed-off-by: Tahsin Mutlugun <Tahsin.Mutlugun@analog.com>
Add PM policy constraints so that UART driver can prevent the system
going to sleep before all characters are sent or received.
Signed-off-by: Tahsin Mutlugun <Tahsin.Mutlugun@analog.com>
Several NXP drivers require clock control subsystem name definition in
Devicetree. It prevents usage of clock control without subsystem such
as fixed-clock. fixed-clock can be used for early SoC enablement when
complete clock controller is not available or not required.
Allow optional usage of clock control without subsystem by using 0 as
subsystem name if the name is not defined in devicetree. Add the option
for port, i2c, spi and serial drivers.
Signed-off-by: Michal Smola <michal.smola@nxp.com>
Changes added to make g1 driver to be used across multiple
SoC's and also avoids use of multiple SOC symbols in the
source file for selecting between the similar but differently
named macros and reg definitions across multiple DFP's.
Signed-off-by: Fabin V Martin <Fabinv.Martin@microchip.com>
If the clock device (i.e., RCC) failed to initialize, we have bigger
problems than trying to call clock_control_{off,on,configure} on it.
Don't bother checking to save some footprint.
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
Clear the TX and RX FIFOs to ensure a clean state.
Without this reset, residual data or incomplete
characters from a previous session or the bootloader could remain
in the hardware buffers.
Signed-off-by: Elmo Lan <elmo_lan@realtek.com>
Preprocess endif should be before return so that uarte_periph_enable
returns always when asynchronous API is used. It leads to faulty
behavior in certain configurations.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Some of the peripherals might be used in the bootloader
and not cleaned up properly for the next image in the boot chain.
Ensure that affected registers are always cleaned up before use.
Signed-off-by: Nikodem Kastelik <nikodem.kastelik@nordicsemi.no>
Fix warnings reported by clang about the use of a C23 extension about
usage of a label at the end of a compound statement.
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
Moving the declaration of half_pos out of the switch case to avoid
C23 extensions that cause build failures in some environments.
BUG=None
TEST=None
Signed-off-by: Rob Barnes <robbarnes@google.com>
In some cases UARTE peripheral is generating RXTO events together with
ENDRX events. Those events are unexpected and should not be handled.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
It is possible that some uart devices ns16550 do not support interrupts.
As an example, using main domain uarts from mcu domain m4f core in AM62
processors does not support uarts.
Signed-off-by: Ayush Singh <ayush@beagleboard.org>
Add pinctrl support to the bcm2711 aux UART driver to allow
uart pin configuration via the pinctrl driver.
Signed-off-by: Muhammad Waleed Badar <walid.badar@gmail.com>
Recent changes (6e65fbe585) deprecated Kconfig configuration for
TIMER that is used for bytes counting. In one place code was not
cleared correctly which results in compilation failure when
deprecated symbol is used.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
As per Zephyr coding guideline #59, "operands shall not be of an
inappropriate essential type". This makes sure boolean variables are
assigned true/false values, not 1/0.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
This change makes the driver rely on DT_INST_FOREACH_STATUS_OKAY(...)
rather than copy-paste the same code several time.
This also has the advantage of allowing more that 5 instances of this
uart driver.
Signed-off-by: Wilfried Chauveau <wilfried.chauveau@arm.com>
Fix the logic in `uart_xec_irq_tx_complete` when evaluating the UART line
status register against the TX-empty mask. The previous condition could
report "TX complete" even when the TX path was not fully empty, which can
cause flush users to loop or make incorrect progress decisions.
This change corrects the comparison against the TX-empty mask so that the
function only reports completion when the hardware indicates the expected
empty state.
Signed-off-by: Bernardo Perez Priego <bernardo.perez.priego@intel.com>