ARM: i.MX: provide access to reset cause through get_imx_reset_cause()
authorEric Nelson <eric.nelson@boundarydevices.com>
Sun, 15 Feb 2015 21:37:21 +0000 (14:37 -0700)
committerStefano Babic <sbabic@denx.de>
Tue, 17 Feb 2015 09:42:54 +0000 (10:42 +0100)
Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com>
arch/arm/imx-common/cpu.c
arch/arm/include/asm/arch-imx/cpu.h

index 28ccd29594ed77976f45837039e40618e527a94f..067d08f131ad084fc5375945e848b24477a3453c 100644 (file)
 #include <fsl_esdhc.h>
 #endif
 
-char *get_reset_cause(void)
+static u32 reset_cause = -1;
+
+static char *get_reset_cause(void)
 {
        u32 cause;
        struct src *src_regs = (struct src *)SRC_BASE_ADDR;
 
        cause = readl(&src_regs->srsr);
        writel(cause, &src_regs->srsr);
+       reset_cause = cause;
 
        switch (cause) {
        case 0x00001:
@@ -53,6 +56,11 @@ char *get_reset_cause(void)
        }
 }
 
+u32 get_imx_reset_cause(void)
+{
+       return reset_cause;
+}
+
 #if defined(CONFIG_MX53) || defined(CONFIG_MX6)
 #if defined(CONFIG_MX53)
 #define MEMCTL_BASE    ESDCTL_BASE_ADDR
index 254136e2288323ed436d8ac1a1fa3a09fe7acc9c..4715f4e8946820639dddb69bfe50f567eae3dcf5 100644 (file)
@@ -17,3 +17,5 @@
 #define CS0_64M_CS1_64M                                1
 #define CS0_64M_CS1_32M_CS2_32M                        2
 #define CS0_32M_CS1_32M_CS2_32M_CS3_32M                3
+
+u32 get_imx_reset_cause(void);