Fix sysmon POST problem: check I2C error codes
authorWolfgang Denk <wd@nyx.denx.de>
Thu, 28 Jul 2005 08:42:26 +0000 (10:42 +0200)
committerWolfgang Denk <wd@nyx.denx.de>
Thu, 28 Jul 2005 08:42:26 +0000 (10:42 +0200)
This fixes a problem of displaying bogus voltages when the voltages
are so low that the I2C devices start failing while the rest of the
system keeps running.

CHANGELOG
post/sysmon.c

index bde6eaf..35c3969 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,11 @@
 Changes for U-Boot 1.1.3:
 ======================================================================
 
+* Fix sysmon POST problem: check I2C error codes
+  This fixes a problem of displaying bogus voltages when the voltages
+  are so low that the I2C devices start failing while the rest of the
+  system keeps running.
+
 * Patch by Cedric Vincent, 6 Jul 2005:
   Fix CFG_CMD_SETGETDCR handling in "common/cmd_dcr.c"
 
index 8758ccd..72fcac3 100644 (file)
@@ -185,6 +185,10 @@ static char *sysmon_unit_value (sysmon_table_t *s, uint val)
        char *p, sign;
        int dec, frac;
 
+       if (val == -1) {
+               return "I/O ERROR";
+       }
+
        if (unit_val < 0) {
                sign = '-';
                unit_val = -unit_val;
@@ -297,8 +301,13 @@ int sysmon_post_test (int flags)
                }
 
                val = t->sysmon->read(t->sysmon, t->addr);
-               t->val_valid = val >= t->val_min && val <= t->val_max;
-               t->val_valid_alt = val >= t->val_min_alt && val <= t->val_max_alt;
+               if (val != -1) {
+                       t->val_valid = val >= t->val_min && val <= t->val_max;
+                       t->val_valid_alt = val >= t->val_min_alt && val <= t->val_max_alt;
+               } else {
+                       t->val_valid = 0;
+                       t->val_valid_alt = 0;
+               }
 
                if (t->exec_after) {
                        t->exec_after(t);