From 4beb51c52ffeffb8b2cd0c150634ceb1c6913f5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Casper=20Egholm=20J=C3=B8rgensen?= Date: Fri, 16 Jun 2023 14:38:08 +0200 Subject: [PATCH] drivers: src: hwinfo: Report reset cause for lockup_sysresetreq MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix incomplete reset cause to be reported for NXP MIMXRT1062-evkb. In the event of a reset due to core lockup or software reset request on a 1062 board, the current NXP hwinfo driver reports an incomplete reset cause (only Ipp reset pin). This is happening because the 1062 uses a combined CPU lockup and system reset request register bit that should be checked, whereas the current driver only checks for the existence of a lockup-only status bit. This commit adds a check on the flag FSL_FEATURE_SRC_HAS_SRSR_LOCKUP_SYSRESETREQ already present in MIMXRT1062_features.h, to report such a reset cause should it occur. Signed-off-by: Casper Egholm Jørgensen --- drivers/hwinfo/hwinfo_mcux_src.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/hwinfo/hwinfo_mcux_src.c b/drivers/hwinfo/hwinfo_mcux_src.c index ecd64edabcf..4e7b6e55675 100644 --- a/drivers/hwinfo/hwinfo_mcux_src.c +++ b/drivers/hwinfo/hwinfo_mcux_src.c @@ -37,6 +37,12 @@ int z_impl_hwinfo_get_reset_cause(uint32_t *cause) flags |= RESET_CPU_LOCKUP; } #endif +#if (defined(FSL_FEATURE_SRC_HAS_SRSR_LOCKUP_SYSRESETREQ) && \ + FSL_FEATURE_SRC_HAS_SRSR_LOCKUP_SYSRESETREQ) + if (reason & kSRC_LockupSysResetFlag) { + flags |= RESET_CPU_LOCKUP | RESET_SOFTWARE; + } +#endif #if (defined(FSL_FEATURE_SRC_HAS_SRSR_CSU_RESET_B) && FSL_FEATURE_SRC_HAS_SRSR_CSU_RESET_B) if (reason & kSRC_CsuResetFlag) { flags |= RESET_SECURITY; @@ -115,6 +121,10 @@ int z_impl_hwinfo_get_supported_reset_cause(uint32_t *supported) #if (defined(FSL_FEATURE_SRC_HAS_SCR_LOCKUP_RST) && FSL_FEATURE_SRC_HAS_SCR_LOCKUP_RST) | RESET_CPU_LOCKUP #endif +#if (defined(FSL_FEATURE_SRC_HAS_SRSR_LOCKUP_SYSRESETREQ) && \ + FSL_FEATURE_SRC_HAS_SRSR_LOCKUP_SYSRESETREQ) + | RESET_CPU_LOCKUP | RESET_SOFTWARE +#endif #if (defined(FSL_FEATURE_SRC_HAS_SRSR_CSU_RESET_B) && FSL_FEATURE_SRC_HAS_SRSR_CSU_RESET_B) | RESET_SECURITY #endif