imx: ventana: gsc: show board temp on boot
authorTim Harvey <tharvey@gateworks.com>
Tue, 24 May 2016 18:03:52 +0000 (11:03 -0700)
committerStefano Babic <sbabic@denx.de>
Tue, 31 May 2016 15:24:46 +0000 (17:24 +0200)
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
board/gateworks/gw_ventana/gsc.c

index c626ba25e73b267dedb1fb62c9bca9a135ec95f7..042f55ab73478e8b526139a88086ee583b5e3ef4 100644 (file)
@@ -98,6 +98,12 @@ int gsc_info(int verbose)
                gsc_i2c_write(GSC_SC_ADDR, GSC_SC_STATUS, 1,
                              &buf[GSC_SC_STATUS], 1);
        }
+       if (!gsc_i2c_read(GSC_HWMON_ADDR, GSC_HWMON_TEMP, 1, buf, 2)) {
+               int ui = buf[0] | buf[1]<<8;
+               if (ui > 0x8000)
+                       ui -= 0xffff;
+               printf(" board temp at %dC", ui / 10);
+       }
        puts("\n");
        if (!verbose)
                return CMD_RET_SUCCESS;