imx8m: restrict reset_cpu
authorPeng Fan <peng.fan@nxp.com>
Tue, 27 Aug 2019 06:25:41 +0000 (06:25 +0000)
committerStefano Babic <sbabic@denx.de>
Tue, 8 Oct 2019 14:36:36 +0000 (16:36 +0200)
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

index ac80266010d21346e9e5ef990f9e3e194b1db637..3a54db48980c69729a90310db3e43ce7d5a50a86 100644 (file)
@@ -301,16 +301,21 @@ int ft_system_setup(void *blob, bd_t *bd)
 }
 #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