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

Eric Nelson
2015-02-05T23:14:28Z

Hi Troy,

On 02/05/2015 04:06 PM, Troy Kisky wrote:
> 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
>>
>> <snip>
>>
>> switch (cause) {
>> case 0x00001:
>> case 0x00011:
>> - return "POR";
>> + rval = "POR";
>> + break;
>>
>> <snip>
>>
>> - 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);
>

Of course (if we go that route).

I thought of this when typing up the list of values for the
commit comment.

The human readable form is harder to handle on the receiving
side though, which is why I favor hex.

Regards,

Eric