All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Babic <sbabic@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] ARM: mx25: Print the source of reset
Date: Fri, 02 Sep 2011 09:50:08 +0200	[thread overview]
Message-ID: <4E608AB0.80402@denx.de> (raw)
In-Reply-To: <1314712450-571-2-git-send-email-fabio.estevam@freescale.com>

On 08/30/2011 03:54 PM, Fabio Estevam wrote:
> Print the source of reset during boot.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
>  arch/arm/cpu/arm926ejs/mx25/generic.c |   25 ++++++++++++++++++++++++-
>  1 files changed, 24 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/cpu/arm926ejs/mx25/generic.c b/arch/arm/cpu/arm926ejs/mx25/generic.c
> index a4e8c14..047e49d 100644
> --- a/arch/arm/cpu/arm926ejs/mx25/generic.c
> +++ b/arch/arm/cpu/arm926ejs/mx25/generic.c
> @@ -130,6 +130,28 @@ u32 get_cpu_rev(void)
>  	return system_rev;
>  }
>  
> +static char *get_reset_cause(void)
> +{
> +	/* read RCSR register from CCM module */
> +	struct ccm_regs *ccm =
> +		(struct ccm_regs *)IMX_CCM_BASE;
> +
> +	u32 cause = readl(&ccm->rcsr) & 0x0f;
> +
> +	switch (cause) {
> +	case 0x0000:
> +		return "POR";
> +	case 0x0001:
> +		return "RST";
> +	case 0x0002:
> +		return "WDOG";
> +	case 0x0006:
> +		return "JTAG";
> +	default:
> +		return "unknown reset";
> +	}
> +}

Can you help me interpreting the manual ? I see in MX25 RM:

REST
Reset status bits. Shows what caused the most recent reset to the
system.Otherwise, the last signal that
is released is honored.
0000 POR reset
0001 Reset In reset.
xx10 WDOG reset
x1x0 SOFT RESET
1xx0 JTAG SW RESET

The code for JTAG seems wrong, should be at 0x08. It sounds me odd that
some bits are not fixed. According to the manual, we should check the
single bits, becase for example a WDOG reset can be identified not only
by 0x02, but also by 0x06, 0x0a, 0x0E..

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================

  reply	other threads:[~2011-09-02  7:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-30 13:54 [U-Boot] [PATCH 1/2] ARM: mx25: Print the silicon revison Fabio Estevam
2011-08-30 13:54 ` [U-Boot] [PATCH 2/2] ARM: mx25: Print the source of reset Fabio Estevam
2011-09-02  7:50   ` Stefano Babic [this message]
2011-09-02  7:38 ` [U-Boot] [PATCH 1/2] ARM: mx25: Print the silicon revison 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=4E608AB0.80402@denx.de \
    --to=sbabic@denx.de \
    --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.