[U-Boot] [PATCH] imx: save reset cause in 'reset_cause' environment variable

Eric Nelson eric.nelson at boundarydevices.com
Fri Feb 6 21:40:53 CET 2015


Hi all,

On 02/05/2015 03: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.
> 
> <snip>
> 
> 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);
> <snip>
>
>  	}
> +	setenv("reset_cause", rval);
> +	return rval;

Nak.

This routine is called before the environment is initialized.

There's no way to set the environment here, which I think
means that this patch is a pre-cursor to anything else.

	http://patchwork.ozlabs.org/patch/436492/
	
If we feel the need to reset it before an O/S boots, there is a common
spot here:
	http://git.denx.de/?p=u-boot.git;a=blob;f=arch/arm/imx-common/cpu.c;h=28ccd29594ed77976f45837039e40618e527a94f;hb=HEAD#l205

That won't be invoked if the O/S is started with "go" though
(often done with QNX or Windows).

Regards,


Eric


More information about the U-Boot mailing list