Skip to content

Commit 937a828

Browse files
committed
[nrf fromlist] drivers: hwinfo: Support for reset reasons in nRF54H20
Adding support for reset reasons in the nRF54H20 SoC. Upstream PR #: 81751 Signed-off-by: Karol Lasończyk <[email protected]>
1 parent b257192 commit 937a828

File tree

1 file changed

+32
-5
lines changed

1 file changed

+32
-5
lines changed

drivers/hwinfo/hwinfo_nrf.c

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include <zephyr/drivers/hwinfo.h>
99
#include <string.h>
1010
#include <zephyr/sys/byteorder.h>
11-
#if !defined(CONFIG_SOC_SERIES_NRF54HX) && !defined(CONFIG_BOARD_QEMU_CORTEX_M0)
11+
#if !defined(CONFIG_BOARD_QEMU_CORTEX_M0)
1212
#include <helpers/nrfx_reset_reason.h>
1313
#endif
1414

@@ -63,7 +63,7 @@ ssize_t z_impl_hwinfo_get_device_id(uint8_t *buffer, size_t length)
6363
return length;
6464
}
6565

66-
#if !defined(CONFIG_SOC_SERIES_NRF54HX) && !defined(CONFIG_BOARD_QEMU_CORTEX_M0)
66+
#if !defined(CONFIG_BOARD_QEMU_CORTEX_M0)
6767
int z_impl_hwinfo_get_reset_cause(uint32_t *cause)
6868
{
6969
uint32_t flags = 0;
@@ -76,16 +76,35 @@ int z_impl_hwinfo_get_reset_cause(uint32_t *cause)
7676
if (reason & NRFX_RESET_REASON_DOG_MASK) {
7777
flags |= RESET_WATCHDOG;
7878
}
79-
if (reason & NRFX_RESET_REASON_LOCKUP_MASK) {
79+
80+
#if defined(NRF_RESETINFO)
81+
if (NRFX_RESET_REASON_LOCAL_DOG0_MASK) {
82+
flags |= RESET_WATCHDOG;
83+
}
84+
#endif
85+
86+
#if defined(NRF_RESETINFO)
87+
if (reason & NRFX_RESET_REASON_LOCAL_LOCKUP_MASK)
88+
#else
89+
if (reason & NRFX_RESET_REASON_LOCKUP_MASK)
90+
#endif
91+
{
8092
flags |= RESET_CPU_LOCKUP;
8193
}
94+
8295
if (reason & NRFX_RESET_REASON_OFF_MASK) {
8396
flags |= RESET_LOW_POWER_WAKE;
8497
}
8598
if (reason & NRFX_RESET_REASON_DIF_MASK) {
8699
flags |= RESET_DEBUG;
87100
}
88-
if (reason & NRFX_RESET_REASON_SREQ_MASK) {
101+
102+
#if defined(NRF_RESETINFO)
103+
if (reason & NRFX_RESET_REASON_LOCAL_SREQ_MASK)
104+
#else
105+
if (reason & NRFX_RESET_REASON_SREQ_MASK)
106+
#endif
107+
{
89108
flags |= RESET_SOFTWARE;
90109
}
91110

@@ -124,11 +143,19 @@ int z_impl_hwinfo_get_reset_cause(uint32_t *cause)
124143
flags |= RESET_DEBUG;
125144
}
126145
#endif
146+
127147
#if !NRF_POWER_HAS_RESETREAS
128-
if (reason & NRFX_RESET_REASON_DOG1_MASK) {
148+
149+
#if defined(NRF_RESETINFO)
150+
if (NRFX_RESET_REASON_LOCAL_DOG1_MASK)
151+
#else
152+
if (reason & NRFX_RESET_REASON_DOG1_MASK)
153+
#endif
154+
{
129155
flags |= RESET_WATCHDOG;
130156
}
131157
#endif
158+
132159
#if NRFX_RESET_REASON_HAS_GRTC
133160
if (reason & NRFX_RESET_REASON_GRTC_MASK) {
134161
flags |= RESET_CLOCK;

0 commit comments

Comments
 (0)