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 2ca6d5c7659a33738303a269f10b9b93b6e5448c..068f8cd9e735e338007572b71adfdd22bb49e79f 100644 (file)
@@ -1,12 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (C) 2013 Gateworks Corporation
  *
  * Author: Tim Harvey <tharvey@gateworks.com>
- *
- * SPDX-License-Identifier: GPL-2.0+
  */
 
-#include <asm/errno.h>
+#include <linux/errno.h>
 #include <common.h>
 #include <i2c.h>
 #include <linux/ctype.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");
@@ -137,6 +136,14 @@ int gsc_info(int verbose)
                break;
        case '5': /* GW55xx */
                break;
+       case '6': /* GW560x */
+               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;
 }
@@ -168,7 +175,7 @@ int gsc_boot_wd_disable(void)
        return 1;
 }
 
-#ifdef CONFIG_CMD_GSC
+#if defined(CONFIG_CMD_GSC) && !defined(CONFIG_SPL_BUILD)
 static int do_gsc_sleep(cmd_tbl_t *cmdtp, int flag, int argc,
                        char * const argv[])
 {