From: Dominik Sliwa Date: Thu, 1 Aug 2019 08:06:37 +0000 (+0300) Subject: apalis-tk1/t30: colibri_t30: display reset reason X-Git-Tag: v2019.10-rc2~10^2~4 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=fbcb9256549453b6e81a9a01ef6475b452c9f1ed;p=oweals%2Fu-boot.git apalis-tk1/t30: colibri_t30: display reset reason Display proper reset reason after the SoC info. Signed-off-by: Dominik Sliwa Signed-off-by: Igor Opaniuk Reviewed-by: Oleksandr Suvorov Signed-off-by: Tom Warren --- 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 #include +#if defined(CONFIG_TEGRA124) || defined(CONFIG_TEGRA30) +#include -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;