diff mbox series

[V5,37/44] imx8ulp: soc: correct reset cause

Message ID 20210807080113.16020-38-peng.fan@oss.nxp.com
State New
Headers show
Series imx: add i.MX8ULP support | expand

Commit Message

Peng Fan (OSS) Aug. 7, 2021, 8:01 a.m. UTC
From: Peng Fan <peng.fan@nxp.com>


The CMC1 SRS reflects the current reset cause, not SSRS.

Then you could get "Reset cause: WARM-WDG" when issue reset in U-Boot.

Reviewed-by: Ye Li <ye.li@nxp.com>

Signed-off-by: Peng Fan <peng.fan@nxp.com>

---
 arch/arm/mach-imx/imx8ulp/soc.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

-- 
2.30.0
diff mbox series

Patch

diff --git a/arch/arm/mach-imx/imx8ulp/soc.c b/arch/arm/mach-imx/imx8ulp/soc.c
index 0728cb9847..9bdbe3c846 100644
--- a/arch/arm/mach-imx/imx8ulp/soc.c
+++ b/arch/arm/mach-imx/imx8ulp/soc.c
@@ -149,8 +149,6 @@  enum bt_mode get_boot_mode(void)
 #define CMC_SRS_POR                       BIT(1)
 #define CMC_SRS_WUP                       BIT(0)
 
-static u32 reset_cause = -1;
-
 static char *get_reset_cause(char *ret)
 {
 	u32 cause1, cause = 0, srs = 0;
@@ -163,9 +161,7 @@  static char *get_reset_cause(char *ret)
 	srs = readl(reg_srs);
 	cause1 = readl(reg_ssrs);
 
-	reset_cause = cause1;
-
-	cause = cause1 & (CMC_SRS_POR | CMC_SRS_WUP | CMC_SRS_WARM);
+	cause = srs & (CMC_SRS_POR | CMC_SRS_WUP | CMC_SRS_WARM);
 
 	switch (cause) {
 	case CMC_SRS_POR:
@@ -175,7 +171,7 @@  static char *get_reset_cause(char *ret)
 		sprintf(ret, "%s", "WUP");
 		break;
 	case CMC_SRS_WARM:
-		cause = cause1 & (CMC_SRS_WDG | CMC_SRS_SW |
+		cause = srs & (CMC_SRS_WDG | CMC_SRS_SW |
 			CMC_SRS_JTAG_RST);
 		switch (cause) {
 		case CMC_SRS_WDG:
@@ -193,7 +189,7 @@  static char *get_reset_cause(char *ret)
 		}
 		break;
 	default:
-		sprintf(ret, "%s-%X", "UNKN", cause1);
+		sprintf(ret, "%s-%X", "UNKN", srs);
 		break;
 	}