Skip to content

Commit 9033267

Browse files
committed
[DNM] drivers: serial: nrfx_uarte: implement de-init
Sample de-init implementation for nRF UARTE peripheral. It may not be fully correct. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
1 parent aa2eb38 commit 9033267

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

drivers/serial/uart_nrfx_uarte.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2429,6 +2429,18 @@ static int uarte_instance_init(const struct device *dev,
24292429
return pm_device_driver_init(dev, uarte_nrfx_pm_action);
24302430
}
24312431

2432+
static int uarte_deinit(const struct device *dev)
2433+
{
2434+
NRF_UARTE_Type *uarte = get_uarte_instance(dev);
2435+
2436+
uarte_pm_suspend(dev);
2437+
2438+
nrf_uarte_txrx_pins_disconnect(uarte);
2439+
nrf_uarte_hwfc_pins_disconnect(uarte);
2440+
2441+
return 0;
2442+
}
2443+
24322444
#define UARTE_IRQ_CONFIGURE(idx, isr_handler) \
24332445
do { \
24342446
IRQ_CONNECT(DT_IRQN(UARTE(idx)), DT_IRQ(UARTE(idx), priority), \
@@ -2581,8 +2593,9 @@ static int uarte_instance_init(const struct device *dev,
25812593
COND_CODE_1(INSTANCE_IS_FAST_PD(_, /*empty*/, idx, _),\
25822594
(0), (PM_DEVICE_ISR_SAFE))); \
25832595
\
2584-
DEVICE_DT_DEFINE(UARTE(idx), \
2596+
DEVICE_DT_DEINIT_DEFINE(UARTE(idx), \
25852597
uarte_##idx##_init, \
2598+
uarte_deinit, \
25862599
PM_DEVICE_DT_GET(UARTE(idx)), \
25872600
&uarte_##idx##_data, \
25882601
&uarte_##idx##z_config, \

0 commit comments

Comments
 (0)