From fa65b0a9056baca4629f27cc056e8b202aa2da30 Mon Sep 17 00:00:00 2001 From: Ye Li Date: Mon, 20 Nov 2017 00:54:45 -0600 Subject: [PATCH] MLK-16903 imx8m: Add reset_cpu to use external WDOG_B for reset The WDT is enabled for WDOG in current u-boot reset, this cause external WDOG_B and internal WDOG_RESET_B_DEB both asserted for timeout. To avoid any unpredictable behavior, change to use the WDOG_B only. Signed-off-by: Ye Li Reviewed-by: Peng Fan --- arch/arm/cpu/armv8/imx8m/soc.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/arch/arm/cpu/armv8/imx8m/soc.c b/arch/arm/cpu/armv8/imx8m/soc.c index 8602c4a596..fdf7355ebd 100644 --- a/arch/arm/cpu/armv8/imx8m/soc.c +++ b/arch/arm/cpu/armv8/imx8m/soc.c @@ -14,6 +14,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -507,3 +508,17 @@ add_status: return ft_add_optee_node(blob, bd); } #endif + +void reset_cpu(ulong addr) +{ + struct watchdog_regs *wdog = (struct watchdog_regs *)WDOG1_BASE_ADDR; + + /* Clear WDA to trigger WDOG_B immediately */ + writew((WCR_WDE | WCR_SRS), &wdog->wcr); + + while (1) { + /* + * spin for .5 seconds before reset + */ + } +} -- 2.17.1