aboutsummaryrefslogtreecommitdiff
path: root/arch/arm
diff options
context:
space:
mode:
authorIgor Opaniuk2024-01-31 13:49:26 +0100
committerFabio Estevam2024-02-08 09:17:46 -0300
commitc4bc7db966176136c3e8508d3780836c7006c88e (patch)
tree6487d2b5512140e66844fb73529e0223c2d9c51c /arch/arm
parent0bc69a1d38f4176ec5cfaba1c41be6b7e7fd46b5 (diff)
imx: imx8: print reset cause
Add support for printing reset cause during boot. Signed-off-by: Igor Opaniuk <igor.opaniuk@foundries.io>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-imx/imx8/cpu.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/imx8/cpu.c b/arch/arm/mach-imx/imx8/cpu.c
index 39ac0bc4140..0b91e448a5d 100644
--- a/arch/arm/mach-imx/imx8/cpu.c
+++ b/arch/arm/mach-imx/imx8/cpu.c
@@ -45,6 +45,45 @@ struct pass_over_info_t *get_pass_over_info(void)
return p;
}
+static char *get_reset_cause(void)
+{
+ sc_pm_reset_reason_t reason;
+
+ if (sc_pm_reset_reason(-1, &reason) != SC_ERR_NONE)
+ return "Unknown reset";
+
+ switch (reason) {
+ case SC_PM_RESET_REASON_POR:
+ return "POR";
+ case SC_PM_RESET_REASON_JTAG:
+ return "JTAG reset ";
+ case SC_PM_RESET_REASON_SW:
+ return "Software reset";
+ case SC_PM_RESET_REASON_WDOG:
+ return "Watchdog reset";
+ case SC_PM_RESET_REASON_LOCKUP:
+ return "SCU lockup reset";
+ case SC_PM_RESET_REASON_SNVS:
+ return "SNVS reset";
+ case SC_PM_RESET_REASON_TEMP:
+ return "Temp panic reset";
+ case SC_PM_RESET_REASON_MSI:
+ return "MSI reset";
+ case SC_PM_RESET_REASON_UECC:
+ return "ECC reset";
+ case SC_PM_RESET_REASON_SCFW_WDOG:
+ return "SCFW watchdog reset";
+ case SC_PM_RESET_REASON_ROM_WDOG:
+ return "SCU ROM watchdog reset";
+ case SC_PM_RESET_REASON_SECO:
+ return "SECO reset";
+ case SC_PM_RESET_REASON_SCFW_FAULT:
+ return "SCFW fault reset";
+ default:
+ return "Unknown reset";
+ }
+}
+
int arch_cpu_init(void)
{
#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_RECOVER_DATA_SECTION)
@@ -322,6 +361,8 @@ int print_bootinfo(void)
break;
}
+ printf("Reset cause: %s\n", get_reset_cause());
+
return 0;
}