Skip to content

Commit e92888b

Browse files
ahasztagrlubos
authored andcommitted
[nrf noup] nrf_cleanup: nRF54h: fix missing peripheral cleanup
This commit adds cleanup for GRTC and UARTE peripherals. ref: NCSDK-32966 Signed-off-by: Artur Hadasz <[email protected]> (cherry picked from commit 5afc0aa)
1 parent ce377b6 commit e92888b

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

boot/zephyr/nrf_cleanup.c

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
55
*/
66

7-
#if !defined(CONFIG_SOC_SERIES_NRF54HX)
7+
#if defined(CONFIG_NRFX_CLOCK)
88
#include <hal/nrf_clock.h>
99
#endif
1010
#include <hal/nrf_uarte.h>
@@ -13,6 +13,9 @@
1313
#if defined(NRF_RTC0) || defined(NRF_RTC1) || defined(NRF_RTC2)
1414
#include <hal/nrf_rtc.h>
1515
#endif
16+
#if defined(CONFIG_NRF_GRTC_TIMER)
17+
#include <nrfx_grtc.h>
18+
#endif
1619
#if defined(NRF_PPI)
1720
#include <hal/nrf_ppi.h>
1821
#endif
@@ -48,6 +51,13 @@ static inline void nrf_cleanup_rtc(NRF_RTC_Type * rtc_reg)
4851
}
4952
#endif
5053

54+
#if defined(CONFIG_NRF_GRTC_TIMER)
55+
static inline void nrf_cleanup_grtc(void)
56+
{
57+
nrfx_grtc_uninit();
58+
}
59+
#endif
60+
5161
#if defined(NRF_UARTE_CLEANUP)
5262
static NRF_UARTE_Type *nrf_uarte_to_clean[] = {
5363
#if defined(NRF_UARTE0)
@@ -62,10 +72,13 @@ static NRF_UARTE_Type *nrf_uarte_to_clean[] = {
6272
#if defined(NRF_UARTE30)
6373
NRF_UARTE30,
6474
#endif
75+
#if defined(NRF_UARTE136)
76+
NRF_UARTE136,
77+
#endif
6578
};
6679
#endif
6780

68-
#if !defined(CONFIG_SOC_SERIES_NRF54HX)
81+
#if defined(CONFIG_NRFX_CLOCK)
6982
static void nrf_cleanup_clock(void)
7083
{
7184
nrf_clock_int_disable(NRF_CLOCK, 0xFFFFFFFF);
@@ -84,6 +97,10 @@ void nrf_cleanup_peripheral(void)
8497
nrf_cleanup_rtc(NRF_RTC2);
8598
#endif
8699

100+
#if defined(CONFIG_NRF_GRTC_TIMER)
101+
nrf_cleanup_grtc();
102+
#endif
103+
87104
#if defined(NRF_UARTE_CLEANUP)
88105
for (int i = 0; i < sizeof(nrf_uarte_to_clean) / sizeof(nrf_uarte_to_clean[0]); ++i) {
89106
NRF_UARTE_Type *current = nrf_uarte_to_clean[i];
@@ -137,7 +154,7 @@ void nrf_cleanup_peripheral(void)
137154
nrf_dppi_channels_disable_all(NRF_DPPIC);
138155
#endif
139156

140-
#if !defined(CONFIG_SOC_SERIES_NRF54HX)
157+
#if defined(CONFIG_NRFX_CLOCK)
141158
nrf_cleanup_clock();
142159
#endif
143160
}

0 commit comments

Comments
 (0)