}
}
+/*
+ * Returns last reset reason:
+ * 1 -> reset by watchdog
+ * 0 -> normal reset
+ */
+int last_reset_wdt()
+{
+ u32 reg;
+
+ reg = qca_soc_reg_read(QCA_RST_WATCHDOG_TIMER_CTRL_REG);
+ if (reg & QCA_RST_WATCHDOG_TIMER_CTRL_LAST_MASK)
+ return 1;
+
+ return 0;
+}
+
/*
* Prints available information about the board
*/
bd_t *bd = gd->bd;
char buffer[24];
+ /* Show warning if last reboot was caused by SOC watchdog */
+ if (last_reset_wdt())
+ puts("** Warning: reset caused by watchdog!\n\n");
+
/* Board name */
printf("%" ALIGN_SIZE "s %s\n",
"BOARD:", MK_STR(CONFIG_BOARD_CUSTOM_STRING));
U_BOOT_CMD(ledon, 1, 1, do_ledon, "turn LED/s on\n", NULL);
U_BOOT_CMD(ledoff, 1, 1, do_ledoff, "turn LED/s off\n", NULL);
#endif /* CONFIG_CMD_LED */
+
+/*
+ * Checks if last reset was caused by watchdog
+ */
+#if defined(CONFIG_CMD_RSTBYWDT)
+int do_rstbywdt(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
+{
+ return !last_reset_wdt();
+}
+
+U_BOOT_CMD(rstbywdt, 1, 1, do_rstbywdt, "check if last reset was caused by watchdog\n", NULL);
+#endif /* CONFIG_CMD_RSTBYWDT */
int checkflash(void);
int checkdram(void);
int last_stage_init(void);
+int last_reset_wdt(void);
int reset_button_status(void);
extern ulong monitor_flash_len;