public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Igor Opaniuk <igor.opaniuk@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 07/10] apalis-tk1/t30: colibri_t30: display reset reason
Date: Mon,  5 Aug 2019 18:20:44 +0300	[thread overview]
Message-ID: <20190805152047.30405-8-igor.opaniuk@gmail.com> (raw)
In-Reply-To: <20190805152047.30405-1-igor.opaniuk@gmail.com>

From: Dominik Sliwa <dominik.sliwa@toradex.com>

Display proper reset reason after the SoC info.

Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Signed-off-by: Igor Opaniuk <igor.opaniuk@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

  parent reply	other threads:[~2019-08-05 15:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-05 15:20 [U-Boot] [PATCH v3 00/10] apalis-tk1: fixes/updates for v2019.10 Igor Opaniuk
2019-08-05 15:20 ` [U-Boot] [PATCH v3 01/10] apalis-tk1: do not explicitly release reset_moci# Igor Opaniuk
2019-08-05 15:20 ` [U-Boot] [PATCH v3 02/10] apalis-tk1: set apalis gpio 8 aka fan_en Igor Opaniuk
2019-08-05 15:20 ` [U-Boot] [PATCH v3 03/10] apalis-tk1: provide proper USB vendor id Igor Opaniuk
2019-08-05 15:20 ` [U-Boot] [PATCH v3 04/10] apalis-tk1: enable user debug by default Igor Opaniuk
2019-08-05 15:20 ` [U-Boot] [PATCH v3 05/10] apalis-tk1: add pcie_aspm=off to defargs Igor Opaniuk
2019-08-05 15:20 ` [U-Boot] [PATCH v3 06/10] apalis-tk1: switch to zImage Igor Opaniuk
2019-08-05 15:20 ` Igor Opaniuk [this message]
2019-08-05 15:20 ` [U-Boot] [PATCH v3 08/10] apalis-tk1: remove default vesa vga mode from vidargs Igor Opaniuk
2019-08-05 15:20 ` [U-Boot] [PATCH v3 09/10] apalis-tk1: support v1.2 hardware revision Igor Opaniuk
2019-08-05 15:20 ` [U-Boot] [PATCH v3 10/10] apalis-tk1: remove non-esential power rails on boot Igor Opaniuk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190805152047.30405-8-igor.opaniuk@gmail.com \
    --to=igor.opaniuk@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox