drivers: serial: stm32 uart driver set EXTI line for wakeup from lowPower
The USART or LPUART, especially on stm32wl, must set the EXTI lines corresponding to the wakeUp source. This LL_EXTI_LINE_xx is given by the Device Tree property. This makes the system exiting lowpower stop mode on EXTI irq. The LL_EXTI_LINE_x is exactly the bit(X) set. Signed-off-by: Francois Ramu <francois.ramu@st.com>
This commit is contained in:
parent
cb0daa3d03
commit
0e119b53c6
|
@ -1694,6 +1694,10 @@ static int uart_stm32_init(const struct device *dev)
|
|||
* CONFIG_PM_DEVICE=y : Controlled by pm_device_wakeup_enable()
|
||||
*/
|
||||
LL_USART_EnableInStopMode(config->usart);
|
||||
if (config->wakeup_line != STM32_EXTI_LINE_NONE) {
|
||||
/* Prepare the WAKEUP with the expected EXTI line */
|
||||
LL_EXTI_EnableIT_0_31(BIT(config->wakeup_line));
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_PM */
|
||||
|
||||
|
@ -1843,8 +1847,11 @@ static void uart_stm32_irq_config_func_##index(const struct device *dev) \
|
|||
#endif
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
#define STM32_UART_PM_WAKEUP(index) \
|
||||
.wakeup_source = DT_INST_PROP(index, wakeup_source),
|
||||
#define STM32_UART_PM_WAKEUP(index) \
|
||||
.wakeup_source = DT_INST_PROP(index, wakeup_source), \
|
||||
.wakeup_line = COND_CODE_1(DT_INST_NODE_HAS_PROP(index, wakeup_line), \
|
||||
(DT_INST_PROP(index, wakeup_line)), \
|
||||
(STM32_EXTI_LINE_NONE)),
|
||||
#else
|
||||
#define STM32_UART_PM_WAKEUP(index) /* Not used */
|
||||
#endif
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
#include <stm32_ll_usart.h>
|
||||
|
||||
#define STM32_EXTI_LINE_NONE 0xFFFFFFFFU
|
||||
|
||||
/* device config */
|
||||
struct uart_stm32_config {
|
||||
/* USART instance */
|
||||
|
@ -44,6 +46,7 @@ struct uart_stm32_config {
|
|||
#if defined(CONFIG_PM)
|
||||
/* Device defined as wake-up source */
|
||||
bool wakeup_source;
|
||||
uint32_t wakeup_line;
|
||||
#endif /* CONFIG_PM */
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue