@@ -191,19 +191,16 @@ struct uarte_nrfx_data {
191191#define UARTE_LOW_POWER_TX BIT(0)
192192#define UARTE_LOW_POWER_RX BIT(1)
193193
194- /* If enabled, pins are managed when going to low power mode. */
195- #define UARTE_CFG_FLAG_GPIO_MGMT BIT(0)
196-
197194/* If enabled then ENDTX is PPI'ed to TXSTOP */
198- #define UARTE_CFG_FLAG_PPI_ENDTX BIT(1 )
195+ #define UARTE_CFG_FLAG_PPI_ENDTX BIT(0 )
199196
200197/* If enabled then TIMER and PPI is used for byte counting. */
201- #define UARTE_CFG_FLAG_HW_BYTE_COUNTING BIT(2 )
198+ #define UARTE_CFG_FLAG_HW_BYTE_COUNTING BIT(1 )
202199
203200/* If enabled then UARTE peripheral is disabled when not used. This allows
204201 * to achieve lowest power consumption in idle.
205202 */
206- #define UARTE_CFG_FLAG_LOW_POWER BIT(4 )
203+ #define UARTE_CFG_FLAG_LOW_POWER BIT(2 )
207204
208205/* Macro for converting numerical baudrate to register value. It is convenient
209206 * to use this approach because for constant input it can calculate nrf setting
@@ -516,20 +513,6 @@ static int wait_tx_ready(const struct device *dev)
516513 return key ;
517514}
518515
519- #if defined(UARTE_ANY_ASYNC ) || defined(CONFIG_PM_DEVICE )
520- static int pins_state_change (const struct device * dev , bool on )
521- {
522- const struct uarte_nrfx_config * config = dev -> config ;
523-
524- if (config -> flags & UARTE_CFG_FLAG_GPIO_MGMT ) {
525- return pinctrl_apply_state (config -> pcfg ,
526- on ? PINCTRL_STATE_DEFAULT : PINCTRL_STATE_SLEEP );
527- }
528-
529- return 0 ;
530- }
531- #endif
532-
533516#ifdef UARTE_ANY_ASYNC
534517
535518/* Using Macro instead of static inline function to handle NO_OPTIMIZATIONS case
@@ -551,7 +534,7 @@ static int uarte_enable(const struct device *dev, uint32_t mask)
551534 int ret ;
552535
553536 data -> async -> low_power_mask |= mask ;
554- ret = pins_state_change ( dev , true );
537+ ret = pinctrl_apply_state ( config -> pcfg , PINCTRL_STATE_DEFAULT );
555538 if (ret < 0 ) {
556539 return ret ;
557540 }
@@ -1293,10 +1276,6 @@ static void async_uart_release(const struct device *dev, uint32_t dir_mask)
12931276 }
12941277
12951278 uart_disable (dev );
1296- int err = pins_state_change (dev , false);
1297-
1298- (void )err ;
1299- __ASSERT_NO_MSG (err == 0 );
13001279 }
13011280
13021281 irq_unlock (key );
@@ -1924,8 +1903,7 @@ static int uarte_nrfx_pm_action(const struct device *dev,
19241903
19251904 switch (action ) {
19261905 case PM_DEVICE_ACTION_RESUME :
1927-
1928- ret = pins_state_change (dev , true);
1906+ ret = pinctrl_apply_state (cfg -> pcfg , PINCTRL_STATE_DEFAULT );
19291907 if (ret < 0 ) {
19301908 return ret ;
19311909 }
@@ -1994,7 +1972,7 @@ static int uarte_nrfx_pm_action(const struct device *dev,
19941972 wait_for_tx_stopped (dev );
19951973 uart_disable (dev );
19961974
1997- ret = pins_state_change ( dev , false );
1975+ ret = pinctrl_apply_state ( cfg -> pcfg , PINCTRL_STATE_SLEEP );
19981976 if (ret < 0 ) {
19991977 return ret ;
20001978 }
@@ -2095,8 +2073,6 @@ static int uarte_nrfx_pm_action(const struct device *dev,
20952073 .pcfg = PINCTRL_DT_DEV_CONFIG_GET(UARTE(idx)), \
20962074 .uarte_regs = _CONCAT(NRF_UARTE, idx), \
20972075 .flags = \
2098- (IS_ENABLED(CONFIG_UART_##idx##_GPIO_MANAGEMENT) ? \
2099- UARTE_CFG_FLAG_GPIO_MGMT : 0) | \
21002076 (IS_ENABLED(CONFIG_UART_##idx##_ENHANCED_POLL_OUT) ? \
21012077 UARTE_CFG_FLAG_PPI_ENDTX : 0) | \
21022078 (IS_ENABLED(CONFIG_UART_##idx##_NRF_HW_ASYNC) ? \
0 commit comments