diff mbox series

[3/8] ARM: imx8m: Don't use the addr parameter of reset_cpu()

Message ID 20200429130428.124788-4-hws@denx.de
State New
Headers show
Series ARM: imx: Fix reset in SPL | expand

Commit Message

Harald Seiler April 29, 2020, 1:04 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-developed-by: Harald Seiler <hws at denx.de>
Signed-off-by: Harald Seiler <hws at denx.de>
Signed-off-by: Claudius Heine <ch at denx.de>
---
 arch/arm/mach-imx/imx8m/soc.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Fabio Estevam April 29, 2020, 1:14 p.m. UTC | #1
Hi Harald,

On Wed, Apr 29, 2020 at 10:04 AM Harald Seiler <hws at denx.de> 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

Unrelated to this patch, but maybe the reset_cpu() function should
change its parameter from addr to void instead?
Harald Seiler April 29, 2020, 1:19 p.m. UTC | #2
Hello Fabio,

On Wed, 2020-04-29 at 10:14 -0300, Fabio Estevam wrote:
> Hi Harald,
> 
> On Wed, Apr 29, 2020 at 10:04 AM Harald Seiler <hws at denx.de> 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
> 
> Unrelated to this patch, but maybe the reset_cpu() function should
> change its parameter from addr to void instead?

Yes!  I have already prepared a patchset for that but as the parameter is
still used here I could not send that yet.

The parameter was introduces back in the days because some weird
architecture needed the reset-vector address to perform a soft reset.
This is a long-gone platform and this parameter is thus no longer
necessary.

Regards,
Stefano Babic May 1, 2020, 4:31 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-developed-by: Harald Seiler <hws at denx.de>
> Signed-off-by: Harald Seiler <hws at denx.de>
> Signed-off-by: Claudius Heine <ch 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 5b3fbe712c6b..2fe1fa75fb05 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 !CONFIG_IS_ENABLED(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);