From: Sinan Akman <sinan@writeme.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] ls102xa: Fix reset hang
Date: Fri, 2 Oct 2015 10:21:11 -0400 [thread overview]
Message-ID: <560E92D7.80808@writeme.com> (raw)
In-Reply-To: <1443792315-18997-1-git-send-email-festevam@gmail.com>
Hi Fabio
On 02/10/15 09:25 AM, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
>
> Since commit 623d96e89aca6("imx: wdog: correct wcr register settings")
> issuing a 'reset' command causes the system to hang.
>
> Unlike i.MX and Vybrid, the watchdog controller on LS102x is big-endian.
>
> This means that the watchdog on LS1021 has been working by accident as
> it does not use the big-endian accessors in drivers/watchdog/imx_watchdog.c.
> Commit 623d96e89aca6("imx: wdog: correct wcr register settings") only
> revelead the endianness problem on LS102x.
>
> In order to fix the reset hang, introduce a reset_cpu() implementation that
> is specific for ls102x, which accesses the watchdog WCR register in big-endian
> format. All that is required to reset LS102x is to clear the SRS bit.
>
> Reported-by: Sinan Akman <sinan@writeme.com>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
> arch/arm/cpu/armv7/ls102xa/cpu.c | 21 +++++++++++++++++++++
> drivers/watchdog/Makefile | 2 +-
> 2 files changed, 22 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/cpu/armv7/ls102xa/cpu.c b/arch/arm/cpu/armv7/ls102xa/cpu.c
> index 8dd95d9..0de6f19 100644
> --- a/arch/arm/cpu/armv7/ls102xa/cpu.c
> +++ b/arch/arm/cpu/armv7/ls102xa/cpu.c
> @@ -13,6 +13,7 @@
> #include <tsec.h>
> #include <netdev.h>
> #include <fsl_esdhc.h>
> +#include <config.h>
>
> #include "fsl_epu.h"
>
> @@ -354,3 +355,23 @@ void smp_kick_all_cpus(void)
> asm volatile("sev");
> }
> #endif
> +
> +struct watchdog_regs {
> + u16 wcr; /* Control */
> + u16 wsr; /* Service */
> + u16 wrsr; /* Reset Status */
> +};
> +
> +#define WCR_SRS (1 << 4)
> +void reset_cpu(ulong addr)
> +{
> + struct watchdog_regs *wdog = (struct watchdog_regs *)WDOG1_BASE_ADDR;
> +
> + clrbits_be16(&wdog->wcr, WCR_SRS);
> +
> + while (1) {
> + /*
> + * Let the watchdog trigger
> + */
> + }
> +}
> diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
> index 9e9cb55..a007ae8 100644
> --- a/drivers/watchdog/Makefile
> +++ b/drivers/watchdog/Makefile
> @@ -7,7 +7,7 @@
>
> obj-$(CONFIG_AT91SAM9_WATCHDOG) += at91sam9_wdt.o
> obj-$(CONFIG_FTWDT010_WATCHDOG) += ftwdt010_wdt.o
> -ifneq (,$(filter $(SOC), mx31 mx35 mx5 mx6 mx7 vf610 ls102xa))
> +ifneq (,$(filter $(SOC), mx31 mx35 mx5 mx6 mx7 vf610))
> obj-y += imx_watchdog.o
> endif
> obj-$(CONFIG_S5P) += s5p_wdt.o
Tested-by: Sinan Akman <sinan@writeme.com>
Regards
Sinan Akman
next prev parent reply other threads:[~2015-10-02 14:21 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-02 13:25 [U-Boot] [PATCH] ls102xa: Fix reset hang Fabio Estevam
2015-10-02 14:21 ` Sinan Akman [this message]
2015-10-02 14:34 ` Fabio Estevam
2015-10-02 14:55 ` Sinan Akman
2015-10-02 14:42 ` Wolfgang Denk
2015-10-02 14:51 ` Sinan Akman
2015-10-02 15:00 ` Fabio Estevam
2015-10-03 15:18 ` Tom Rini
2015-10-07 21:43 ` Fabio Estevam
2015-10-07 21:45 ` York Sun
2015-10-07 21:47 ` Fabio Estevam
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=560E92D7.80808@writeme.com \
--to=sinan@writeme.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.