Skip to content

Commit 69bee90

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 69bee90

1 file changed

Lines changed: 24 additions & 1 deletion

File tree

boot/zephyr/nrf_cleanup.c

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,13 @@
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) || \
3842
defined(NRF_UARTE20) || defined(NRF_UARTE30) || defined(NRF_UARTE136)
43+
3944
#define NRF_UARTE_CLEANUP
4045
#endif
4146

@@ -56,8 +61,22 @@ static inline void nrf_cleanup_rtc(NRF_RTC_Type * rtc_reg)
5661
}
5762
#endif
5863

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

79+
#if defined(CONFIG_NRF_GRTC_TIMER) && !defined(CONFIG_SYSTEM_TIMER_HAS_DISABLE_SUPPORT)
6180
/**
6281
* This function is temporary and should be removed once nrfx_grtc_uninit
6382
* no longer resets the counter - see NRFX-8487.
@@ -211,4 +230,8 @@ void nrf_cleanup_peripheral(void)
211230
#if defined(CONFIG_NRFX_CLOCK)
212231
nrf_cleanup_clock();
213232
#endif
233+
234+
#ifdef CONFIG_SOC_NRF53_RTC_PRETICK
235+
nrf_cleanup_nrf53_rtc_pretick();
236+
#endif
214237
}

0 commit comments

Comments
 (0)