[U-Boot] [PATCH 2/2] ARM: mx25: Print the source of reset

Fabio Estevam fabio.estevam at freescale.com
Tue Aug 30 15:54:10 CEST 2011


Print the source of reset during boot.

Signed-off-by: Fabio Estevam <fabio.estevam at freescale.com>
---
 arch/arm/cpu/arm926ejs/mx25/generic.c |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/arch/arm/cpu/arm926ejs/mx25/generic.c b/arch/arm/cpu/arm926ejs/mx25/generic.c
index a4e8c14..047e49d 100644
--- a/arch/arm/cpu/arm926ejs/mx25/generic.c
+++ b/arch/arm/cpu/arm926ejs/mx25/generic.c
@@ -130,6 +130,28 @@ u32 get_cpu_rev(void)
 	return system_rev;
 }
 
+static char *get_reset_cause(void)
+{
+	/* read RCSR register from CCM module */
+	struct ccm_regs *ccm =
+		(struct ccm_regs *)IMX_CCM_BASE;
+
+	u32 cause = readl(&ccm->rcsr) & 0x0f;
+
+	switch (cause) {
+	case 0x0000:
+		return "POR";
+	case 0x0001:
+		return "RST";
+	case 0x0002:
+		return "WDOG";
+	case 0x0006:
+		return "JTAG";
+	default:
+		return "unknown reset";
+	}
+}
+
 #if defined(CONFIG_DISPLAY_CPUINFO)
 int print_cpuinfo (void)
 {
@@ -138,10 +160,11 @@ int print_cpuinfo (void)
 
 	cpurev = get_cpu_rev();
 
-	printf("CPU:   Freescale i.MX25 rev%d.%d at %s MHz\n\n",
+	printf("CPU:   Freescale i.MX25 rev%d.%d at %s MHz\n",
 		(cpurev & 0x000F0) >> 4,
 		(cpurev & 0x0000F) >> 0,
 		strmhz (buf, imx_get_armclk ()));
+	printf("Reset cause: %s\n\n", get_reset_cause());
 	return 0;
 }
 #endif
-- 
1.7.1




More information about the U-Boot mailing list