Skip to contentSkip to conversation

ARM: imx: soc: Add reset for non-DM case

PATCH New Marek Vasut 3 participants 3 messages May 21, 2020 – Jun 23, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: imx: soc: Add reset for non-DM case

This is another in series of patches which remove ad-hoc reset_cpu() hacks from board files. This one is for iMX7, so implement default reset_cpu() there to prevent it from showing up in board files.

Cc Fabio Estevam <[email protected]>
Cc NXP i.MX U-Boot Team <[email protected]>
Cc Peng Fan <[email protected]>
Cc Stefano Babic <[email protected]>
---
 arch/arm/mach-imx/mx7/soc.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/arm/mach-imx/mx7/soc.c +13 -0
index 798fe74a3d..e7c71dfe8e 100644
@@ -18,6 +18,7 @@
 #include <env.h>
 #include <imx_thermal.h>
 #include <fsl_sec.h>
+#include <fsl_wdog.h>
 #include <asm/setup.h>
 #include <linux/delay.h>
 
@@ -419,3 +420,15 @@ void reset_misc(void)
 #endif
 }
 
+#if !CONFIG_IS_ENABLED(SYSRESET)
+void reset_cpu(ulong addr)
+{
+	struct watchdog_regs *wdog = (struct watchdog_regs *)WDOG1_BASE_ADDR;
+
+	/* Clear WDA to trigger WDOG_B immediately */
+	writew(SET_WCR_WT(1) | WCR_WDT | WCR_WDE | WCR_SRS, &wdog->wcr);
+
+	while (1)
+		;
+}
+#endif
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/1 ARM: imx: soc: Add reset for non-DM case

Hi Everybody,

CC Igor / Oleksandr from Toradex
Quoted 32 lines · Marek Vasut

This is another in series of patches which remove ad-hoc reset_cpu() hacks from board files. This one is for iMX7, so implement default reset_cpu() there to prevent it from showing up in board files.

Cc Fabio Estevam <[email protected]>
Cc NXP i.MX U-Boot Team <[email protected]>
Cc Peng Fan <[email protected]>
Cc Stefano Babic <[email protected]>
---
 arch/arm/mach-imx/mx7/soc.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/arm/mach-imx/mx7/soc.c +3 -0
index 798fe74a3d..e7c71dfe8e 100644
@@ -18,6 +18,7 @@
 #include <env.h>
 #include <imx_thermal.h>
 #include <fsl_sec.h>
+#include <fsl_wdog.h>
 #include <asm/setup.h>
 #include <linux/delay.h>
 
@@ -419,3 +420,15 @@ void reset_misc(void)
 #endif
 }
 
+#if !CONFIG_IS_ENABLED(SYSRESET)
+void reset_cpu(ulong addr)

arch/arm/mach-imx/mx7/soc.c void reset_misc(void) · line 434

Quoted 10 lines
arch/arm/mach-imx/mx7/soc.c +10 -0
+{
+	struct watchdog_regs *wdog = (struct watchdog_regs *)WDOG1_BASE_ADDR;
+
+	/* Clear WDA to trigger WDOG_B immediately */
+	writew(SET_WCR_WT(1) | WCR_WDT | WCR_WDE | WCR_SRS, &wdog->wcr);
+
+	while (1)
+		;
+}
+#endif

The patch is in the right direction, but rather this breaks Toradex's colibri i.MX7. However, reset should not coded in a board file and boards should enable DM PMIC and simply use the provide reset functionalities. Igor / Oleksandr, could you take a look at this ? I will let this patch for a while in stand-by.

Best regards,
Stefano

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#2 lore raw

PATCH 1/1 ARM: imx: soc: Add reset for non-DM case

Quoted 45 lines

Subject: Re: [PATCH] ARM: imx: soc: Add reset for non-DM case

Hi Everybody,

CC Igor / Oleksandr from Toradex
Quoted 9 lines · Marek Vasut

This is another in series of patches which remove ad-hoc reset_cpu() hacks from board files. This one is for iMX7, so implement default reset_cpu() there to prevent it from showing up in board files.

Cc Fabio Estevam <[email protected]>
Cc NXP i.MX U-Boot Team <[email protected]>
Cc Peng Fan <[email protected]>
Cc Stefano Babic <[email protected]>

Review

Quoted 5 lines
---
 arch/arm/mach-imx/mx7/soc.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
(quoted diff) +0 -0

b/arch/arm/mach-imx/mx7/soc.c

Quoted 12 lines

index 798fe74a3d..e7c71dfe8e 100644

arch/arm/mach-imx/mx7/soc.c +1 -0
@@ -18,6 +18,7 @@
 #include <env.h>
 #include <imx_thermal.h>
 #include <fsl_sec.h>
+#include <fsl_wdog.h>
 #include <asm/setup.h>
 #include <linux/delay.h>
 

arch/arm/mach-imx/mx7/soc.c void reset_misc(void) #endif } · line 428

Quoted 9 lines
arch/arm/mach-imx/mx7/soc.c +8 -0
@@ -419,3 +420,15 @@ void reset_misc(void)  #endif  }
 
+#if !CONFIG_IS_ENABLED(SYSRESET)
+void reset_cpu(ulong addr)
+{
+	struct watchdog_regs *wdog = (struct watchdog_regs
+*)WDOG1_BASE_ADDR;
+
+	/* Clear WDA to trigger WDOG_B immediately */
+	writew(SET_WCR_WT(1) | WCR_WDT | WCR_WDE | WCR_SRS,

&wdog->wcr);

Quoted 11 lines

arch/arm/mach-imx/mx7/soc.c void reset_misc(void)

Quoted 6 lines
arch/arm/mach-imx/mx7/soc.c +5 -0
+
+	while (1)
+		;
+}
+#endif
 

The patch is in the right direction, but rather this breaks Toradex's colibri i.MX7. However, reset should not coded in a board file and boards should enable DM PMIC and simply use the provide reset functionalities. Igor / Oleksandr, could you take a look at this ?

It might depends on internal warm reset or external pmic reset of the board choice. And better not enable both, because there might be contention.

Regards,
Peng.

I will let this patch for a while in

Quoted 13 lines

stand-by.

Best regards,
Stefano

--
==============================================================
=======
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
==============================================================
=======