For a powercycle/cold boot, none of the RSR_* bits in the reset status
register are set, so one gets an empty

  Reset Status:

line. Print an indication that this was likely a cold boot.

Signed-off-by: Rasmus Villemoes <rasmus.villem...@prevas.dk>
---
 drivers/sysreset/sysreset_mpc83xx.c | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/drivers/sysreset/sysreset_mpc83xx.c 
b/drivers/sysreset/sysreset_mpc83xx.c
index 631ae6a5dc..6457d73418 100644
--- a/drivers/sysreset/sysreset_mpc83xx.c
+++ b/drivers/sysreset/sysreset_mpc83xx.c
@@ -149,20 +149,28 @@ static int mpc83xx_sysreset_get_status(struct udevice 
*dev, char *buf, int size)
        ulong rsr = gd->arch.reset_status;
        int i;
        char *sep;
+       ulong known_bits = RSR_SWSR | RSR_SWHR | RSR_JSRS | RSR_CSHR |
+               RSR_SWRS | RSR_BMRS | RSR_SRS | RSR_HRS;
 
        res = scnprintf(buf, size, "Reset Status:");
        buf += res;
        size -= res;
 
-       sep = " ";
-       for (i = 0; i < ARRAY_SIZE(bits); i++)
-               /* Print description of set bits */
-               if (rsr & bits[i].mask) {
-                       res = scnprintf(buf, size, "%s%s", sep, bits[i].desc);
-                       buf += res;
-                       size -= res;
-                       sep = ", ";
-               }
+       if (rsr & known_bits) {
+               sep = " ";
+               for (i = 0; i < ARRAY_SIZE(bits); i++)
+                       /* Print description of set bits */
+                       if (rsr & bits[i].mask) {
+                               res = scnprintf(buf, size, "%s%s", sep, 
bits[i].desc);
+                               buf += res;
+                               size -= res;
+                               sep = ", ";
+                       }
+       } else {
+               res = scnprintf(buf, size, " Unknown/Cold boot");
+               buf += res;
+               size -= res;
+       }
 
        res = scnprintf(buf, size, "\n");
        buf += res;
-- 
2.23.0

Reply via email to