Hi Kever, On Sun, Jun 28, 2020 at 8:17 AM Kever Yang <kever.y...@rock-chips.com> wrote: > > HI Jagan, > > On 2020/6/18 下午11:39, Jagan Teki wrote: > > reset cause is a generic functionality based on the soc > > cru registers in rockchip. This can be used for printing > > the cause of reset in cpuinfo or some other place where > > reset cause is needed. > > > > Other than cpuinfo, reset cause can also be using during > > bootcount for checking the specific reset cause and glow > > the led based on the reset cause. > > > > So, let's separate the reset cause code from cpuinfo, and > > add a check to build it for rk3399, rk3288 since these two > > soc are supporting reset cause as of now. > > > > Signed-off-by: Jagan Teki <ja...@amarulasolutions.com> > > Tested-by: Suniel Mahesh <su...@amarulasolutions.com> > > --- > > Changes for v4: > > - none > > > > arch/arm/include/asm/arch-rockchip/cru.h | 2 ++ > > arch/arm/mach-rockchip/Makefile | 5 ++++- > > arch/arm/mach-rockchip/cpu-info.c | 20 ++++++++++++-------- > > 3 files changed, 18 insertions(+), 9 deletions(-) > > > > diff --git a/arch/arm/include/asm/arch-rockchip/cru.h > > b/arch/arm/include/asm/arch-rockchip/cru.h > > index 5eb17f9d55..317eb61049 100644 > > --- a/arch/arm/include/asm/arch-rockchip/cru.h > > +++ b/arch/arm/include/asm/arch-rockchip/cru.h > > @@ -31,4 +31,6 @@ enum { > > > > #define MHz 1000000 > > > > +char *get_reset_cause(void); > > Since you add a environment, you should use that instead of export > get_reset_cause().
Yes we can read reset_reason env in SPL but there is a fundamental issue with this, say the previous reset cause is RST so the env set to RST. For next power-on reset the reset_reason still shows RST since it was updated previously but the actual cause of the reset is POR. Jagan.