Skip to content

Commit a38c8d2

Browse files
erwangofabiobaltieri
authored andcommitted
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 <[email protected]>
1 parent a43e516 commit a38c8d2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/serial/uart_stm32.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,7 +1279,8 @@ static void uart_stm32_isr(const struct device *dev)
12791279
uart_stm32_err_check(dev);
12801280
#endif /* CONFIG_UART_ASYNC_API */
12811281

1282-
#ifdef CONFIG_PM
1282+
#if defined(CONFIG_PM) && defined(IS_UART_WAKEUP_FROMSTOP_INSTANCE) \
1283+
&& defined(USART_CR3_WUFIE)
12831284
if (LL_USART_IsEnabledIT_WKUP(config->usart) &&
12841285
LL_USART_IsActiveFlag_WKUP(config->usart)) {
12851286

@@ -2017,13 +2018,14 @@ static int uart_stm32_init(const struct device *dev)
20172018
* CONFIG_PM_DEVICE=n : Always active
20182019
* CONFIG_PM_DEVICE=y : Controlled by pm_device_wakeup_enable()
20192020
*/
2020-
2021+
#ifdef USART_CR3_WUFIE
20212022
LL_USART_Disable(config->usart);
20222023
LL_USART_SetWKUPType(config->usart, LL_USART_WAKEUP_ON_RXNE);
20232024
LL_USART_EnableIT_WKUP(config->usart);
20242025
LL_USART_ClearFlag_WKUP(config->usart);
2025-
LL_USART_EnableInStopMode(config->usart);
20262026
LL_USART_Enable(config->usart);
2027+
#endif
2028+
LL_USART_EnableInStopMode(config->usart);
20272029

20282030
if (config->wakeup_line != STM32_EXTI_LINE_NONE) {
20292031
/* Prepare the WAKEUP with the expected EXTI line */

0 commit comments

Comments
 (0)