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>
This commit is contained in:
speriaka 2019-08-27 11:27:13 +05:30 committed by Gerrit - the friendly Code Review server
parent 3c7fc02e90
commit 98e4409f87
2 changed files with 21 additions and 0 deletions

View file

@ -30,6 +30,7 @@
#include <command.h> #include <command.h>
#define DLOAD_MAGIC_COOKIE 0x10 #define DLOAD_MAGIC_COOKIE 0x10
#define DLOAD_DISABLED 0x40
DECLARE_GLOBAL_DATA_PTR; DECLARE_GLOBAL_DATA_PTR;
struct sdhci_host mmc_host; struct sdhci_host mmc_host;
extern int ipq6018_edma_init(void *cfg); extern int ipq6018_edma_init(void *cfg);
@ -775,6 +776,16 @@ __weak int ipq_get_tz_version(char *version_name, int buf_size)
return 1; 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) int apps_iscrashed(void)
{ {
u32 *dmagic = (u32 *)CONFIG_IPQ6018_DMAGIC_ADDR; u32 *dmagic = (u32 *)CONFIG_IPQ6018_DMAGIC_ADDR;

View file

@ -361,6 +361,11 @@ __weak int apps_iscrashed(void)
return 0; return 0;
} }
__weak int apps_iscrashed_crashdump_disabled(void)
{
return 0;
}
void autoboot_command(const char *s) void autoboot_command(const char *s)
{ {
debug("### main_loop: bootcmd=\"%s\"\n", s ? s : "<UNDEFINED>"); debug("### main_loop: bootcmd=\"%s\"\n", s ? s : "<UNDEFINED>");
@ -392,6 +397,11 @@ void autoboot_command(const char *s)
} }
#endif #endif
if (apps_iscrashed_crashdump_disabled()) {
printf("Crashdump disabled, resetting the board..\n");
reset_board();
}
if (stored_bootdelay != -1 && s && !abortboot(stored_bootdelay)) { if (stored_bootdelay != -1 && s && !abortboot(stored_bootdelay)) {
#if defined(CONFIG_AUTOBOOT_KEYED) && !defined(CONFIG_AUTOBOOT_KEYED_CTRLC) #if defined(CONFIG_AUTOBOOT_KEYED) && !defined(CONFIG_AUTOBOOT_KEYED_CTRLC)
int prev = disable_ctrlc(1); /* disable Control C checking */ int prev = disable_ctrlc(1); /* disable Control C checking */