diff options
author | Max Krummenacher <max.krummenacher@toradex.com> | 2019-02-01 16:04:51 +0100 |
---|---|---|
committer | Stefano Babic <sbabic@denx.de> | 2019-02-15 22:01:15 +0100 |
commit | 6ed4d26c21e46ed00ea65679b40aaf967d043dfd (patch) | |
tree | ef2d5af9867446c7f01267a773d85e2430439232 | |
parent | a24532083c78fd599807e0af58410a5b406330b5 (diff) | |
download | u-boot-6ed4d26c21e46ed00ea65679b40aaf967d043dfd.tar.gz u-boot-6ed4d26c21e46ed00ea65679b40aaf967d043dfd.tar.xz u-boot-6ed4d26c21e46ed00ea65679b40aaf967d043dfd.zip |
imx: cpu.c: give access to reset cause in spl
This makes get_imx_reset_cause() accessible in SPL, but keeps the SRSR
register content intact so that U-Boot proper can evaluated the
reset_cause again should this be needed.
Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-rw-r--r-- | arch/arm/mach-imx/cpu.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/arch/arm/mach-imx/cpu.c b/arch/arm/mach-imx/cpu.c index 80d9ff48a4..6b83f92662 100644 --- a/arch/arm/mach-imx/cpu.c +++ b/arch/arm/mach-imx/cpu.c @@ -25,19 +25,27 @@ #include <fsl_esdhc.h> #endif -#if defined(CONFIG_DISPLAY_CPUINFO) && !defined(CONFIG_SPL_BUILD) static u32 reset_cause = -1; -static char *get_reset_cause(void) +u32 get_imx_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; + if (reset_cause == -1) { + reset_cause = readl(&src_regs->srsr); +/* preserve the value for U-Boot proper */ +#if !defined(CONFIG_SPL_BUILD) + writel(reset_cause, &src_regs->srsr); +#endif + } + + return reset_cause; +} - switch (cause) { +#if defined(CONFIG_DISPLAY_CPUINFO) && !defined(CONFIG_SPL_BUILD) +static char *get_reset_cause(void) +{ + switch (get_imx_reset_cause()) { case 0x00001: case 0x00011: return "POR"; @@ -77,11 +85,6 @@ static char *get_reset_cause(void) return "unknown reset"; } } - -u32 get_imx_reset_cause(void) -{ - return reset_cause; -} #endif #if defined(CONFIG_MX53) || defined(CONFIG_MX6) |