Skip to content

Commit b17d098

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 bdd7397 commit b17d098

1 file changed

Lines changed: 24 additions & 2 deletions

File tree

boot/zephyr/nrf_cleanup.c

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,12 @@
3434
#include <pm_config.h>
3535
#endif
3636

37+
#ifdef CONFIG_SOC_NRF53_RTC_PRETICK
38+
#include <hal/nrf_ipc.h>
39+
#endif
40+
3741
#if defined(NRF_UARTE0) || defined(NRF_UARTE1) || defined(NRF_UARTE00) || \
38-
defined(NRF_UARTE20) || defined(NRF_UARTE30) || defined(NRF_UARTE136)
42+
defined(NRF_UARTE20) || defined(NRF_UARTE30) || defined(NRF_UARTE136)
3943
#define NRF_UARTE_CLEANUP
4044
#endif
4145

@@ -56,8 +60,22 @@ static inline void nrf_cleanup_rtc(NRF_RTC_Type * rtc_reg)
5660
}
5761
#endif
5862

59-
#if defined(CONFIG_NRF_GRTC_TIMER) && !defined(CONFIG_SYSTEM_TIMER_HAS_DISABLE_SUPPORT)
63+
#ifdef CONFIG_SOC_NRF53_RTC_PRETICK
64+
static inline void nrf_cleanup_nrf53_rtc_pretick(void)
65+
{
66+
nrf_ipc_event_t ipc_event =
67+
nrf_ipc_receive_event_get(CONFIG_SOC_NRF53_RTC_PRETICK_IPC_CH_FROM_NET);
68+
nrf_ipc_task_t ipc_task =
69+
nrf_ipc_send_task_get(CONFIG_SOC_NRF53_RTC_PRETICK_IPC_CH_TO_NET);
70+
uint32_t task_ipc = nrf_ipc_task_address_get(NRF_IPC, ipc_task);
71+
uint32_t evt_ipc = nrf_ipc_event_address_get(NRF_IPC, ipc_event);
72+
73+
NRF_DPPI_ENDPOINT_CLEAR(task_ipc);
74+
NRF_DPPI_ENDPOINT_CLEAR(evt_ipc);
75+
}
76+
#endif
6077

78+
#if defined(CONFIG_NRF_GRTC_TIMER) && !defined(CONFIG_SYSTEM_TIMER_HAS_DISABLE_SUPPORT)
6179
/**
6280
* This function is temporary and should be removed once nrfx_grtc_uninit
6381
* no longer resets the counter - see NRFX-8487.
@@ -211,4 +229,8 @@ void nrf_cleanup_peripheral(void)
211229
#if defined(CONFIG_NRFX_CLOCK)
212230
nrf_cleanup_clock();
213231
#endif
232+
233+
#ifdef CONFIG_SOC_NRF53_RTC_PRETICK
234+
nrf_cleanup_nrf53_rtc_pretick();
235+
#endif
214236
}

0 commit comments

Comments
 (0)