From: Dinesh Maniyam <[email protected]>

Enable watchdog before initializing other component (example: DDR).
Thus, watchdog need to be fully executed in onchip ram.

Signed-off-by: Dinesh Maniyam <[email protected]>
---
 arch/arm/mach-socfpga/spl_n5x.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-socfpga/spl_n5x.c b/arch/arm/mach-socfpga/spl_n5x.c
index 81283ef7162..22c20f89b4b 100644
--- a/arch/arm/mach-socfpga/spl_n5x.c
+++ b/arch/arm/mach-socfpga/spl_n5x.c
@@ -9,6 +9,7 @@
 #include <asm/arch/mailbox_s10.h>
 #include <asm/arch/misc.h>
 #include <asm/arch/reset_manager.h>
+#include <asm/arch/smmu_s10.h>
 #include <asm/arch/system_manager.h>
 #include <asm/global_data.h>
 #include <asm/io.h>
@@ -19,6 +20,7 @@
 #include <init.h>
 #include <spl.h>
 #include <watchdog.h>
+#include <wdt.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -37,13 +39,6 @@ void board_init_f(ulong dummy)
        writel(SYSMGR_WDDBG_PAUSE_ALL_CPU,
               socfpga_get_sysmgr_addr() + SYSMGR_SOC64_WDDBG);
 
-#ifdef CONFIG_HW_WATCHDOG
-       /* Enable watchdog before initializing the HW */
-       socfpga_per_reset(SOCFPGA_RESET(L4WD0), 1);
-       socfpga_per_reset(SOCFPGA_RESET(L4WD0), 0);
-       hw_watchdog_init();
-#endif
-
        /* ensure all processors are not released prior Linux boot */
        writeq(0, CPU_RELEASE_ADDR);
 
@@ -69,6 +64,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();
+
        print_reset_info();
        cm_print_clock_quick_summary();
 
-- 
2.43.7

Reply via email to