diff mbox series

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

Message ID 20200521231406.171674-1-marex@denx.de
State New
Delegated to: Stefano Babic
Headers show
Series ARM: imx: soc: Add reset for non-DM case | expand

Commit Message

Marek Vasut May 21, 2020, 11:14 p.m. UTC
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.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: NXP i.MX U-Boot Team <uboot-imx@nxp.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
---
 arch/arm/mach-imx/mx7/soc.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Stefano Babic June 23, 2020, 10:05 a.m. UTC | #1
Hi Everybody,

CC: Igor / Oleksandr from Toradex


On 22.05.20 01:14, Marek Vasut wrote:
> 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.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Fabio Estevam <festevam@gmail.com>
> Cc: NXP i.MX U-Boot Team <uboot-imx@nxp.com>
> Cc: Peng Fan <peng.fan@nxp.com>
> Cc: Stefano Babic <sbabic@denx.de>
> ---
>  arch/arm/mach-imx/mx7/soc.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/arch/arm/mach-imx/mx7/soc.c b/arch/arm/mach-imx/mx7/soc.c
> index 798fe74a3d..e7c71dfe8e 100644
> --- a/arch/arm/mach-imx/mx7/soc.c
> +++ b/arch/arm/mach-imx/mx7/soc.c
> @@ -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
> 

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
Peng Fan June 23, 2020, 11:56 a.m. UTC | #2
> Subject: Re: [PATCH] ARM: imx: soc: Add reset for non-DM case
> 
> Hi Everybody,
> 
> CC: Igor / Oleksandr from Toradex
> 
> 
> On 22.05.20 01:14, Marek Vasut wrote:
> > 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.
> >
> > Signed-off-by: Marek Vasut <marex@denx.de>
> > Cc: Fabio Estevam <festevam@gmail.com>
> > Cc: NXP i.MX U-Boot Team <uboot-imx@nxp.com>
> > Cc: Peng Fan <peng.fan@nxp.com>
> > Cc: Stefano Babic <sbabic@denx.de>
> > ---
> >  arch/arm/mach-imx/mx7/soc.c | 13 +++++++++++++
> >  1 file changed, 13 insertions(+)
> >
> > diff --git a/arch/arm/mach-imx/mx7/soc.c
> b/arch/arm/mach-imx/mx7/soc.c
> > index 798fe74a3d..e7c71dfe8e 100644
> > --- a/arch/arm/mach-imx/mx7/soc.c
> > +++ b/arch/arm/mach-imx/mx7/soc.c
> > @@ -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
> >
> 
> 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
> 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@denx.de
> ==============================================================
> =======
diff mbox series

Patch

diff --git a/arch/arm/mach-imx/mx7/soc.c b/arch/arm/mach-imx/mx7/soc.c
index 798fe74a3d..e7c71dfe8e 100644
--- a/arch/arm/mach-imx/mx7/soc.c
+++ b/arch/arm/mach-imx/mx7/soc.c
@@ -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