]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
mpc83xx: Add support for the display of reset status
authorDave Liu <daveliu@freescale.com>
Mon, 25 Jun 2007 02:41:56 +0000 (10:41 +0800)
committerKim Phillips <kim.phillips@freescale.com>
Fri, 10 Aug 2007 06:12:03 +0000 (01:12 -0500)
83xx processor family has many reset sources, such as
power on reset, software hard reset, software soft reset,
JTAG, bus monitor, software watchdog, check stop reset,
external hard reset, external software reset.
sometimes, to figure out the fault of system, we need to
know the cause of reset early before the prompt of
u-boot present.

Signed-off-by: Dave Liu <daveliu@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
cpu/mpc83xx/cpu_init.c
include/common.h
lib_ppc/board.c

index 53a5f5947392fe7f15804e817c2544c8212412a8..722497966a105600d5f0233170231fb8d9d33909 100644 (file)
@@ -257,3 +257,39 @@ int cpu_init_r (void)
 #endif
        return 0;
 }
+
+/*
+ * Figure out the cause of the reset
+ */
+int prt_83xx_rsr(void)
+{
+       static struct {
+               ulong mask;
+               char *desc;
+       } bits[] = {
+               {
+               RSR_SWSR, "Software Soft"}, {
+               RSR_SWHR, "Software Hard"}, {
+               RSR_JSRS, "JTAG Soft"}, {
+               RSR_CSHR, "Check Stop"}, {
+               RSR_SWRS, "Software Watchdog"}, {
+               RSR_BMRS, "Bus Monitor"}, {
+               RSR_SRS,  "External/Internal Soft"}, {
+               RSR_HRS,  "External/Internal Hard"}
+       };
+       static int n = sizeof bits / sizeof bits[0];
+       ulong rsr = gd->reset_status;
+       int i;
+       char *sep;
+
+       puts("Reset Status:");
+
+       sep = " ";
+       for (i = 0; i < n; i++)
+               if (rsr & bits[i].mask) {
+                       printf("%s%s", sep, bits[i].desc);
+                       sep = ", ";
+               }
+       puts("\n\n");
+       return 0;
+}
index ac29d3aac6cce3d628381f3f904e2d56b4342393..a822d28d39043647491dfe13decec3612934338d 100644 (file)
@@ -526,6 +526,8 @@ void        cpu_init_f    (void);
 int    cpu_init_r    (void);
 #if defined(CONFIG_8260)
 int    prt_8260_rsr  (void);
+#elif defined(CONFIG_MPC83XX)
+int    prt_83xx_rsr  (void);
 #endif
 
 /* $(CPU)/interrupts.c */
index 325f5c219ced78f352f04b13d13ec30fb820dd3b..c87d46c3d626a1b00bb06fc373aaf6f1dcc24001 100644 (file)
@@ -309,7 +309,9 @@ init_fnc_t *init_sequence[] = {
        prt_8260_rsr,
        prt_8260_clks,
 #endif /* CONFIG_8260 */
-
+#if defined(CONFIG_MPC83XX)
+       prt_83xx_rsr,
+#endif
        checkcpu,
 #if defined(CONFIG_MPC5xxx)
        prt_mpc5xxx_clks,
@@ -376,7 +378,7 @@ void board_init_f (ulong bootflag)
        /* compiler optimization barrier needed for GCC >= 3.4 */
        __asm__ __volatile__("": : :"memory");
 
-#if !defined(CONFIG_CPM2)
+#if !defined(CONFIG_CPM2) && !defined(CONFIG_MPC83XX)
        /* Clear initial global data */
        memset ((void *) gd, 0, sizeof (gd_t));
 #endif