Message ID | 1423177068-15958-1-git-send-email-eric.nelson@boundarydevices.com |
---|---|
State | Not Applicable |
Delegated to: | Stefano Babic |
Headers | show |
Hi all, On 02/05/2015 03:57 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". > > > <snip> > > Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com> > --- > arch/arm/imx-common/cpu.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/arch/arm/imx-common/cpu.c b/arch/arm/imx-common/cpu.c > index 28ccd29..31d6e61 100644 > --- a/arch/arm/imx-common/cpu.c > +++ b/arch/arm/imx-common/cpu.c > @@ -32,6 +32,8 @@ char *get_reset_cause(void) > cause = readl(&src_regs->srsr); > writel(cause, &src_regs->srsr); > > + setenv_hex("reset_cause", cause); > + Nak. This routine is called before the environment is initialized.
diff --git a/arch/arm/imx-common/cpu.c b/arch/arm/imx-common/cpu.c index 28ccd29..31d6e61 100644 --- a/arch/arm/imx-common/cpu.c +++ b/arch/arm/imx-common/cpu.c @@ -32,6 +32,8 @@ char *get_reset_cause(void) cause = readl(&src_regs->srsr); writel(cause, &src_regs->srsr); + setenv_hex("reset_cause", cause); + switch (cause) { case 0x00001: case 0x00011:
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". The value is stored in hex, and the values may vary with new silicon. As of this reading the following bitfields are common to at least i.MX5 and i.MX6 processors: bit meaning --- ------- 0 reset pin or power-on 2 reset from csu_reset_b input 3 reset from ipp_user_reset_b 4 watchdog reset 5 JTAG High-Z requested reset 6 JTAG software reset 16 Warm boot: result of a software initiated boot Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com> --- arch/arm/imx-common/cpu.c | 2 ++ 1 file changed, 2 insertions(+)