diff options
author | Chee Hong Ang <chee.hong.ang@intel.com> | 2020-08-05 21:15:57 +0800 |
---|---|---|
committer | Ley Foon Tan <ley.foon.tan@intel.com> | 2020-10-09 17:53:11 +0800 |
commit | b3e2d9fccbe7390a859f7f46001c6312cc35455c (patch) | |
tree | 54fb5133a8eb0b7a9fb7d1c4377ec2c825c70764 /arch/arm/mach-socfpga/reset_manager_s10.c | |
parent | d7a1ff40d6006c818c9e74d3e13bec008638349f (diff) |
arm: socfpga: soc64: Show reset state in SPL
Print reset state (warm/cold) together with the
source (watchdog/MPU) which has triggered the warm
reset on S10 & Agilex.
Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
Reviewed-by: Ley Foon Tan <ley.foon.tan@intel.com>
Diffstat (limited to 'arch/arm/mach-socfpga/reset_manager_s10.c')
-rw-r--r-- | arch/arm/mach-socfpga/reset_manager_s10.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/arch/arm/mach-socfpga/reset_manager_s10.c b/arch/arm/mach-socfpga/reset_manager_s10.c index c7430777b2..9f16bf92d5 100644 --- a/arch/arm/mach-socfpga/reset_manager_s10.c +++ b/arch/arm/mach-socfpga/reset_manager_s10.c @@ -104,3 +104,25 @@ int cpu_has_been_warmreset(void) return readl(socfpga_get_rstmgr_addr() + RSTMGR_SOC64_STATUS) & RSTMGR_L4WD_MPU_WARMRESET_MASK; } + +void print_reset_info(void) +{ + bool iswd; + int n; + u32 stat = cpu_has_been_warmreset(); + + printf("Reset state: %s%s", stat ? "Warm " : "Cold", + (stat & RSTMGR_STAT_SDMWARMRST) ? "[from SDM] " : ""); + + stat &= ~RSTMGR_STAT_SDMWARMRST; + if (!stat) { + puts("\n"); + return; + } + + n = generic_ffs(stat) - 1; + iswd = (n >= RSTMGR_STAT_L4WD0RST_BITPOS); + printf("(Triggered by %s %d)\n", iswd ? "Watchdog" : "MPU", + iswd ? (n - RSTMGR_STAT_L4WD0RST_BITPOS) : + (n - RSTMGR_STAT_MPU0RST_BITPOS)); +} |