Skip to content

Commit f820153

Browse files
nordic-krche-rk
authored andcommitted
[nrf fromtree] drivers: serial: nrfx_uarte: Remove CONFIG_UART_n_GPIO_MANAGEMENT
This is a leftover from pre-pinctrl era and no longer makes sense. Driver always manages gpio through pinctrl. Support removed from uart and uarte shims. Signed-off-by: Krzysztof Chruściński <[email protected]> (cherry picked from commit 76db5b2) Signed-off-by: Rafał Kuźnia <[email protected]>
1 parent a7a137f commit f820153

File tree

3 files changed

+12
-52
lines changed

3 files changed

+12
-52
lines changed

drivers/serial/Kconfig.nrfx_uart_instance

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,3 @@ config UART_$(nrfx_uart_num)_A2I_RX_BUF_COUNT
119119
default 0
120120
help
121121
Number of chunks into RX space is divided.
122-
123-
config UART_$(nrfx_uart_num)_GPIO_MANAGEMENT
124-
bool "GPIO management on port $(nrfx_uart_num)"
125-
depends on PM_DEVICE
126-
default y
127-
help
128-
If enabled, the driver will configure the GPIOs used by the uart to
129-
their default configuration when device is powered down. The GPIOs
130-
will be configured back to correct state when UART is powered up.

drivers/serial/uart_nrfx_uart.c

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,12 +1086,9 @@ static int uart_nrfx_pm_action(const struct device *dev,
10861086

10871087
switch (action) {
10881088
case PM_DEVICE_ACTION_RESUME:
1089-
if (IS_ENABLED(CONFIG_UART_0_GPIO_MANAGEMENT)) {
1090-
ret = pinctrl_apply_state(config->pcfg,
1091-
PINCTRL_STATE_DEFAULT);
1092-
if (ret < 0) {
1093-
return ret;
1094-
}
1089+
ret = pinctrl_apply_state(config->pcfg, PINCTRL_STATE_DEFAULT);
1090+
if (ret < 0) {
1091+
return ret;
10951092
}
10961093

10971094
nrf_uart_enable(uart0_addr);
@@ -1102,13 +1099,9 @@ static int uart_nrfx_pm_action(const struct device *dev,
11021099
break;
11031100
case PM_DEVICE_ACTION_SUSPEND:
11041101
nrf_uart_disable(uart0_addr);
1105-
1106-
if (IS_ENABLED(CONFIG_UART_0_GPIO_MANAGEMENT)) {
1107-
ret = pinctrl_apply_state(config->pcfg,
1108-
PINCTRL_STATE_SLEEP);
1109-
if (ret < 0) {
1110-
return ret;
1111-
}
1102+
ret = pinctrl_apply_state(config->pcfg, PINCTRL_STATE_SLEEP);
1103+
if (ret < 0) {
1104+
return ret;
11121105
}
11131106
break;
11141107
default:

drivers/serial/uart_nrfx_uarte.c

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)