summaryrefslogtreecommitdiff
path: root/board/xilinx
diff options
context:
space:
mode:
Diffstat (limited to 'board/xilinx')
-rw-r--r--board/xilinx/zynqmp/zynqmp.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
index e41fec32df3..d3450ef6372 100644
--- a/board/xilinx/zynqmp/zynqmp.c
+++ b/board/xilinx/zynqmp/zynqmp.c
@@ -449,6 +449,47 @@ void reset_cpu(ulong addr)
{
}
+static const struct {
+ u32 bit;
+ const char *name;
+} reset_reasons[] = {
+ { RESET_REASON_DEBUG_SYS, "DEBUG" },
+ { RESET_REASON_SOFT, "SOFT" },
+ { RESET_REASON_SRST, "SRST" },
+ { RESET_REASON_PSONLY, "PS-ONLY" },
+ { RESET_REASON_PMU, "PMU" },
+ { RESET_REASON_INTERNAL, "INTERNAL" },
+ { RESET_REASON_EXTERNAL, "EXTERNAL" },
+ {}
+};
+
+static u32 reset_reason(void)
+{
+ u32 ret;
+ int i;
+ const char *reason = NULL;
+
+ ret = readl(&crlapb_base->reset_reason);
+
+ puts("Reset reason:\t");
+
+ for (i = 0; i < ARRAY_SIZE(reset_reasons); i++) {
+ if (ret & reset_reasons[i].bit) {
+ reason = reset_reasons[i].name;
+ printf("%s ", reset_reasons[i].name);
+ break;
+ }
+ }
+
+ puts("\n");
+
+ env_set("reset_reason", reason);
+
+ writel(~0, &crlapb_base->reset_reason);
+
+ return ret;
+}
+
int board_late_init(void)
{
u32 reg = 0;
@@ -540,6 +581,8 @@ int board_late_init(void)
env_set("boot_targets", new_targets);
+ reset_reason();
+
return 0;
}