]> git.sur5r.net Git - u-boot/commitdiff
MX31: Introduce get_reset_cause()
authorFabio Estevam <fabio.estevam@freescale.com>
Mon, 18 Apr 2011 07:38:11 +0000 (07:38 +0000)
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>
Wed, 27 Apr 2011 17:38:05 +0000 (19:38 +0200)
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Detlev Zundel <dzu@denx.de>
arch/arm/cpu/arm1136/mx31/generic.c

index 9b7a7a24c15b8a4cd8ddd0225a525be67e32ae21..18572b9d37eff80fc9a16da7606a55d8e429ad27 100644 (file)
@@ -132,11 +132,38 @@ char *get_cpu_rev(void)
                return "unknown";
 }
 
+char *get_reset_cause(void)
+{
+       /* read RCSR register from CCM module */
+       struct clock_control_regs *ccm =
+               (struct clock_control_regs *)CCM_BASE;
+
+       u32 cause = readl(&ccm->rcsr) & 0x07;
+
+       switch (cause) {
+       case 0x0000:
+               return "POR";
+               break;
+       case 0x0001:
+               return "RST";
+               break;
+       case 0x0002:
+               return "WDOG";
+               break;
+       case 0x0006:
+               return "JTAG";
+               break;
+       default:
+               return "unknown reset";
+       }
+}
+
 #if defined(CONFIG_DISPLAY_CPUINFO)
 int print_cpuinfo (void)
 {
-       printf("CPU:   Freescale i.MX31 rev %s at %d MHz\n",
+       printf("CPU:   Freescale i.MX31 rev %s at %d MHz.",
                        get_cpu_rev(), mx31_get_mcu_main_clk() / 1000000);
+       printf("Reset cause: %s\n", get_reset_cause());
        return 0;
 }
 #endif