Skip to content

Commit ee7df9f

Browse files
committed
[nrf noup] nrf_cleanup: nrf53: Add cleanup of RTC pretick resources
nRF53 has a workaround for Anomaly 165 which is configuring DPPIC connection for IPC task and event. Ensure that PUBLISH and SUBSCRIBE registers are cleaned. Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
1 parent 70b3a1e commit ee7df9f

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

boot/zephyr/nrf_cleanup.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929
#include <pm_config.h>
3030
#endif
3131

32+
#ifdef CONFIG_SOC_NRF53_RTC_PRETICK
33+
#include <hal/nrf_ipc.h>
34+
#endif
35+
3236
#if defined(NRF_UARTE0) || defined(NRF_UARTE1) || defined(NRF_UARTE20) || \
3337
defined(NRF_UARTE30)
3438
#define NRF_UARTE_CLEANUP
@@ -51,6 +55,21 @@ static inline void nrf_cleanup_rtc(NRF_RTC_Type * rtc_reg)
5155
}
5256
#endif
5357

58+
#ifdef CONFIG_SOC_NRF53_RTC_PRETICK
59+
static inline void nrf_cleanup_nrf53_rtc_pretick(void)
60+
{
61+
nrf_ipc_event_t ipc_event =
62+
nrf_ipc_receive_event_get(CONFIG_SOC_NRF53_RTC_PRETICK_IPC_CH_FROM_NET);
63+
nrf_ipc_task_t ipc_task =
64+
nrf_ipc_send_task_get(CONFIG_SOC_NRF53_RTC_PRETICK_IPC_CH_TO_NET);
65+
uint32_t task_ipc = nrf_ipc_task_address_get(NRF_IPC, ipc_task);
66+
uint32_t evt_ipc = nrf_ipc_event_address_get(NRF_IPC, ipc_event);
67+
68+
NRF_DPPI_ENDPOINT_CLEAR(task_ipc);
69+
NRF_DPPI_ENDPOINT_CLEAR(evt_ipc);
70+
}
71+
#endif
72+
5473
#if defined(CONFIG_NRF_GRTC_TIMER)
5574

5675
/**
@@ -183,4 +202,8 @@ void nrf_cleanup_peripheral(void)
183202
#if defined(CONFIG_NRFX_CLOCK)
184203
nrf_cleanup_clock();
185204
#endif
205+
206+
#ifdef CONFIG_SOC_NRF53_RTC_PRETICK
207+
nrf_cleanup_nrf53_rtc_pretick();
208+
#endif
186209
}

0 commit comments

Comments
 (0)