From: Troy Kisky <troy.kisky@boundarydevices.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] imx: save reset cause in 'reset_cause' environment variable
Date: Thu, 05 Feb 2015 16:06:56 -0700 [thread overview]
Message-ID: <54D3F790.6060605@boundarydevices.com> (raw)
In-Reply-To: <1423177107-16012-1-git-send-email-eric.nelson@boundarydevices.com>
On 2/5/2015 3:58 PM, Eric Nelson wrote:
> The cause of a reset is generally useful, and shouldn't be
> blindly cleared in the process of displaying it as a part
> of the boot announcement.
>
> Stash the string representation in the environment variable
> "reset_cause".
>
> Values include:
> "POR" - power on reset
> "CSU" - reset was the result of the csu_reset_b input
> "IPP-USER" - ipp_user_reset_b qualified reset
> "WDOG" - watchdog reset
> "JTAG-HIGH-Z" - HIGH-Z reset from JTAG
> "JTAG-SW" - software reset from JTAG
> "WARM-BOOT" - WARM boot was initiated by software
>
> Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com>
> ---
> arch/arm/imx-common/cpu.c | 25 ++++++++++++++++---------
> 1 file changed, 16 insertions(+), 9 deletions(-)
>
> diff --git a/arch/arm/imx-common/cpu.c b/arch/arm/imx-common/cpu.c
> index 28ccd29..4a54051 100644
> --- a/arch/arm/imx-common/cpu.c
> +++ b/arch/arm/imx-common/cpu.c
> @@ -28,6 +28,7 @@ char *get_reset_cause(void)
> {
> u32 cause;
> struct src *src_regs = (struct src *)SRC_BASE_ADDR;
> + char *rval = "unknown";
>
> cause = readl(&src_regs->srsr);
> writel(cause, &src_regs->srsr);
> @@ -35,22 +36,28 @@ char *get_reset_cause(void)
> switch (cause) {
> case 0x00001:
> case 0x00011:
> - return "POR";
> + rval = "POR";
> + break;
> case 0x00004:
> - return "CSU";
> + rval = "CSU";
> + break;
> case 0x00008:
> - return "IPP USER";
> + rval = "IPP-USER";
> + break;
> case 0x00010:
> - return "WDOG";
> + rval = "WDOG";
> + break;
> case 0x00020:
> - return "JTAG HIGH-Z";
> + rval = "JTAG-HIGH-Z";
> + break;
> case 0x00040:
> - return "JTAG SW";
> + rval = "JTAG-SW";
> + break;
> case 0x10000:
> - return "WARM BOOT";
> - default:
> - return "unknown reset";
> + rval = "WARM-BOOT";
Instead of removing default, can we have a hex value, something like
sprintf(buf, "unknown(0x%x)", cause);
> }
> + setenv("reset_cause", rval);
> + return rval;
> }
>
> #if defined(CONFIG_MX53) || defined(CONFIG_MX6)
>
next prev parent reply other threads:[~2015-02-05 23:06 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-04 21:51 [U-Boot] [PATCH] imx: don't clobber reset cause Eric Nelson
2015-02-05 16:17 ` Stefano Babic
2015-02-05 16:28 ` Bill Pringlemeir
2015-02-05 17:16 ` Eric Nelson
2015-02-05 17:19 ` Stefano Babic
2015-02-05 17:22 ` Eric Nelson
2015-02-05 17:52 ` Stefano Babic
2015-02-05 18:22 ` Eric Nelson
2015-02-05 18:49 ` Stefano Babic
2015-02-05 22:57 ` [U-Boot] [PATCH] imx: save reset cause in 'reset_cause' environment variable Eric Nelson
2015-02-06 20:36 ` Eric Nelson
2015-02-05 22:58 ` Eric Nelson
2015-02-05 23:06 ` Troy Kisky [this message]
2015-02-05 23:14 ` Eric Nelson
2015-02-05 23:17 ` Bill Pringlemeir
2015-02-06 20:40 ` Eric Nelson
2015-02-06 20:56 ` Bill Pringlemeir
2015-02-05 23:01 ` [U-Boot] [PATCH] imx: don't clobber reset cause Eric Nelson
2015-02-05 23:17 ` Troy Kisky
2015-02-10 17:19 ` Eric Nelson
2015-02-10 18:08 ` Bill Pringlemeir
2015-02-11 9:07 ` Stefano Babic
2015-02-11 14:45 ` Eric Nelson
2015-02-15 21:37 ` [U-Boot] [PATCH 1/2] ARM: i.MX: provide access to reset cause through get_imx_reset_cause() Eric Nelson
2015-02-15 21:37 ` [U-Boot] [PATCH 2/2] nitrogen6x: set environment variable reset_cause Eric Nelson
2015-02-17 9:34 ` Stefano Babic
2015-02-17 9:54 ` Stefano Babic
2015-02-17 9:54 ` [U-Boot] [PATCH 1/2] ARM: i.MX: provide access to reset cause through get_imx_reset_cause() Stefano Babic
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=54D3F790.6060605@boundarydevices.com \
--to=troy.kisky@boundarydevices.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox