drivers: serial: stm32u5: Serial wakeup is based on autonomous capability

On some devices such as STM32U5, there is no UART WKUP dedicated registers
as the hardware block has an integrated autonomous wakeup capability.
Hence it's capable to wake up the device from stop modes (down to Stop 1).

This behavior relies on RCC UESM bit which is enabled by default at reset
and not modified today in drivers.
Since driver will not compile otherwise, remain in this simple
configuration. This might be changed later on, if a need is seen to disable
UESM bit.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
This commit is contained in:
Erwan Gouriou 2023-11-21 16:59:27 +01:00 committed by Fabio Baltieri
parent a43e516ff2
commit a38c8d25e7

View file

@ -1279,7 +1279,8 @@ static void uart_stm32_isr(const struct device *dev)
uart_stm32_err_check(dev);
#endif /* CONFIG_UART_ASYNC_API */
#ifdef CONFIG_PM
#if defined(CONFIG_PM) && defined(IS_UART_WAKEUP_FROMSTOP_INSTANCE) \
&& defined(USART_CR3_WUFIE)
if (LL_USART_IsEnabledIT_WKUP(config->usart) &&
LL_USART_IsActiveFlag_WKUP(config->usart)) {
@ -2017,13 +2018,14 @@ static int uart_stm32_init(const struct device *dev)
* CONFIG_PM_DEVICE=n : Always active
* CONFIG_PM_DEVICE=y : Controlled by pm_device_wakeup_enable()
*/
#ifdef USART_CR3_WUFIE
LL_USART_Disable(config->usart);
LL_USART_SetWKUPType(config->usart, LL_USART_WAKEUP_ON_RXNE);
LL_USART_EnableIT_WKUP(config->usart);
LL_USART_ClearFlag_WKUP(config->usart);
LL_USART_EnableInStopMode(config->usart);
LL_USART_Enable(config->usart);
#endif
LL_USART_EnableInStopMode(config->usart);
if (config->wakeup_line != STM32_EXTI_LINE_NONE) {
/* Prepare the WAKEUP with the expected EXTI line */