-
Notifications
You must be signed in to change notification settings - Fork 7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
drivers: hwinfo: Support for reset reasons in nRF54H20 #81751
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM from an API point of perspective.
Anyone from nordic who can verify?
0d7e6d2
to
ec1721d
Compare
I would propose to keep the code path clean and define a mask with all the macro decisions on top Top: RESET_CAUSE_XXX_MASK NRF_RESET_YYY Code: if(reason & RESET_CAUSE_XXX_MASK) { |
Compliance check is failing - Please add missing commit body. |
@kl-cruz can you follow up with this change? |
@@ -8,7 +8,7 @@ | |||
#include <zephyr/drivers/hwinfo.h> | |||
#include <string.h> | |||
#include <zephyr/sys/byteorder.h> | |||
#if !defined(CONFIG_SOC_SERIES_NRF54HX) && !defined(CONFIG_BOARD_QEMU_CORTEX_M0) | |||
#if !defined(CONFIG_BOARD_QEMU_CORTEX_M0) | |||
#include <helpers/nrfx_reset_reason.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file cannot be included for cpuppr and cpuflpr on nRF54H20 because this leads to #error "Unsupported device"
(and excluding them just in tests/drivers/hwinfo/api
is not sufficient).
How about handling this with something like:
#if defined(CONFIG_BOARD_QEMU_CORTEX_M0) || \
(defined(CONFIG_NRF_PLATFORM_HALTIUM) && \
defined(CONFIG_RISCV_CORE_NORDIC_VPR))
#define RESET_CAUSE_AVAILABLE 0
#else
#include <helpers/nrfx_reset_reason.h>
#define RESET_CAUSE_AVAILABLE 1
#endif
and then use #if RESET_REASON_AVAILABLE
before z_impl_hwinfo_get_reset_cause()
?
4ac99d4
to
34e6001
Compare
@@ -1,5 +1,7 @@ | |||
tests: | |||
drivers.hwinfo.api: | |||
platform_exclude: | |||
- nrf54h20dk/nrf54h20/cpuppr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still needed?
34e6001
to
36626c5
Compare
36626c5
to
856cced
Compare
drivers/hwinfo/hwinfo_nrf.c
Outdated
#define REASON_LOCKUP (NRFX_RESET_REASON_LOCKUP || NRFX_RESET_REASON_LOCAL_LOCKUP_MASK) | ||
#define REASON_SOFTWARE (NRFX_RESET_REASON_SREQ || NRFX_RESET_REASON_LOCAL_SREQ_MASK) | ||
#define REASON_WATCHDOG \ | ||
(NRFX_RESET_REASON_DOG_MASK || \ | ||
NRFX_RESET_REASON_LOCAL_DOG1_MASK || \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are bitmasks, so you should use |
, not ||
.
856cced
to
abe91a1
Compare
drivers/hwinfo/hwinfo_nrf.c
Outdated
#if NRF_POWER_HAS_RESETREAS | ||
#define REASON_WATCHDOG NRFX_RESET_REASON_DOG_MASK | ||
#else | ||
#define REASON_WATCHDOG NRFX_RESET_REASON_DOG1_MASK |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be actually (NRFX_RESET_REASON_DOG0_MASK | NRFX_RESET_REASON_DOG1_MASK)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added DOG0
e4b772b
abe91a1
to
e4b772b
Compare
Had to align to nrfx 3.10 where some enum names changed (e.g. NRFX_RESET_REASON_SREQ -> NRFX_RESET_REASON_SREQ_MASK) |
drivers/hwinfo/hwinfo_nrf.c
Outdated
#if NRF_POWER_HAS_RESETREAS | ||
#define REASON_WATCHDOG NRFX_RESET_REASON_DOG_MASK | ||
#else | ||
#define REASON_WATCHDOG NRFX_RESET_REASON_DOG0_MASK | NRFX_RESET_REASON_DOG1_MASK |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#define REASON_WATCHDOG NRFX_RESET_REASON_DOG0_MASK | NRFX_RESET_REASON_DOG1_MASK | |
#define REASON_WATCHDOG (NRFX_RESET_REASON_DOG0_MASK | NRFX_RESET_REASON_DOG1_MASK) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Adding support for reset reasons in the nRF54H20 SoC. Signed-off-by: Karol Lasończyk <karol.lasonczyk@nordicsemi.no>
e4b772b
to
82641c5
Compare
Adding support for reset reasons in the nRF54H20 SoC.