From bbdcc113e25db6bd536e1a859f1e3c5371e84ce8 Mon Sep 17 00:00:00 2001
From: Peng Fan <peng.fan@nxp.com>
Date: Tue, 27 Aug 2019 06:25:41 +0000
Subject: [PATCH] imx8m: restrict reset_cpu

Make reset_cpu only visible when CONFIG_SYSRESET not defined
or CONFIG_SPL_BUILD.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 arch/arm/mach-imx/imx8m/soc.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c
index 167ff4b6d63..aa48d159fa4 100644
--- a/arch/arm/mach-imx/imx8m/soc.c
+++ b/arch/arm/mach-imx/imx8m/soc.c
@@ -471,19 +471,24 @@ usb_modify_speed:
 }
 #endif
 
+#if defined(CONFIG_SPL_BUILD) || !defined(CONFIG_SYSRESET)
 void reset_cpu(ulong addr)
 {
-	struct watchdog_regs *wdog = (struct watchdog_regs *)WDOG1_BASE_ADDR;
+       struct watchdog_regs *wdog = (struct watchdog_regs *)addr;
 
-	/* Clear WDA to trigger WDOG_B immediately */
-	writew((WCR_WDE | WCR_SRS), &wdog->wcr);
+       if (!addr)
+	       wdog = (struct watchdog_regs *)WDOG1_BASE_ADDR;
 
-	while (1) {
-		/*
-		 * spin for .5 seconds before reset
-		 */
-	}
+       /* Clear WDA to trigger WDOG_B immediately */
+       writew((WCR_WDE | WCR_SRS), &wdog->wcr);
+
+       while (1) {
+               /*
+                * spin for .5 seconds before reset
+                */
+       }
 }
+#endif
 
 #if defined(CONFIG_ARCH_MISC_INIT)
 #define FSL_SIP_BUILDINFO			0xC2000003
-- 
GitLab