Merge tag 'u-boot-imx-20200121' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
[oweals/u-boot.git] / board / gateworks / gw_ventana / gsc.c
index f2a01b84deb29c74a381eacd07a88be40163f79c..068f8cd9e735e338007572b71adfdd22bb49e79f 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (C) 2013 Gateworks Corporation
  *
  * Author: Tim Harvey <tharvey@gateworks.com>
- *
- * SPDX-License-Identifier: GPL-2.0+
  */
 
 #include <linux/errno.h>
@@ -71,7 +70,7 @@ static void read_hwmon(const char *name, uint reg, uint size)
                puts("fRD\n");
        } else {
                ui = buf[0] | (buf[1]<<8) | (buf[2]<<16);
-               if (reg == GSC_HWMON_TEMP && ui > 0x8000)
+               if (size == 2 && ui > 0x8000)
                        ui -= 0xffff;
                if (ui == 0xffffff)
                        puts("invalid\n");
@@ -141,6 +140,10 @@ int gsc_info(int verbose)
                read_hwmon("VDD_IO4",  GSC_HWMON_VDD_IO4, 3);
                read_hwmon("VDD_GPS",  GSC_HWMON_VDD_IO3, 3);
                break;
+       case '9': /* GW590x */
+               read_hwmon("AMONBMON",  GSC_HWMON_VDD_IO3, 3);
+               read_hwmon("BAT_VOLT",  GSC_HWMON_VDD_EXT, 3);
+               read_hwmon("BAT_TEMP",  GSC_HWMON_VDD_IO4, 2);
        }
        return 0;
 }