armv8: fsl-layerscape: make icid setup endianness aware
[oweals/u-boot.git] / arch / arm / mach-tegra / sys_info.c
index 5933c35ddd43e9b4242f33fc3d9952404d82088a..5dc998a52b24412628337cd7c16d2e4dcf027894 100644 (file)
@@ -1,30 +1,41 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * (C) Copyright 2010,2011
  * NVIDIA Corporation <www.nvidia.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #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;