ipq6018: Handle crashdump disabled case in reset flow
When crashdump is disabled, kernel will set the dload_magic
as 0x40. When dload magic is 0x40, u-boot will clear the
magic and do warm/cold reset.
Change-Id: I4e5ed215419ba550776993f8a1772ad30f1a27e4
Signed-off-by: speriaka <speriaka@codeaurora.org>
diff --git a/board/qca/arm/ipq6018/ipq6018.c b/board/qca/arm/ipq6018/ipq6018.c
index f128d9e..58c5eef 100644
--- a/board/qca/arm/ipq6018/ipq6018.c
+++ b/board/qca/arm/ipq6018/ipq6018.c
@@ -30,6 +30,7 @@
#include <command.h>
#define DLOAD_MAGIC_COOKIE 0x10
+#define DLOAD_DISABLED 0x40
DECLARE_GLOBAL_DATA_PTR;
struct sdhci_host mmc_host;
extern int ipq6018_edma_init(void *cfg);
@@ -775,6 +776,16 @@
return 1;
}
+int apps_iscrashed_crashdump_disabled(void)
+{
+ u32 *dmagic = (u32 *)CONFIG_IPQ6018_DMAGIC_ADDR;
+
+ if (*dmagic == DLOAD_DISABLED)
+ return 1;
+
+ return 0;
+}
+
int apps_iscrashed(void)
{
u32 *dmagic = (u32 *)CONFIG_IPQ6018_DMAGIC_ADDR;
diff --git a/common/autoboot.c b/common/autoboot.c
index 37076ad..48b0606 100644
--- a/common/autoboot.c
+++ b/common/autoboot.c
@@ -361,6 +361,11 @@
return 0;
}
+__weak int apps_iscrashed_crashdump_disabled(void)
+{
+ return 0;
+}
+
void autoboot_command(const char *s)
{
debug("### main_loop: bootcmd=\"%s\"\n", s ? s : "<UNDEFINED>");
@@ -392,6 +397,11 @@
}
#endif
+ if (apps_iscrashed_crashdump_disabled()) {
+ printf("Crashdump disabled, resetting the board..\n");
+ reset_board();
+ }
+
if (stored_bootdelay != -1 && s && !abortboot(stored_bootdelay)) {
#if defined(CONFIG_AUTOBOOT_KEYED) && !defined(CONFIG_AUTOBOOT_KEYED_CTRLC)
int prev = disable_ctrlc(1); /* disable Control C checking */