display5: wdt: Enable WDT support (both SPL and u-boot)
authorLukasz Majewski <lukma@denx.de>
Fri, 11 May 2018 14:51:09 +0000 (16:51 +0200)
committerStefano Babic <sbabic@denx.de>
Mon, 18 Jun 2018 13:44:21 +0000 (15:44 +0200)
Test case:

The fitImage gets corrupted:

truncate -c -s 3M fitImage
run tftp_mmc_fitImg
setenv boot_os y
reset

[board shall hang in SPL with
"Trying to boot from MMC1" information]

Then after X seconds WDT is causing board to reset. After N boot attempts
we enter recovery mode.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
board/liebherr/display5/spl.c
configs/display5_defconfig
configs/display5_factory_defconfig
include/configs/display5.h

index 551a14347da6c47b2b33c6fccbe94d33f70ed190..5c6b8bff38acde9d32fdf3b3aa9cfafa8886c840 100644 (file)
@@ -21,6 +21,7 @@
 #include <fsl_esdhc.h>
 #include <netdev.h>
 #include <bootcount.h>
+#include <watchdog.h>
 #include "common.h"
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -197,6 +198,10 @@ void board_init_f(ulong dummy)
 
        displ5_set_iomux_misc_spl();
 
+       /* Initialize and reset WDT in SPL */
+       hw_watchdog_init();
+       WATCHDOG_RESET();
+
        /* load/boot image from boot device */
        board_init_r(NULL, 0);
 }
index 04671abfebbc1d85c5d32c8a76a0576d4401c5d7..aaf8529628dc1ae7c2f1e930e5a3979c3dc0fed3 100644 (file)
@@ -10,6 +10,7 @@ CONFIG_SPL_SERIAL_SUPPORT=y
 CONFIG_SPL=y
 CONFIG_SPL_SPI_FLASH_SUPPORT=y
 CONFIG_SPL_SPI_SUPPORT=y
+CONFIG_SPL_WATCHDOG_SUPPORT=y
 CONFIG_DEFAULT_DEVICE_TREE="imx6q-display5"
 CONFIG_FIT=y
 CONFIG_SPL_LOAD_FIT=y
index e23948b932afc3b02df435d04d73f7638031d8a7..14df849fb7d87bc240b7345fc3c0739e9aa2eb84 100644 (file)
@@ -9,6 +9,7 @@ CONFIG_SPL_SERIAL_SUPPORT=y
 CONFIG_SPL=y
 CONFIG_SPL_SPI_FLASH_SUPPORT=y
 CONFIG_SPL_SPI_SUPPORT=y
+CONFIG_SPL_WATCHDOG_SUPPORT=y
 CONFIG_FIT=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg,MX6Q"
index c4cd2ff6f9c225a355298211af18201ba8d10772..929741dedd71bd6309c2b4fea6a708d8f83eecde 100644 (file)
 #define CONFIG_MTD_PARTITIONS
 #define CONFIG_MTD_DEVICE
 
+/* Watchdog */
+#define CONFIG_HW_WATCHDOG
+#define CONFIG_IMX_WATCHDOG
+#define CONFIG_WATCHDOG_TIMEOUT_MSECS   15000
+
 /* ENV config */
 #ifdef CONFIG_ENV_IS_IN_SPI_FLASH
 #define CONFIG_ENV_SIZE                (SZ_64K)