drivers: serial: nrf_uarte: Conditionally call PPI driver

Avoid calling PPI driver when enhanced poll functionality is
disabled. Fixing a case when driver failed to compile when
enhanced poll is disabled for all instances.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
Krzysztof Chruscinski 2021-05-06 12:31:21 +02:00 committed by Carles Cufí
parent f05ea6711a
commit 6a5d828948
2 changed files with 14 additions and 9 deletions

View file

@ -40,8 +40,6 @@ config UART_0_ENHANCED_POLL_OUT
bool "Efficient poll out on port 0" bool "Efficient poll out on port 0"
default y default y
depends on UART_0_NRF_UARTE depends on UART_0_NRF_UARTE
select NRFX_PPI if HAS_HW_NRF_PPI
select NRFX_DPPI if HAS_HW_NRF_DPPIC
help help
When enabled, polling out does not trigger interrupt which stops TX. When enabled, polling out does not trigger interrupt which stops TX.
Feature uses a PPI channel. Feature uses a PPI channel.
@ -135,8 +133,6 @@ config UART_1_ASYNC
config UART_1_ENHANCED_POLL_OUT config UART_1_ENHANCED_POLL_OUT
bool "Efficient poll out on port 1" bool "Efficient poll out on port 1"
default y default y
select NRFX_PPI if HAS_HW_NRF_PPI
select NRFX_DPPI if HAS_HW_NRF_DPPIC
help help
When enabled, polling out does not trigger interrupt which stops TX. When enabled, polling out does not trigger interrupt which stops TX.
Feature uses a PPI channel. Feature uses a PPI channel.
@ -214,8 +210,6 @@ config UART_2_ASYNC
config UART_2_ENHANCED_POLL_OUT config UART_2_ENHANCED_POLL_OUT
bool "Efficient poll out on port 2" bool "Efficient poll out on port 2"
default y default y
select NRFX_PPI if HAS_HW_NRF_PPI
select NRFX_DPPI if HAS_HW_NRF_DPPIC
help help
When enabled, polling out does not trigger interrupt which stops TX. When enabled, polling out does not trigger interrupt which stops TX.
Feature uses a PPI channel. Feature uses a PPI channel.
@ -292,8 +286,6 @@ config UART_3_ASYNC
config UART_3_ENHANCED_POLL_OUT config UART_3_ENHANCED_POLL_OUT
bool "Efficient poll out on port 3" bool "Efficient poll out on port 3"
default y default y
select NRFX_PPI if HAS_HW_NRF_PPI
select NRFX_DPPI if HAS_HW_NRF_DPPIC
help help
When enabled, polling out does not trigger interrupt which stops TX. When enabled, polling out does not trigger interrupt which stops TX.
Feature uses a PPI channel. Feature uses a PPI channel.
@ -390,6 +382,17 @@ config UARTE_NRF_HW_ASYNC
endif endif
if UART_0_ENHANCED_POLL_OUT || UART_1_ENHANCED_POLL_OUT || \
UART_2_ENHANCED_POLL_OUT || UART_3_ENHANCED_POLL_OUT
config UART_ENHANCED_POLL_OUT
bool
default y
select NRFX_PPI if HAS_HW_NRF_PPI
select NRFX_DPPI if HAS_HW_NRF_DPPIC
endif
config NRF_UART_PERIPHERAL config NRF_UART_PERIPHERAL
bool bool

View file

@ -51,6 +51,7 @@ LOG_MODULE_REGISTER(uart_nrfx_uarte, LOG_LEVEL_ERR);
(defined(CONFIG_UART_3_NRF_UARTE) && !defined(CONFIG_UART_3_ASYNC)) (defined(CONFIG_UART_3_NRF_UARTE) && !defined(CONFIG_UART_3_ASYNC))
#define UARTE_ANY_NONE_ASYNC 1 #define UARTE_ANY_NONE_ASYNC 1
#endif #endif
/* /*
* RX timeout is divided into time slabs, this define tells how many divisions * RX timeout is divided into time slabs, this define tells how many divisions
* should be made. More divisions - higher timeout accuracy and processor usage. * should be made. More divisions - higher timeout accuracy and processor usage.
@ -1672,7 +1673,8 @@ static int uarte_instance_init(const struct device *dev,
data->pm_state = PM_DEVICE_ACTIVE_STATE; data->pm_state = PM_DEVICE_ACTIVE_STATE;
#endif #endif
if (get_dev_config(dev)->flags & UARTE_CFG_FLAG_PPI_ENDTX) { if (IS_ENABLED(CONFIG_UART_ENHANCED_POLL_OUT) &&
get_dev_config(dev)->flags & UARTE_CFG_FLAG_PPI_ENDTX) {
err = endtx_stoptx_ppi_init(uarte, data); err = endtx_stoptx_ppi_init(uarte, data);
if (err < 0) { if (err < 0) {
return err; return err;