diff mbox

[U-Boot,1/2] ARM: i.MX: provide access to reset cause through get_imx_reset_cause()

Message ID 1424036242-742-1-git-send-email-eric.nelson@boundarydevices.com
State Awaiting Upstream
Delegated to: Stefano Babic
Headers show

Commit Message

Eric Nelson Feb. 15, 2015, 9:37 p.m. UTC
Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com>
---
This patch set replaces http://patchwork.ozlabs.org/patch/436492/.

 arch/arm/imx-common/cpu.c           | 10 +++++++++-
 arch/arm/include/asm/arch-imx/cpu.h |  2 ++
 2 files changed, 11 insertions(+), 1 deletion(-)

Comments

Stefano Babic Feb. 17, 2015, 9:54 a.m. UTC | #1
On 15/02/2015 22:37, Eric Nelson wrote:
> Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com>
> ---

Applied to u-boot-imx, thanks !

Best regards,
Stefano Babic
diff mbox

Patch

diff --git a/arch/arm/imx-common/cpu.c b/arch/arm/imx-common/cpu.c
index 28ccd29..067d08f 100644
--- a/arch/arm/imx-common/cpu.c
+++ b/arch/arm/imx-common/cpu.c
@@ -24,13 +24,16 @@ 
 #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
diff --git a/arch/arm/include/asm/arch-imx/cpu.h b/arch/arm/include/asm/arch-imx/cpu.h
index 254136e..4715f4e 100644
--- a/arch/arm/include/asm/arch-imx/cpu.h
+++ b/arch/arm/include/asm/arch-imx/cpu.h
@@ -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);