diff mbox

[U-Boot] sun6i: cpu_reset: Do not return from cpu_reset()

Message ID 1434293919-19831-1-git-send-email-hdegoede@redhat.com
State Accepted
Delegated to: Hans de Goede
Headers show

Commit Message

Hans de Goede June 14, 2015, 2:58 p.m. UTC
Currently on sun6i after a "reset" the prompt returns and the user can
even type stuff until the watchdog triggers and does the actual reset.

This is somewhat unexpected behavior for the "reset" command, this
commit adds an endless loop to wait for the watchdog to trigger so that
we do not return to the prompt.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 arch/arm/cpu/armv7/sunxi/board.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Ian Campbell June 14, 2015, 5:21 p.m. UTC | #1
On Sun, 2015-06-14 at 16:58 +0200, Hans de Goede wrote:
> Currently on sun6i after a "reset" the prompt returns and the user can
> even type stuff until the watchdog triggers and does the actual reset.
> 
> This is somewhat unexpected behavior for the "reset" command,

It certainly is!

>  this
> commit adds an endless loop to wait for the watchdog to trigger so that
> we do not return to the prompt.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Acked-by: Ian Campbell <ijc@hellion.org.uk>

Might be worth throwing a cpu_relax or some such in there too?

> ---
>  arch/arm/cpu/armv7/sunxi/board.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm/cpu/armv7/sunxi/board.c b/arch/arm/cpu/armv7/sunxi/board.c
> index bd0d819..0fe641f 100644
> --- a/arch/arm/cpu/armv7/sunxi/board.c
> +++ b/arch/arm/cpu/armv7/sunxi/board.c
> @@ -220,6 +220,7 @@ void reset_cpu(ulong addr)
>  	writel(WDT_CFG_RESET, &wdog->cfg);
>  	writel(WDT_MODE_EN, &wdog->mode);
>  	writel(WDT_CTRL_KEY | WDT_CTRL_RESTART, &wdog->ctl);
> +	while (1) { }
>  #endif
>  }
>
diff mbox

Patch

diff --git a/arch/arm/cpu/armv7/sunxi/board.c b/arch/arm/cpu/armv7/sunxi/board.c
index bd0d819..0fe641f 100644
--- a/arch/arm/cpu/armv7/sunxi/board.c
+++ b/arch/arm/cpu/armv7/sunxi/board.c
@@ -220,6 +220,7 @@  void reset_cpu(ulong addr)
 	writel(WDT_CFG_RESET, &wdog->cfg);
 	writel(WDT_MODE_EN, &wdog->mode);
 	writel(WDT_CTRL_KEY | WDT_CTRL_RESTART, &wdog->ctl);
+	while (1) { }
 #endif
 }