Merge tag 'u-boot-atmel-fixes-2020.07-a' of https://gitlab.denx.de/u-boot/custodians...
[oweals/u-boot.git] / arch / arm / mach-tegra / sys_info.c
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * (C) Copyright 2010,2011
4  * NVIDIA Corporation <www.nvidia.com>
5  */
6
7 #include <common.h>
8 #include <init.h>
9 #include <linux/ctype.h>
10 #if defined(CONFIG_TEGRA124) || defined(CONFIG_TEGRA30)
11 #include <asm/arch-tegra/pmc.h>
12
13 static char *get_reset_cause(void)
14 {
15         struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;
16
17         switch (pmc->pmc_reset_status) {
18         case 0x00:
19                 return "POR";
20         case 0x01:
21                 return "WATCHDOG";
22         case 0x02:
23                 return "SENSOR";
24         case 0x03:
25                 return "SW_MAIN";
26         case 0x04:
27                 return "LP0";
28         }
29         return "UNKNOWN";
30 }
31 #endif
32
33 /* Print CPU information */
34 int print_cpuinfo(void)
35 {
36         printf("SoC: %s\n", CONFIG_SYS_SOC);
37 #if defined(CONFIG_TEGRA124) || defined(CONFIG_TEGRA30)
38         printf("Reset cause: %s\n", get_reset_cause());
39 #endif
40
41         /* TBD: Add printf of major/minor rev info, stepping, etc. */
42         return 0;
43 }