[U-Boot] [PATCH v1 11/21] display5: wdt: Enable WDT support (both SPL and u-boot)

Lukasz Majewski lukma at denx.de
Fri May 11 14:51:09 UTC 2018


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 at denx.de>
---

 board/liebherr/display5/spl.c      | 5 +++++
 configs/display5_defconfig         | 1 +
 configs/display5_factory_defconfig | 1 +
 include/configs/display5.h         | 5 +++++
 4 files changed, 12 insertions(+)

diff --git a/board/liebherr/display5/spl.c b/board/liebherr/display5/spl.c
index 551a14347d..5c6b8bff38 100644
--- a/board/liebherr/display5/spl.c
+++ b/board/liebherr/display5/spl.c
@@ -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);
 }
diff --git a/configs/display5_defconfig b/configs/display5_defconfig
index 81f329f259..03e56e9588 100644
--- a/configs/display5_defconfig
+++ b/configs/display5_defconfig
@@ -10,6 +10,7 @@ CONFIG_SPL_SERIAL_SUPPORT=y
 CONFIG_SPL_SPI_FLASH_SUPPORT=y
 CONFIG_SPL_SPI_SUPPORT=y
 CONFIG_SPL=y
+CONFIG_SPL_WATCHDOG_SUPPORT=y
 CONFIG_DEFAULT_DEVICE_TREE="imx6q-display5"
 CONFIG_FIT=y
 CONFIG_SPL_LOAD_FIT=y
diff --git a/configs/display5_factory_defconfig b/configs/display5_factory_defconfig
index d86e5f51e9..da736b2afa 100644
--- a/configs/display5_factory_defconfig
+++ b/configs/display5_factory_defconfig
@@ -9,6 +9,7 @@ CONFIG_SPL_SERIAL_SUPPORT=y
 CONFIG_SPL_SPI_FLASH_SUPPORT=y
 CONFIG_SPL_SPI_SUPPORT=y
 CONFIG_SPL=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"
diff --git a/include/configs/display5.h b/include/configs/display5.h
index 574e15eb1a..9e3c7f547b 100644
--- a/include/configs/display5.h
+++ b/include/configs/display5.h
@@ -389,6 +389,11 @@
 #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)
-- 
2.11.0



More information about the U-Boot mailing list