Skip to contentSkip to conversation

Print reset information in SPL

PATCH New Chee Hong Ang 2 participants 5 messages Aug 5, 2020 – Aug 6, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Print reset information in SPL

Show reset information such as reset types (cold/warm) and which events triggered the reset.

Chee Hong Ang (2):
arm: socfpga: soc64: Add SDM triggered warm reset bit mask
arm: socfpga: soc64: Show reset state in SPL

 .../include/mach/reset_manager_soc64.h             | 12 ++++++++++--
 arch/arm/mach-socfpga/reset_manager_s10.c          | 22 ++++++++++++++++++++++
 arch/arm/mach-socfpga/spl_agilex.c                 |  1 +
 arch/arm/mach-socfpga/spl_s10.c                    |  1 +
 4 files changed, 34 insertions(+), 2 deletions(-)
Signature · 1 line
2.2.0
#1 lore raw

PATCH 1/2 arm: socfpga: soc64: Add SDM triggered warm reset bit mask

Include SDM triggered warm reset bit (BIT1) in Reset Manager's stat register when checking for HPS warm reset status. Refactor the warm reset mask macro for clarity purpose.

---
 arch/arm/mach-socfpga/include/mach/reset_manager_soc64.h | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
arch/arm/mach-socfpga/include/mach/reset_manager_soc64.h +9 -2
index 3f952bc..fc60f6a 100644
@@ -21,8 +21,15 @@ void socfpga_bridges_reset(int enable);
 #define RSTMGR_BRGMODRST_DDRSCH_MASK	0X00000040
 #define RSTMGR_BRGMODRST_FPGA2SOC_MASK	0x00000004
 
-/* Watchdogs and MPU warm reset mask */
-#define RSTMGR_L4WD_MPU_WARMRESET_MASK	0x000F0F00
+/* SDM, Watchdogs and MPU warm reset mask */
+#define RSTMGR_STAT_SDMWARMRST		BIT(1)
+#define RSTMGR_STAT_MPU0RST_BITPOS	8
+#define RSTMGR_STAT_L4WD0RST_BITPOS	16
+#define RSTMGR_L4WD_MPU_WARMRESET_MASK	(RSTMGR_STAT_SDMWARMRST | \
+		GENMASK(RSTMGR_STAT_MPU0RST_BITPOS + 3, \
+			RSTMGR_STAT_MPU0RST_BITPOS) | \
+		GENMASK(RSTMGR_STAT_L4WD0RST_BITPOS + 3, \
+			RSTMGR_STAT_L4WD0RST_BITPOS))
 
 /*
  * SocFPGA Stratix10 reset IDs, bank mapping is as follows:
Signature · 1 line
2.2.0
#2 lore raw

PATCH 1/2 arm: socfpga: soc64: Add SDM triggered warm reset bit mask

Quoted 19 lines

-----Original Message-----
From: Ang, Chee Hong <[email protected]>
Sent: Wednesday, August 5, 2020 9:16 PM
To: u-boot at lists.denx.de
Cc: Marek Vasut <[email protected]>; Simon Goldschmidt <[email protected]>; Tom Rini <[email protected]>; See, Chin Liang <[email protected]>; Tan, Ley Foon <[email protected]>; Ang, Chee Hong <[email protected]>; Chee, Tien Fong <[email protected]>; Lim, Elly Siew Chin <[email protected]>
Subject: [PATCH v1 1/2] arm: socfpga: soc64: Add SDM triggered warm reset bit mask

Include SDM triggered warm reset bit (BIT1) in Reset Manager's stat register when checking for HPS warm reset status.
Refactor the warm reset mask macro for clarity purpose.

Quoted 6 lines
---
 arch/arm/mach-socfpga/include/mach/reset_manager_soc64.h | 11
+++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
#3 lore raw

PATCH 2/2 arm: socfpga: soc64: Show reset state in SPL

In reply to Chee Hong Ang

Print reset state (warm/cold) together with the source (watchdog/MPU) which has triggered the warm reset on S10 & Agilex.

---
 .../include/mach/reset_manager_soc64.h             |  1 +
 arch/arm/mach-socfpga/reset_manager_s10.c          | 22 ++++++++++++++++++++++
 arch/arm/mach-socfpga/spl_agilex.c                 |  1 +
 arch/arm/mach-socfpga/spl_s10.c                    |  1 +
 4 files changed, 25 insertions(+)
arch/arm/mach-socfpga/include/mach/reset_manager_soc64.h +1 -0
index fc60f6a..c8bb727 100644
@@ -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
arch/arm/mach-socfpga/reset_manager_s10.c +22 -0
index c743077..9f16bf9 100644
@@ -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));
+}
arch/arm/mach-socfpga/spl_agilex.c +1 -0
index bd971ec..0121ff4 100644
@@ -76,6 +76,7 @@ void board_init_f(ulong dummy)
 	}
 
 	preloader_console_init();
+	print_reset_info();
 	cm_print_clock_quick_summary();
 
 	firewall_setup();
arch/arm/mach-socfpga/spl_s10.c +1 -0
index b3c6f6a..1f71182 100644
@@ -81,6 +81,7 @@ void board_init_f(ulong dummy)
 #endif
 
 	preloader_console_init();
+	print_reset_info();
 	cm_print_clock_quick_summary();
 
 	firewall_setup();
Signature · 1 line
2.2.0
#4 lore raw

PATCH 2/2 arm: socfpga: soc64: Show reset state in SPL

Quoted 17 lines

-----Original Message-----
From: Ang, Chee Hong <[email protected]>
Sent: Wednesday, August 5, 2020 9:16 PM
To: u-boot at lists.denx.de
Cc: Marek Vasut <[email protected]>; Simon Goldschmidt <[email protected]>; Tom Rini <[email protected]>; See, Chin Liang <[email protected]>; Tan, Ley Foon <[email protected]>; Ang, Chee Hong <[email protected]>; Chee, Tien Fong <[email protected]>; Lim, Elly Siew Chin <[email protected]>
Subject: [PATCH v1 2/2] 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.

Quoted 9 lines
---
 .../include/mach/reset_manager_soc64.h             |  1 +
 arch/arm/mach-socfpga/reset_manager_s10.c          | 22
++++++++++++++++++++++
 arch/arm/mach-socfpga/spl_agilex.c                 |  1 +
 arch/arm/mach-socfpga/spl_s10.c                    |  1 +
 4 files changed, 25 insertions(+)