diff mbox series

[3/3] imx: imx8m: Don't use the addr parameter of reset_cpu

Message ID b31a2cbb66950bff2e09ab07b710d53d9d46cf09.1583328917.git.hws@denx.de
State New
Headers show
Series ARM: Fix reset in SPL if SYSRESET is not used | expand

Commit Message

Harald Seiler March 4, 2020, 2:23 p.m. UTC
From: Claudius Heine <ch at denx.de>

imx8m has the only implementation of `reset_cpu` which does not ignore
the addr parameter and instead gives it some meaning as the base address
of watchdog registers.  This breaks convention with the rest of U-Boot
where the parameter is ignored and callers are passing in 0.

Fixes: d2041725e84b ("imx8m: restrict reset_cpu")
Co-Authored-by: Harald Seiler <hws at denx.de>
Signed-off-by: Claudius Heine <ch at denx.de>
Signed-off-by: Harald Seiler <hws at denx.de>
---
 arch/arm/mach-imx/imx8m/soc.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Marek Vasut March 4, 2020, 2:30 p.m. UTC | #1
On 3/4/20 3:23 PM, Harald Seiler wrote:
> From: Claudius Heine <ch at denx.de>
> 
> imx8m has the only implementation of `reset_cpu` which does not ignore
> the addr parameter and instead gives it some meaning as the base address
> of watchdog registers.  This breaks convention with the rest of U-Boot
> where the parameter is ignored and callers are passing in 0.
> 
> Fixes: d2041725e84b ("imx8m: restrict reset_cpu")
> Co-Authored-by: Harald Seiler <hws at denx.de>
> Signed-off-by: Claudius Heine <ch at denx.de>
> Signed-off-by: Harald Seiler <hws at denx.de>
> ---
>  arch/arm/mach-imx/imx8m/soc.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c
> index 7fcbd53f3020..2d3afc61a452 100644
> --- a/arch/arm/mach-imx/imx8m/soc.c
> +++ b/arch/arm/mach-imx/imx8m/soc.c
> @@ -385,10 +385,7 @@ int ft_system_setup(void *blob, bd_t *bd)
>  #if defined(CONFIG_SPL_BUILD) || !defined(CONFIG_SYSRESET)
>  void reset_cpu(ulong addr)
>  {
> -       struct watchdog_regs *wdog = (struct watchdog_regs *)addr;
> -
> -       if (!addr)
> -	       wdog = (struct watchdog_regs *)WDOG1_BASE_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);

Can't we remove the param altogether ?

Otherwise
Reviewed-by: Marek Vasut <marex at denx.de>
Harald Seiler March 4, 2020, 2:35 p.m. UTC | #2
Hello Marek,

On Wed, 2020-03-04 at 15:30 +0100, Marek Vasut wrote:
> On 3/4/20 3:23 PM, Harald Seiler wrote:
> > From: Claudius Heine <ch at denx.de>
> > 
> > imx8m has the only implementation of `reset_cpu` which does not ignore
> > the addr parameter and instead gives it some meaning as the base address
> > of watchdog registers.  This breaks convention with the rest of U-Boot
> > where the parameter is ignored and callers are passing in 0.
> > 
> > Fixes: d2041725e84b ("imx8m: restrict reset_cpu")
> > Co-Authored-by: Harald Seiler <hws at denx.de>
> > Signed-off-by: Claudius Heine <ch at denx.de>
> > Signed-off-by: Harald Seiler <hws at denx.de>
> > ---
> >  arch/arm/mach-imx/imx8m/soc.c | 5 +----
> >  1 file changed, 1 insertion(+), 4 deletions(-)
> > 
> > diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c
> > index 7fcbd53f3020..2d3afc61a452 100644
> > --- a/arch/arm/mach-imx/imx8m/soc.c
> > +++ b/arch/arm/mach-imx/imx8m/soc.c
> > @@ -385,10 +385,7 @@ int ft_system_setup(void *blob, bd_t *bd)
> >  #if defined(CONFIG_SPL_BUILD) || !defined(CONFIG_SYSRESET)
> >  void reset_cpu(ulong addr)
> >  {
> > -       struct watchdog_regs *wdog = (struct watchdog_regs *)addr;
> > -
> > -       if (!addr)
> > -	       wdog = (struct watchdog_regs *)WDOG1_BASE_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);
> 
> Can't we remove the param altogether ?

Yes, that is what I would suggest as well.  Although I'd do that as
a separate follow up because it is not ARM nor i.MX specific.

> Otherwise
> Reviewed-by: Marek Vasut <marex at denx.de>
Stefano Babic May 1, 2020, 4:32 p.m. UTC | #3
> From: Claudius Heine <ch at denx.de>
> imx8m has the only implementation of `reset_cpu` which does not ignore
> the addr parameter and instead gives it some meaning as the base address
> of watchdog registers.  This breaks convention with the rest of U-Boot
> where the parameter is ignored and callers are passing in 0.
> Fixes: d2041725e84b ("imx8m: restrict reset_cpu")
> Co-Authored-by: Harald Seiler <hws at denx.de>
> Signed-off-by: Claudius Heine <ch at denx.de>
> Signed-off-by: Harald Seiler <hws at denx.de>
> Reviewed-by: Marek Vasut <marex at denx.de>
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c
index 7fcbd53f3020..2d3afc61a452 100644
--- a/arch/arm/mach-imx/imx8m/soc.c
+++ b/arch/arm/mach-imx/imx8m/soc.c
@@ -385,10 +385,7 @@  int ft_system_setup(void *blob, bd_t *bd)
 #if defined(CONFIG_SPL_BUILD) || !defined(CONFIG_SYSRESET)
 void reset_cpu(ulong addr)
 {
-       struct watchdog_regs *wdog = (struct watchdog_regs *)addr;
-
-       if (!addr)
-	       wdog = (struct watchdog_regs *)WDOG1_BASE_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);