Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Tom Warren | 41b6838 | 2011-01-27 10:58:05 +0000 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2010,2011 |
| 4 | * NVIDIA Corporation <www.nvidia.com> |
Tom Warren | 41b6838 | 2011-01-27 10:58:05 +0000 | [diff] [blame] | 5 | */ |
| 6 | |
Simon Glass | 9758973 | 2020-05-10 11:40:02 -0600 | [diff] [blame] | 7 | #include <init.h> |
Tom Warren | 61c6d0e | 2012-12-11 13:34:15 +0000 | [diff] [blame] | 8 | #include <linux/ctype.h> |
Dominik Sliwa | 4e9c07f | 2019-08-01 11:06:37 +0300 | [diff] [blame] | 9 | #if defined(CONFIG_TEGRA124) || defined(CONFIG_TEGRA30) |
| 10 | #include <asm/arch-tegra/pmc.h> |
Tom Warren | 41b6838 | 2011-01-27 10:58:05 +0000 | [diff] [blame] | 11 | |
Dominik Sliwa | 4e9c07f | 2019-08-01 11:06:37 +0300 | [diff] [blame] | 12 | static char *get_reset_cause(void) |
Tom Warren | 61c6d0e | 2012-12-11 13:34:15 +0000 | [diff] [blame] | 13 | { |
Dominik Sliwa | 4e9c07f | 2019-08-01 11:06:37 +0300 | [diff] [blame] | 14 | struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE; |
| 15 | |
| 16 | switch (pmc->pmc_reset_status) { |
| 17 | case 0x00: |
| 18 | return "POR"; |
| 19 | case 0x01: |
| 20 | return "WATCHDOG"; |
| 21 | case 0x02: |
| 22 | return "SENSOR"; |
| 23 | case 0x03: |
| 24 | return "SW_MAIN"; |
| 25 | case 0x04: |
| 26 | return "LP0"; |
Tom Warren | 61c6d0e | 2012-12-11 13:34:15 +0000 | [diff] [blame] | 27 | } |
Dominik Sliwa | 4e9c07f | 2019-08-01 11:06:37 +0300 | [diff] [blame] | 28 | return "UNKNOWN"; |
Tom Warren | 61c6d0e | 2012-12-11 13:34:15 +0000 | [diff] [blame] | 29 | } |
Dominik Sliwa | 4e9c07f | 2019-08-01 11:06:37 +0300 | [diff] [blame] | 30 | #endif |
Tom Warren | 61c6d0e | 2012-12-11 13:34:15 +0000 | [diff] [blame] | 31 | |
Tom Warren | 41b6838 | 2011-01-27 10:58:05 +0000 | [diff] [blame] | 32 | /* Print CPU information */ |
| 33 | int print_cpuinfo(void) |
| 34 | { |
Dominik Sliwa | 4e9c07f | 2019-08-01 11:06:37 +0300 | [diff] [blame] | 35 | printf("SoC: %s\n", CONFIG_SYS_SOC); |
| 36 | #if defined(CONFIG_TEGRA124) || defined(CONFIG_TEGRA30) |
| 37 | printf("Reset cause: %s\n", get_reset_cause()); |
| 38 | #endif |
Tom Warren | 41b6838 | 2011-01-27 10:58:05 +0000 | [diff] [blame] | 39 | |
| 40 | /* TBD: Add printf of major/minor rev info, stepping, etc. */ |
| 41 | return 0; |
| 42 | } |