]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
arm: socfpga: soc64: Show reset state in SPL
authorChee Hong Ang <chee.hong.ang@intel.com>
Wed, 5 Aug 2020 13:15:57 +0000 (21:15 +0800)
committerLey Foon Tan <ley.foon.tan@intel.com>
Fri, 9 Oct 2020 09:53:11 +0000 (17:53 +0800)
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>
arch/arm/mach-socfpga/include/mach/reset_manager_soc64.h
arch/arm/mach-socfpga/reset_manager_s10.c
arch/arm/mach-socfpga/spl_agilex.c
arch/arm/mach-socfpga/spl_s10.c

index fc60f6a105b83a8304692dfcfd67beaaab53ec83..c8bb727aa2b07a705c56865779743ef449651553 100644 (file)
@@ -8,6 +8,7 @@
 
 void reset_deassert_peripherals_handoff(void);
 int cpu_has_been_warmreset(void);
+void print_reset_info(void);
 void socfpga_bridges_reset(int enable);
 
 #define RSTMGR_SOC64_STATUS    0x00
index c7430777b28ee599b3b58c8ca512f792395d314c..9f16bf92d5effdc0973b54d8287793a1b9c64d9e 100644 (file)
@@ -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));
+}
index bd971ecbd1dc1ab45ec32740698772c593cc0947..0121ff431f96bbd0a051fe06bd83b402de272895 100644 (file)
@@ -76,6 +76,7 @@ void board_init_f(ulong dummy)
        }
 
        preloader_console_init();
+       print_reset_info();
        cm_print_clock_quick_summary();
 
        firewall_setup();
index b3c6f6afc4428535726d3ff9c865772f791ab8ed..1f7118226c5256fcf774c9cdd142a2d259c3d9e4 100644 (file)
@@ -81,6 +81,7 @@ void board_init_f(ulong dummy)
 #endif
 
        preloader_console_init();
+       print_reset_info();
        cm_print_clock_quick_summary();
 
        firewall_setup();