drivers: serial: nrfx: Clean up driver instantiation
- use CONFIG_HAS_HW_NRF_* symbols consistently in nRF multi-instance drivers when creating particular driver instances - remove unnecessary hidden Kconfig options that indicated the type of peripheral to be used by a given instance (e.g. SPI, SPIM, or SPIS) and enabled proper nrfx driver instance; instead, use one option per peripheral type and include the corresponding shim driver flavor into compilation basing on that option (not the one that enables the nrfx driver as it was incorrectly done so far in some cases) Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
This commit is contained in:
parent
fa609e5844
commit
aa7d675935
3 changed files with 39 additions and 72 deletions
|
@ -25,8 +25,8 @@ zephyr_library_sources_ifdef(CONFIG_UART_MCUX_LPSCI uart_mcux_lpsci.c)
|
||||||
zephyr_library_sources_ifdef(CONFIG_UART_MIV uart_miv.c)
|
zephyr_library_sources_ifdef(CONFIG_UART_MIV uart_miv.c)
|
||||||
zephyr_library_sources_ifdef(CONFIG_UART_MSP432P4XX uart_msp432p4xx.c)
|
zephyr_library_sources_ifdef(CONFIG_UART_MSP432P4XX uart_msp432p4xx.c)
|
||||||
zephyr_library_sources_ifdef(CONFIG_UART_NS16550 uart_ns16550.c)
|
zephyr_library_sources_ifdef(CONFIG_UART_NS16550 uart_ns16550.c)
|
||||||
zephyr_library_sources_ifdef(CONFIG_NRF_UART_PERIPHERAL uart_nrfx_uart.c)
|
zephyr_library_sources_ifdef(CONFIG_UART_NRFX_UART uart_nrfx_uart.c)
|
||||||
zephyr_library_sources_ifdef(CONFIG_NRF_UARTE_PERIPHERAL uart_nrfx_uarte.c)
|
zephyr_library_sources_ifdef(CONFIG_UART_NRFX_UARTE uart_nrfx_uarte.c)
|
||||||
zephyr_library_sources_ifdef(CONFIG_UART_NUMICRO uart_numicro.c)
|
zephyr_library_sources_ifdef(CONFIG_UART_NUMICRO uart_numicro.c)
|
||||||
zephyr_library_sources_ifdef(CONFIG_UART_SAM uart_sam.c)
|
zephyr_library_sources_ifdef(CONFIG_UART_SAM uart_sam.c)
|
||||||
zephyr_library_sources_ifdef(CONFIG_USART_SAM usart_sam.c)
|
zephyr_library_sources_ifdef(CONFIG_USART_SAM usart_sam.c)
|
||||||
|
|
|
@ -17,10 +17,18 @@ menuconfig UART_NRFX
|
||||||
|
|
||||||
if UART_NRFX
|
if UART_NRFX
|
||||||
|
|
||||||
|
config UART_NRFX_UART
|
||||||
|
def_bool y
|
||||||
|
depends on DT_HAS_NORDIC_NRF_UART_ENABLED
|
||||||
|
|
||||||
|
config UART_NRFX_UARTE
|
||||||
|
def_bool y
|
||||||
|
depends on DT_HAS_NORDIC_NRF_UARTE_ENABLED
|
||||||
|
|
||||||
config UART_ASYNC_TX_CACHE_SIZE
|
config UART_ASYNC_TX_CACHE_SIZE
|
||||||
int "TX cache buffer size"
|
int "TX cache buffer size"
|
||||||
depends on UART_ASYNC_API
|
depends on UART_ASYNC_API
|
||||||
depends on NRF_UARTE_PERIPHERAL
|
depends on UART_NRFX_UARTE
|
||||||
default 8
|
default 8
|
||||||
help
|
help
|
||||||
For UARTE, TX cache buffer is used when provided TX buffer is not located
|
For UARTE, TX cache buffer is used when provided TX buffer is not located
|
||||||
|
@ -28,26 +36,12 @@ config UART_ASYNC_TX_CACHE_SIZE
|
||||||
from RAM.
|
from RAM.
|
||||||
|
|
||||||
# ----------------- port 0 -----------------
|
# ----------------- port 0 -----------------
|
||||||
config UART_0_NRF_UART
|
if HAS_HW_NRF_UART0 || HAS_HW_NRF_UARTE0
|
||||||
def_bool HAS_HW_NRF_UART0
|
|
||||||
depends on DT_HAS_NORDIC_NRF_UART_ENABLED
|
|
||||||
select NRF_UART_PERIPHERAL
|
|
||||||
help
|
|
||||||
Enable nRF UART without EasyDMA on port 0.
|
|
||||||
|
|
||||||
config UART_0_NRF_UARTE
|
|
||||||
def_bool HAS_HW_NRF_UARTE0
|
|
||||||
depends on DT_HAS_NORDIC_NRF_UARTE_ENABLED
|
|
||||||
select NRF_UARTE_PERIPHERAL
|
|
||||||
help
|
|
||||||
Enable nRF UART with EasyDMA on port 0.
|
|
||||||
|
|
||||||
if UART_0_NRF_UART || UART_0_NRF_UARTE
|
|
||||||
|
|
||||||
config UART_0_ENHANCED_POLL_OUT
|
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 HAS_HW_NRF_UARTE0
|
||||||
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.
|
||||||
|
@ -73,7 +67,7 @@ config UART_0_NRF_PARITY_BIT
|
||||||
|
|
||||||
config UART_0_NRF_TX_BUFFER_SIZE
|
config UART_0_NRF_TX_BUFFER_SIZE
|
||||||
int "Size of RAM buffer"
|
int "Size of RAM buffer"
|
||||||
depends on UART_0_NRF_UARTE
|
depends on HAS_HW_NRF_UARTE0
|
||||||
range 1 65535
|
range 1 65535
|
||||||
default 32
|
default 32
|
||||||
help
|
help
|
||||||
|
@ -83,7 +77,7 @@ config UART_0_NRF_TX_BUFFER_SIZE
|
||||||
|
|
||||||
config UART_0_NRF_HW_ASYNC
|
config UART_0_NRF_HW_ASYNC
|
||||||
bool "Use hardware RX byte counting"
|
bool "Use hardware RX byte counting"
|
||||||
depends on UART_0_NRF_UARTE
|
depends on HAS_HW_NRF_UARTE0
|
||||||
depends on UART_ASYNC_API
|
depends on UART_ASYNC_API
|
||||||
help
|
help
|
||||||
If default driver uses interrupts to count incoming bytes, it is possible
|
If default driver uses interrupts to count incoming bytes, it is possible
|
||||||
|
@ -93,7 +87,7 @@ config UART_0_NRF_HW_ASYNC
|
||||||
|
|
||||||
config UART_0_NRF_ASYNC_LOW_POWER
|
config UART_0_NRF_ASYNC_LOW_POWER
|
||||||
bool "Low power mode"
|
bool "Low power mode"
|
||||||
depends on UART_0_NRF_UARTE
|
depends on HAS_HW_NRF_UARTE0
|
||||||
depends on UART_ASYNC_API
|
depends on UART_ASYNC_API
|
||||||
help
|
help
|
||||||
When enabled, UARTE is enabled before each TX or RX usage and disabled
|
When enabled, UARTE is enabled before each TX or RX usage and disabled
|
||||||
|
@ -113,17 +107,10 @@ config UART_0_GPIO_MANAGEMENT
|
||||||
their default configuration when device is powered down. The GPIOs
|
their default configuration when device is powered down. The GPIOs
|
||||||
will be configured back to correct state when UART is powered up.
|
will be configured back to correct state when UART is powered up.
|
||||||
|
|
||||||
endif # UART_0_NRF_UART || UART_0_NRF_UARTE
|
endif # HAS_HW_NRF_UART0 || HAS_HW_NRF_UARTE0
|
||||||
|
|
||||||
# ----------------- port 1 -----------------
|
# ----------------- port 1 -----------------
|
||||||
config UART_1_NRF_UARTE
|
if HAS_HW_NRF_UARTE1
|
||||||
def_bool HAS_HW_NRF_UARTE1
|
|
||||||
depends on DT_HAS_NORDIC_NRF_UARTE_ENABLED
|
|
||||||
select NRF_UARTE_PERIPHERAL
|
|
||||||
help
|
|
||||||
Enable nRF UART with EasyDMA on port 1.
|
|
||||||
|
|
||||||
if UART_1_NRF_UARTE
|
|
||||||
|
|
||||||
config UART_1_INTERRUPT_DRIVEN
|
config UART_1_INTERRUPT_DRIVEN
|
||||||
bool "Interrupt support on port 1"
|
bool "Interrupt support on port 1"
|
||||||
|
@ -191,17 +178,10 @@ config UART_1_GPIO_MANAGEMENT
|
||||||
their default configuration when device is powered down. The GPIOs
|
their default configuration when device is powered down. The GPIOs
|
||||||
will be configured back to correct state when UART is powered up.
|
will be configured back to correct state when UART is powered up.
|
||||||
|
|
||||||
endif # UART_1_NRF_UARTE
|
endif # HAS_HW_NRF_UARTE1
|
||||||
|
|
||||||
# ----------------- port 2 -----------------
|
# ----------------- port 2 -----------------
|
||||||
config UART_2_NRF_UARTE
|
if HAS_HW_NRF_UARTE2
|
||||||
def_bool HAS_HW_NRF_UARTE2
|
|
||||||
depends on DT_HAS_NORDIC_NRF_UARTE_ENABLED
|
|
||||||
select NRF_UARTE_PERIPHERAL
|
|
||||||
help
|
|
||||||
Enable nRF UART with EasyDMA on port 2.
|
|
||||||
|
|
||||||
if UART_2_NRF_UARTE
|
|
||||||
|
|
||||||
config UART_2_INTERRUPT_DRIVEN
|
config UART_2_INTERRUPT_DRIVEN
|
||||||
bool "Interrupt support on port 2"
|
bool "Interrupt support on port 2"
|
||||||
|
@ -268,17 +248,10 @@ config UART_2_GPIO_MANAGEMENT
|
||||||
their default configuration when device is powered down. The GPIOs
|
their default configuration when device is powered down. The GPIOs
|
||||||
will be configured back to correct state when UART is powered up.
|
will be configured back to correct state when UART is powered up.
|
||||||
|
|
||||||
endif # UART_2_NRF_UARTE
|
endif # HAS_HW_NRF_UARTE2
|
||||||
|
|
||||||
# ----------------- port 3 -----------------
|
# ----------------- port 3 -----------------
|
||||||
config UART_3_NRF_UARTE
|
if HAS_HW_NRF_UARTE3
|
||||||
def_bool HAS_HW_NRF_UARTE3
|
|
||||||
depends on DT_HAS_NORDIC_NRF_UARTE_ENABLED
|
|
||||||
select NRF_UARTE_PERIPHERAL
|
|
||||||
help
|
|
||||||
Enable nRF UART with EasyDMA on port 3.
|
|
||||||
|
|
||||||
if UART_3_NRF_UARTE
|
|
||||||
|
|
||||||
config UART_3_INTERRUPT_DRIVEN
|
config UART_3_INTERRUPT_DRIVEN
|
||||||
bool "Interrupt support on port 3"
|
bool "Interrupt support on port 3"
|
||||||
|
@ -345,7 +318,7 @@ config UART_3_GPIO_MANAGEMENT
|
||||||
their default configuration when device is powered down. The GPIOs
|
their default configuration when device is powered down. The GPIOs
|
||||||
will be configured back to correct state when UART is powered up.
|
will be configured back to correct state when UART is powered up.
|
||||||
|
|
||||||
endif # UART_3_NRF_UARTE
|
endif # HAS_HW_NRF_UARTE3
|
||||||
|
|
||||||
|
|
||||||
config NRFX_TIMER0
|
config NRFX_TIMER0
|
||||||
|
@ -402,10 +375,4 @@ config UART_ENHANCED_POLL_OUT
|
||||||
select NRFX_PPI if HAS_HW_NRF_PPI
|
select NRFX_PPI if HAS_HW_NRF_PPI
|
||||||
select NRFX_DPPI if HAS_HW_NRF_DPPIC
|
select NRFX_DPPI if HAS_HW_NRF_DPPIC
|
||||||
|
|
||||||
config NRF_UART_PERIPHERAL
|
|
||||||
bool
|
|
||||||
|
|
||||||
config NRF_UARTE_PERIPHERAL
|
|
||||||
bool
|
|
||||||
|
|
||||||
endif # UART_NRFX
|
endif # UART_NRFX
|
||||||
|
|
|
@ -40,28 +40,28 @@ LOG_MODULE_REGISTER(uart_nrfx_uarte, CONFIG_UART_LOG_LEVEL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if (defined(CONFIG_UART_0_NRF_UARTE) && \
|
#if (defined(CONFIG_HAS_HW_NRF_UARTE0) && \
|
||||||
defined(CONFIG_UART_0_INTERRUPT_DRIVEN)) || \
|
defined(CONFIG_UART_0_INTERRUPT_DRIVEN)) || \
|
||||||
(defined(CONFIG_UART_1_NRF_UARTE) && \
|
(defined(CONFIG_HAS_HW_NRF_UARTE1) && \
|
||||||
defined(CONFIG_UART_1_INTERRUPT_DRIVEN)) || \
|
defined(CONFIG_UART_1_INTERRUPT_DRIVEN)) || \
|
||||||
(defined(CONFIG_UART_2_NRF_UARTE) && \
|
(defined(CONFIG_HAS_HW_NRF_UARTE2) && \
|
||||||
defined(CONFIG_UART_2_INTERRUPT_DRIVEN)) || \
|
defined(CONFIG_UART_2_INTERRUPT_DRIVEN)) || \
|
||||||
(defined(CONFIG_UART_3_NRF_UARTE) && \
|
(defined(CONFIG_HAS_HW_NRF_UARTE3) && \
|
||||||
defined(CONFIG_UART_3_INTERRUPT_DRIVEN))
|
defined(CONFIG_UART_3_INTERRUPT_DRIVEN))
|
||||||
#define UARTE_INTERRUPT_DRIVEN 1
|
#define UARTE_INTERRUPT_DRIVEN 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined(CONFIG_UART_0_NRF_UARTE) && !defined(CONFIG_UART_0_ASYNC)) || \
|
#if (defined(CONFIG_HAS_HW_NRF_UARTE0) && !defined(CONFIG_UART_0_ASYNC)) || \
|
||||||
(defined(CONFIG_UART_1_NRF_UARTE) && !defined(CONFIG_UART_1_ASYNC)) || \
|
(defined(CONFIG_HAS_HW_NRF_UARTE1) && !defined(CONFIG_UART_1_ASYNC)) || \
|
||||||
(defined(CONFIG_UART_2_NRF_UARTE) && !defined(CONFIG_UART_2_ASYNC)) || \
|
(defined(CONFIG_HAS_HW_NRF_UARTE2) && !defined(CONFIG_UART_2_ASYNC)) || \
|
||||||
(defined(CONFIG_UART_3_NRF_UARTE) && !defined(CONFIG_UART_3_ASYNC))
|
(defined(CONFIG_HAS_HW_NRF_UARTE3) && !defined(CONFIG_UART_3_ASYNC))
|
||||||
#define UARTE_ANY_NONE_ASYNC 1
|
#define UARTE_ANY_NONE_ASYNC 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined(CONFIG_UART_0_NRF_UARTE) && defined(CONFIG_UART_0_ASYNC)) || \
|
#if (defined(CONFIG_HAS_HW_NRF_UARTE0) && defined(CONFIG_UART_0_ASYNC)) || \
|
||||||
(defined(CONFIG_UART_1_NRF_UARTE) && defined(CONFIG_UART_1_ASYNC)) || \
|
(defined(CONFIG_HAS_HW_NRF_UARTE1) && defined(CONFIG_UART_1_ASYNC)) || \
|
||||||
(defined(CONFIG_UART_2_NRF_UARTE) && defined(CONFIG_UART_2_ASYNC)) || \
|
(defined(CONFIG_HAS_HW_NRF_UARTE2) && defined(CONFIG_UART_2_ASYNC)) || \
|
||||||
(defined(CONFIG_UART_3_NRF_UARTE) && defined(CONFIG_UART_3_ASYNC))
|
(defined(CONFIG_HAS_HW_NRF_UARTE3) && defined(CONFIG_UART_3_ASYNC))
|
||||||
#define UARTE_ANY_ASYNC 1
|
#define UARTE_ANY_ASYNC 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2068,18 +2068,18 @@ static int uarte_nrfx_pm_action(const struct device *dev,
|
||||||
DT_PHANDLE(UARTE(idx), memory_regions)))))), \
|
DT_PHANDLE(UARTE(idx), memory_regions)))))), \
|
||||||
())
|
())
|
||||||
|
|
||||||
#ifdef CONFIG_UART_0_NRF_UARTE
|
#ifdef CONFIG_HAS_HW_NRF_UARTE0
|
||||||
UART_NRF_UARTE_DEVICE(0);
|
UART_NRF_UARTE_DEVICE(0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_UART_1_NRF_UARTE
|
#ifdef CONFIG_HAS_HW_NRF_UARTE1
|
||||||
UART_NRF_UARTE_DEVICE(1);
|
UART_NRF_UARTE_DEVICE(1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_UART_2_NRF_UARTE
|
#ifdef CONFIG_HAS_HW_NRF_UARTE2
|
||||||
UART_NRF_UARTE_DEVICE(2);
|
UART_NRF_UARTE_DEVICE(2);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_UART_3_NRF_UARTE
|
#ifdef CONFIG_HAS_HW_NRF_UARTE3
|
||||||
UART_NRF_UARTE_DEVICE(3);
|
UART_NRF_UARTE_DEVICE(3);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue