From: Alif Zakuan Yuslaimi <alif.zakuan.yusla...@altera.com>

Enable watchdog as early as possible after clock initialization
which is set at 10 seconds.

Signed-off-by: Alif Zakuan Yuslaimi <alif.zakuan.yusla...@altera.com>
---
 arch/arm/mach-socfpga/spl_agilex.c | 10 +++++++++-
 drivers/watchdog/Kconfig           |  2 +-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-socfpga/spl_agilex.c 
b/arch/arm/mach-socfpga/spl_agilex.c
index c2956264bc0..208085d4049 100644
--- a/arch/arm/mach-socfpga/spl_agilex.c
+++ b/arch/arm/mach-socfpga/spl_agilex.c
@@ -19,7 +19,7 @@
 #include <asm/arch/misc.h>
 #include <asm/arch/reset_manager.h>
 #include <asm/arch/system_manager.h>
-#include <watchdog.h>
+#include <wdt.h>
 #include <dm/uclass.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -83,6 +83,14 @@ void board_init_f(ulong dummy)
                hang();
        }
 
+       /*
+        * Enable watchdog as early as possible before initializing other
+        * component. Watchdog need to be enabled after clock driver because
+        * it will retrieve the clock frequency from clock driver.
+        */
+       if (CONFIG_IS_ENABLED(WDT))
+               initr_watchdog();
+
        preloader_console_init();
        print_reset_info();
        cm_print_clock_quick_summary();
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index e9ea874d0e3..985de714184 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -30,7 +30,7 @@ config WATCHDOG_TIMEOUT_MSECS
        default 128000 if ARCH_MX5 || ARCH_MX6
        default 128000 if ARCH_MX7 || ARCH_VF610
        default 30000 if ARCH_SNAPDRAGON
-       default 30000 if ARCH_SOCFPGA
+       default 10000 if ARCH_SOCFPGA
        default 16000 if ARCH_SUNXI
        default 5376 if ULP_WATCHDOG
        default 15000 if ARCH_BCM283X
-- 
2.35.3

Reply via email to