1# nrfx UART configuration
2
3# Copyright (c) 2016 - 2018, Nordic Semiconductor ASA
4# SPDX-License-Identifier: Apache-2.0
5
6menuconfig UART_NRFX
7	bool "nRF UART nrfx drivers"
8	default y
9	select SERIAL_HAS_DRIVER
10	select SERIAL_SUPPORT_INTERRUPT
11	select SERIAL_SUPPORT_ASYNC
12	select PINCTRL
13	depends on DT_HAS_NORDIC_NRF_UART_ENABLED || DT_HAS_NORDIC_NRF_UARTE_ENABLED
14	help
15	  Enable support for nrfx UART drivers for nRF MCU series.
16	  Peripherals with the same instance ID cannot be used together,
17	  e.g. UART_0 and UARTE_0.
18
19if UART_NRFX
20
21config UART_NRFX_UART
22	def_bool y
23	depends on DT_HAS_NORDIC_NRF_UART_ENABLED
24
25config UART_NRFX_UARTE
26	def_bool y
27	depends on DT_HAS_NORDIC_NRF_UARTE_ENABLED
28	imply NRFX_UARTE_CONFIG_SKIP_PSEL_CONFIG if !UART_NRFX_UARTE_LEGACY_SHIM
29	imply NRFX_UARTE_CONFIG_SKIP_GPIO_CONFIG if !UART_NRFX_UARTE_LEGACY_SHIM
30
31config UART_NRFX_UARTE_LEGACY_SHIM
32	bool "Legacy UARTE shim"
33	depends on UART_NRFX_UARTE
34	default y
35
36config UART_NRFX_UARTE_ENHANCED_RX
37	bool "Enhanced RX handling"
38	depends on UART_ASYNC_API
39	depends on UART_NRFX_UARTE_LEGACY_SHIM
40	default y
41	help
42	  Enable RX handling mode which is switching buffers on timeout. This is an
43	  enhancement compared to other two modes (default and hardware assisted).
44	  Default mode could miscount bytes when interrupt was not handled on time
45	  and hardware assisted required TIMER peripheral instance and PPI channel
46	  for accurate byte counting.
47
48config UART_ASYNC_TX_CACHE_SIZE
49	int "TX cache buffer size"
50	depends on UART_ASYNC_API
51	depends on UART_NRFX_UARTE_LEGACY_SHIM
52	default 8
53	help
54	  For UARTE, TX cache buffer is used when provided TX buffer is not located
55	  in RAM, because EasyDMA in UARTE peripherals can only transfer data
56	  from RAM.
57
58if HAS_HW_NRF_UART0 || HAS_HW_NRF_UARTE0
59nrfx_uart_num = 0
60rsource "Kconfig.nrfx_uart_instance"
61endif
62
63if HAS_HW_NRF_UARTE1
64nrfx_uart_num = 1
65rsource "Kconfig.nrfx_uart_instance"
66endif
67
68if HAS_HW_NRF_UARTE2
69nrfx_uart_num = 2
70rsource "Kconfig.nrfx_uart_instance"
71endif
72
73if HAS_HW_NRF_UARTE3
74nrfx_uart_num = 3
75rsource "Kconfig.nrfx_uart_instance"
76endif
77
78if HAS_HW_NRF_UARTE00
79nrfx_uart_num = 00
80rsource "Kconfig.nrfx_uart_instance"
81endif
82
83if HAS_HW_NRF_UARTE20
84nrfx_uart_num = 20
85rsource "Kconfig.nrfx_uart_instance"
86endif
87
88if HAS_HW_NRF_UARTE21
89nrfx_uart_num = 21
90rsource "Kconfig.nrfx_uart_instance"
91endif
92
93if HAS_HW_NRF_UARTE22
94nrfx_uart_num = 22
95rsource "Kconfig.nrfx_uart_instance"
96endif
97
98if HAS_HW_NRF_UARTE30
99nrfx_uart_num = 30
100rsource "Kconfig.nrfx_uart_instance"
101endif
102
103if HAS_HW_NRF_UARTE120
104nrfx_uart_num = 120
105rsource "Kconfig.nrfx_uart_instance"
106endif
107
108if HAS_HW_NRF_UARTE130
109nrfx_uart_num = 130
110rsource "Kconfig.nrfx_uart_instance"
111endif
112
113if HAS_HW_NRF_UARTE131
114nrfx_uart_num = 131
115rsource "Kconfig.nrfx_uart_instance"
116endif
117
118if HAS_HW_NRF_UARTE132
119nrfx_uart_num = 132
120rsource "Kconfig.nrfx_uart_instance"
121endif
122
123if HAS_HW_NRF_UARTE133
124nrfx_uart_num = 133
125rsource "Kconfig.nrfx_uart_instance"
126endif
127
128if HAS_HW_NRF_UARTE134
129nrfx_uart_num = 134
130rsource "Kconfig.nrfx_uart_instance"
131endif
132
133if HAS_HW_NRF_UARTE135
134nrfx_uart_num = 135
135rsource "Kconfig.nrfx_uart_instance"
136endif
137
138if HAS_HW_NRF_UARTE136
139nrfx_uart_num = 136
140rsource "Kconfig.nrfx_uart_instance"
141endif
142
143if HAS_HW_NRF_UARTE137
144nrfx_uart_num = 137
145rsource "Kconfig.nrfx_uart_instance"
146endif
147
148config NRFX_TIMER0
149	default y
150	depends on UART_0_NRF_HW_ASYNC_TIMER = 0 \
151		|| UART_1_NRF_HW_ASYNC_TIMER = 0 \
152		|| UART_2_NRF_HW_ASYNC_TIMER = 0 \
153		|| UART_3_NRF_HW_ASYNC_TIMER = 0
154
155config NRFX_TIMER1
156	default y
157	depends on UART_0_NRF_HW_ASYNC_TIMER = 1 \
158		|| UART_1_NRF_HW_ASYNC_TIMER = 1 \
159		|| UART_2_NRF_HW_ASYNC_TIMER = 1 \
160		|| UART_3_NRF_HW_ASYNC_TIMER = 1
161
162config NRFX_TIMER2
163	default y
164	depends on UART_0_NRF_HW_ASYNC_TIMER = 2 \
165		|| UART_1_NRF_HW_ASYNC_TIMER = 2 \
166		|| UART_2_NRF_HW_ASYNC_TIMER = 2 \
167		|| UART_3_NRF_HW_ASYNC_TIMER = 2
168
169config NRFX_TIMER3
170	default y
171	depends on UART_0_NRF_HW_ASYNC_TIMER = 3 \
172		|| UART_1_NRF_HW_ASYNC_TIMER = 3 \
173		|| UART_2_NRF_HW_ASYNC_TIMER = 3 \
174		|| UART_3_NRF_HW_ASYNC_TIMER = 3
175
176config NRFX_TIMER4
177	default y
178	depends on UART_0_NRF_HW_ASYNC_TIMER = 4 \
179		|| UART_1_NRF_HW_ASYNC_TIMER = 4 \
180		|| UART_2_NRF_HW_ASYNC_TIMER = 4 \
181		|| UART_3_NRF_HW_ASYNC_TIMER = 4
182
183endif # UART_NRFX
184