From b6d45423c60b950d02c389262745c2fdcd27b4f0 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 29 Oct 2024 10:26:39 +0100 Subject: [PATCH] drivers: serial: nrfx_uarte: set/clear pins retention When GPD is managed by pinctrl, pins retention needs to be controlled by the driver to avoid glitches. Signed-off-by: Gerard Marull-Paretas --- drivers/serial/uart_nrfx_uarte.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index 5c19485946c..e1af63b7993 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -23,6 +23,11 @@ #include #include #include + +#ifdef CONFIG_SOC_NRF54H20_GPD +#include +#endif + LOG_MODULE_REGISTER(uart_nrfx_uarte, CONFIG_UART_LOG_LEVEL); #if !defined(CONFIG_ARCH_POSIX) @@ -2098,6 +2103,9 @@ static void uarte_pm_resume(const struct device *dev) if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) || !LOW_POWER_ENABLED(cfg)) { uarte_periph_enable(dev); +#ifdef CONFIG_SOC_NRF54H20_GPD + nrf_gpd_retain_pins_set(cfg->pcfg, false); +#endif } } @@ -2160,6 +2168,10 @@ static void uarte_pm_suspend(const struct device *dev) wait_for_tx_stopped(dev); } +#ifdef CONFIG_SOC_NRF54H20_GPD + nrf_gpd_retain_pins_set(cfg->pcfg, true); +#endif + nrf_uarte_disable(uarte); (void)pinctrl_apply_state(cfg->pcfg, PINCTRL_STATE_SLEEP);