Skip to content

Commit 6803053

Browse files
committed
[nrf noup] drivers: serial: uart_nrfx_uarte: align to changes in nrfx
Align driver to changes in nrfx UARTE driver. Conflicts with UART counting. Signed-off-by: Michał Bainczyk <[email protected]>
1 parent e5500c1 commit 6803053

File tree

2 files changed

+9
-44
lines changed

2 files changed

+9
-44
lines changed

drivers/serial/Kconfig.nrfx

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -213,39 +213,4 @@ nrfx_uart_num = 137
213213
rsource "Kconfig.nrfx_uart_instance"
214214
endif
215215

216-
config NRFX_TIMER0
217-
default y
218-
depends on UART_0_NRF_HW_ASYNC_TIMER = 0 \
219-
|| UART_1_NRF_HW_ASYNC_TIMER = 0 \
220-
|| UART_2_NRF_HW_ASYNC_TIMER = 0 \
221-
|| UART_3_NRF_HW_ASYNC_TIMER = 0
222-
223-
config NRFX_TIMER1
224-
default y
225-
depends on UART_0_NRF_HW_ASYNC_TIMER = 1 \
226-
|| UART_1_NRF_HW_ASYNC_TIMER = 1 \
227-
|| UART_2_NRF_HW_ASYNC_TIMER = 1 \
228-
|| UART_3_NRF_HW_ASYNC_TIMER = 1
229-
230-
config NRFX_TIMER2
231-
default y
232-
depends on UART_0_NRF_HW_ASYNC_TIMER = 2 \
233-
|| UART_1_NRF_HW_ASYNC_TIMER = 2 \
234-
|| UART_2_NRF_HW_ASYNC_TIMER = 2 \
235-
|| UART_3_NRF_HW_ASYNC_TIMER = 2
236-
237-
config NRFX_TIMER3
238-
default y
239-
depends on UART_0_NRF_HW_ASYNC_TIMER = 3 \
240-
|| UART_1_NRF_HW_ASYNC_TIMER = 3 \
241-
|| UART_2_NRF_HW_ASYNC_TIMER = 3 \
242-
|| UART_3_NRF_HW_ASYNC_TIMER = 3
243-
244-
config NRFX_TIMER4
245-
default y
246-
depends on UART_0_NRF_HW_ASYNC_TIMER = 4 \
247-
|| UART_1_NRF_HW_ASYNC_TIMER = 4 \
248-
|| UART_2_NRF_HW_ASYNC_TIMER = 4 \
249-
|| UART_3_NRF_HW_ASYNC_TIMER = 4
250-
251216
endif # UART_NRFX

drivers/serial/uart_nrfx_uarte.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ struct uarte_nrfx_data {
306306
#endif
307307
#ifdef UARTE_ANY_ASYNC
308308
struct uarte_async_cb *async;
309+
nrfx_timer_t timer;
309310
#endif
310311
atomic_val_t poll_out_lock;
311312
atomic_t flags;
@@ -448,7 +449,6 @@ struct uarte_nrfx_config {
448449
size_t bounce_buf_swap_len;
449450
struct uarte_async_rx_cbwt *cbwt_data;
450451
#endif
451-
nrfx_timer_t timer;
452452
uint8_t *tx_cache;
453453
uint8_t *rx_flush_buf;
454454
#endif
@@ -878,7 +878,7 @@ static void uarte_periph_enable(const struct device *dev)
878878
#ifdef UARTE_ANY_ASYNC
879879
if (data->async) {
880880
if (HW_RX_COUNTING_ENABLED(config)) {
881-
const nrfx_timer_t *timer = &config->timer;
881+
nrfx_timer_t *timer = &data->timer;
882882

883883
nrfx_timer_enable(timer);
884884

@@ -1067,26 +1067,26 @@ static int uarte_nrfx_rx_counting_init(const struct device *dev)
10671067

10681068
if (HW_RX_COUNTING_ENABLED(cfg)) {
10691069
nrfx_timer_config_t tmr_config = NRFX_TIMER_DEFAULT_CONFIG(
1070-
NRF_TIMER_BASE_FREQUENCY_GET(cfg->timer.p_reg));
1070+
NRF_TIMER_BASE_FREQUENCY_GET(data->timer.p_reg));
10711071
uint32_t evt_addr = nrf_uarte_event_address_get(uarte, NRF_UARTE_EVENT_RXDRDY);
1072-
uint32_t tsk_addr = nrfx_timer_task_address_get(&cfg->timer, NRF_TIMER_TASK_COUNT);
1072+
uint32_t tsk_addr = nrfx_timer_task_address_get(&data->timer, NRF_TIMER_TASK_COUNT);
10731073

10741074
tmr_config.mode = NRF_TIMER_MODE_COUNTER;
10751075
tmr_config.bit_width = NRF_TIMER_BIT_WIDTH_32;
1076-
ret = nrfx_timer_init(&cfg->timer,
1076+
ret = nrfx_timer_init(&data->timer,
10771077
&tmr_config,
10781078
timer_handler);
10791079
if (ret != NRFX_SUCCESS) {
10801080
LOG_ERR("Timer already initialized");
10811081
return -EINVAL;
10821082
}
10831083

1084-
nrfx_timer_clear(&cfg->timer);
1084+
nrfx_timer_clear(&data->timer);
10851085

10861086
ret = nrfx_gppi_channel_alloc(&data->async->rx.cnt.ppi);
10871087
if (ret != NRFX_SUCCESS) {
10881088
LOG_ERR("Failed to allocate PPI Channel");
1089-
nrfx_timer_uninit(&cfg->timer);
1089+
nrfx_timer_uninit(&data->timer);
10901090
return -EINVAL;
10911091
}
10921092

@@ -3639,8 +3639,8 @@ static int uarte_instance_deinit(const struct device *dev)
36393639
IF_ENABLED(CONFIG_UARTE_NRFX_UARTE_COUNT_BYTES_WITH_TIMER, \
36403640
(UARTE_COUNT_BYTES_WITH_TIMER_CONFIG(idx))) \
36413641
IF_ENABLED(CONFIG_UART_##idx##_NRF_HW_ASYNC, \
3642-
(.timer = NRFX_TIMER_INSTANCE( \
3643-
CONFIG_UART_##idx##_NRF_HW_ASYNC_TIMER),)) \
3642+
(.timer = NRFX_TIMER_INSTANCE(NRF_TIMER_INST_GET( \
3643+
CONFIG_UART_##idx##_NRF_HW_ASYNC_TIMER)),)) \
36443644
IF_ENABLED(INSTANCE_IS_FAST(_, /*empty*/, idx, _), \
36453645
(.clk_dev = DEVICE_DT_GET_OR_NULL(DT_CLOCKS_CTLR(UARTE(idx))), \
36463646
.clk_spec = { \

0 commit comments

Comments
 (0)