Message ID | 20190801080639.4706-8-igor.opaniuk@gmail.com |
---|---|
State | Superseded |
Delegated to: | Tom Warren |
Headers | show |
Series | apalis-tk1: fixes/updates for v2019.10 | expand |
On Thu, Aug 1, 2019 at 11:09 AM Igor Opaniuk <igor.opaniuk@gmail.com> wrote: > > From: Dominik Sliwa <dominik.sliwa@toradex.com> > > Display proper reset reason after the SoC info. > > Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com> > Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com> Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com> > --- > > arch/arm/mach-tegra/sys_info.c | 32 ++++++++++++++++++++++---------- > 1 file changed, 22 insertions(+), 10 deletions(-) > > diff --git a/arch/arm/mach-tegra/sys_info.c b/arch/arm/mach-tegra/sys_info.c > index 9975f33e0b..5dc998a52b 100644 > --- a/arch/arm/mach-tegra/sys_info.c > +++ b/arch/arm/mach-tegra/sys_info.c > @@ -6,24 +6,36 @@ > > #include <common.h> > #include <linux/ctype.h> > +#if defined(CONFIG_TEGRA124) || defined(CONFIG_TEGRA30) > +#include <asm/arch-tegra/pmc.h> > > -static void upstring(char *s) > +static char *get_reset_cause(void) > { > - while (*s) { > - *s = toupper(*s); > - s++; > + struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE; > + > + switch (pmc->pmc_reset_status) { > + case 0x00: > + return "POR"; > + case 0x01: > + return "WATCHDOG"; > + case 0x02: > + return "SENSOR"; > + case 0x03: > + return "SW_MAIN"; > + case 0x04: > + return "LP0"; > } > + return "UNKNOWN"; > } > +#endif > > /* Print CPU information */ > int print_cpuinfo(void) > { > - char soc_name[10]; > - > - strncpy(soc_name, CONFIG_SYS_SOC, 10); > - upstring(soc_name); > - puts(soc_name); > - puts("\n"); > + printf("SoC: %s\n", CONFIG_SYS_SOC); > +#if defined(CONFIG_TEGRA124) || defined(CONFIG_TEGRA30) > + printf("Reset cause: %s\n", get_reset_cause()); > +#endif > > /* TBD: Add printf of major/minor rev info, stepping, etc. */ > return 0; > -- > 2.17.1 > > _______________________________________________ > U-Boot mailing list > U-Boot@lists.denx.de > https://lists.denx.de/listinfo/u-boot
diff --git a/arch/arm/mach-tegra/sys_info.c b/arch/arm/mach-tegra/sys_info.c index 9975f33e0b..5dc998a52b 100644 --- a/arch/arm/mach-tegra/sys_info.c +++ b/arch/arm/mach-tegra/sys_info.c @@ -6,24 +6,36 @@ #include <common.h> #include <linux/ctype.h> +#if defined(CONFIG_TEGRA124) || defined(CONFIG_TEGRA30) +#include <asm/arch-tegra/pmc.h> -static void upstring(char *s) +static char *get_reset_cause(void) { - while (*s) { - *s = toupper(*s); - s++; + struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE; + + switch (pmc->pmc_reset_status) { + case 0x00: + return "POR"; + case 0x01: + return "WATCHDOG"; + case 0x02: + return "SENSOR"; + case 0x03: + return "SW_MAIN"; + case 0x04: + return "LP0"; } + return "UNKNOWN"; } +#endif /* Print CPU information */ int print_cpuinfo(void) { - char soc_name[10]; - - strncpy(soc_name, CONFIG_SYS_SOC, 10); - upstring(soc_name); - puts(soc_name); - puts("\n"); + printf("SoC: %s\n", CONFIG_SYS_SOC); +#if defined(CONFIG_TEGRA124) || defined(CONFIG_TEGRA30) + printf("Reset cause: %s\n", get_reset_cause()); +#endif /* TBD: Add printf of major/minor rev info, stepping, etc. */ return 0;