[U-Boot] [PATCH] imx: don't clobber reset cause

Eric Nelson
2015-02-10T17:19:07Z

Hi Stefano,

On 02/05/2015 11:49 AM, Stefano Babic wrote:
> Hi Eric,
>
> On 05/02/2015 19:22, Eric Nelson wrote:
>
>>
>> Certainly, but it seems wrong to make a decision about where and how
>> this might get passed to an O/S in code.
>>
>> If we want to generalize it, I'd be inclined to add commands to
>> query (into a variable) and clear the reset cause.
>>
>> That would still require this patch though.
>
> I do not think there should be a command. The cause must be directly
> associated to the variable, and the reset cause cleared.
>

I posted a couple of additional options and received no comment
from you.

Neither of them works as-is because of the ordering of events
(print_cpuinfo() is called before restoring the environment),
so your suggestion would require an additional call at startup
which currently doesn't exist across i.MX boards.

The primary argument against the original patch was that
bits **could** accumulate. In practice, I believe this to
be a bit of a red herring, since two bits cover essentially
all of the normal conditions:

bit 0 - power on
bit 4 - watchdog

The watchdog flag is set with reboot under Linux and reset
in U-Boot, so we could re-work the switch statement to do
the right thing. In fact, it appears broken now because it
has 0x11 displaying "POR", when I believe that should be
"WDOG".

Other bits could conceivably accumulate, but I don't see
the value of worrying about cases like "JTAG_RESET".

The reason we're pursuing this at all is because we'd like
to know the difference between a restart caused by power
interruption and a system lockup, and we'd like to do
this under Linux or Windows Embedded.

Without a patch, things are pretty much broken unless we're
screen-scraping.

Please advise,

Eric