diff mbox

[U-Boot,v2,5/5] sunxi: Fix reset hang on sun5i

Message ID 1402692952-24296-6-git-send-email-hdegoede@redhat.com
State Accepted
Delegated to: Ian Campbell
Headers show

Commit Message

Hans de Goede June 13, 2014, 8:55 p.m. UTC
Do the same as the Linux kernel does, this fixes the SoC hanging on reset
about 50% of the time.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
---
 arch/arm/cpu/armv7/sunxi/board.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Siarhei Siamashka July 23, 2014, 6:59 p.m. UTC | #1
On Fri, 13 Jun 2014 22:55:52 +0200
Hans de Goede <hdegoede@redhat.com> wrote:

> Do the same as the Linux kernel does, this fixes the SoC hanging on reset
> about 50% of the time.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> Acked-by: Ian Campbell <ijc@hellion.org.uk>
> ---
>  arch/arm/cpu/armv7/sunxi/board.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/cpu/armv7/sunxi/board.c b/arch/arm/cpu/armv7/sunxi/board.c
> index 024c8c1..2898833 100644
> --- a/arch/arm/cpu/armv7/sunxi/board.c
> +++ b/arch/arm/cpu/armv7/sunxi/board.c
> @@ -75,7 +75,11 @@ void reset_cpu(ulong addr)
>  	/* Set the watchdog for its shortest interval (.5s) and wait */
>  	writel(WDT_MODE_RESET_EN | WDT_MODE_EN, &wdog->mode);
>  	writel(WDT_CTRL_KEY | WDT_CTRL_RESTART, &wdog->ctl);
> -	while (1);
> +
> +	while (1) {
> +		/* sun5i sometimes gets stuck without this */
> +		writel(WDT_MODE_RESET_EN | WDT_MODE_EN, &wdog->mode);
> +	}
>  }
>  
>  /* do some early init */

This should be perhaps combined with
   http://patchwork.ozlabs.org/patch/357363/ (probably the best place)
or
   http://patchwork.ozlabs.org/patch/357365/ (ugh, too much code there)

in order to have bug free code after every commit instead of fixing
the problem after the fact.
diff mbox

Patch

diff --git a/arch/arm/cpu/armv7/sunxi/board.c b/arch/arm/cpu/armv7/sunxi/board.c
index 024c8c1..2898833 100644
--- a/arch/arm/cpu/armv7/sunxi/board.c
+++ b/arch/arm/cpu/armv7/sunxi/board.c
@@ -75,7 +75,11 @@  void reset_cpu(ulong addr)
 	/* Set the watchdog for its shortest interval (.5s) and wait */
 	writel(WDT_MODE_RESET_EN | WDT_MODE_EN, &wdog->mode);
 	writel(WDT_CTRL_KEY | WDT_CTRL_RESTART, &wdog->ctl);
-	while (1);
+
+	while (1) {
+		/* sun5i sometimes gets stuck without this */
+		writel(WDT_MODE_RESET_EN | WDT_MODE_EN, &wdog->mode);
+	}
 }
 
 /* do some early init */