mirror of
https://xff.cz/git/u-boot/
synced 2025-09-04 02:02:08 +02:00
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>
This commit is contained in:
committed by
Stefano Babic
parent
a24532083c
commit
6ed4d26c21
@@ -25,19 +25,27 @@
|
|||||||
#include <fsl_esdhc.h>
|
#include <fsl_esdhc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_DISPLAY_CPUINFO) && !defined(CONFIG_SPL_BUILD)
|
|
||||||
static u32 reset_cause = -1;
|
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;
|
struct src *src_regs = (struct src *)SRC_BASE_ADDR;
|
||||||
|
|
||||||
cause = readl(&src_regs->srsr);
|
if (reset_cause == -1) {
|
||||||
writel(cause, &src_regs->srsr);
|
reset_cause = readl(&src_regs->srsr);
|
||||||
reset_cause = cause;
|
/* preserve the value for U-Boot proper */
|
||||||
|
#if !defined(CONFIG_SPL_BUILD)
|
||||||
|
writel(reset_cause, &src_regs->srsr);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
switch (cause) {
|
return reset_cause;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(CONFIG_DISPLAY_CPUINFO) && !defined(CONFIG_SPL_BUILD)
|
||||||
|
static char *get_reset_cause(void)
|
||||||
|
{
|
||||||
|
switch (get_imx_reset_cause()) {
|
||||||
case 0x00001:
|
case 0x00001:
|
||||||
case 0x00011:
|
case 0x00011:
|
||||||
return "POR";
|
return "POR";
|
||||||
@@ -77,11 +85,6 @@ static char *get_reset_cause(void)
|
|||||||
return "unknown reset";
|
return "unknown reset";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 get_imx_reset_cause(void)
|
|
||||||
{
|
|
||||||
return reset_cause;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_MX53) || defined(CONFIG_MX6)
|
#if defined(CONFIG_MX53) || defined(CONFIG_MX6)
|
||||||
|
Reference in New Issue
Block a user