Skip to contentSkip to conversation

board: gateworks: venice: enable GSC supervisor for new board models

PATCH New Tim Harvey 1 participant 1 message Jun 19, 2024

lore
Share & tools
lore

Tim Harvey

author
#0 lore raw

PATCH 1/1 board: gateworks: venice: enable GSC supervisor for new board models

The Gateworks System Controller (GSC) has a voltage supervisor which is disabled by default. On older boards we want to maintian this but on newer boards we wish to enable the voltage supervisor.

The Gateworks System Controller (GSC) can disable the board primary power supply by driving a pin to a FET high. On older board models the leakage of the GSC may exceed the leakage of the FET causing this signal slowly rise when the GSC battery is low and the board is in a powered down state resulting in the board being kept in a disabled state.

Newer boards have a hardware fix to avoid this leakage and thus should enable the voltage supervisor.

---
 board/gateworks/venice/spl.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)
board/gateworks/venice/spl.c +18 -2
index b0a315ba9531..9a22eeef36ba 100644
@@ -119,13 +119,29 @@ static int dm_i2c_clrsetbits(struct udevice *dev, uint reg, uint clr, uint set)
 	return dm_i2c_write(dev, reg, &val, 1);
 }
 
-static int power_init_board(void)
+static int power_init_board(struct udevice *gsc)
 {
 	const char *model = eeprom_get_model();
 	struct udevice *bus;
 	struct udevice *dev;
 	int ret;
 
+	/* Enable GSC voltage supervisor for new board models */
+	if ((!strncmp(model, "GW7100", 6) && model[10] > 'D') ||
+	    (!strncmp(model, "GW7101", 6) && model[10] > 'D') ||
+	    (!strncmp(model, "GW7200", 6) && model[10] > 'E') ||
+	    (!strncmp(model, "GW7201", 6) && model[10] > 'E') ||
+	    (!strncmp(model, "GW7300", 6) && model[10] > 'E') ||
+	    (!strncmp(model, "GW7301", 6) && model[10] > 'E') ||
+	    (!strncmp(model, "GW740", 5) && model[7] > 'B')) {
+		u8 ver;
+
+		if (!dm_i2c_read(gsc, 14, &ver, 1) && ver > 62) {
+			printf("GSC     : enabling voltage supervisor\n");
+			dm_i2c_clrsetbits(gsc, 25, 0, BIT(1));
+		}
+	}
+
 	if ((!strncmp(model, "GW71", 4)) ||
 	    (!strncmp(model, "GW72", 4)) ||
 	    (!strncmp(model, "GW73", 4)) ||
@@ -298,7 +314,7 @@ void board_init_f(ulong dummy)
 	dram_sz = venice_eeprom_init(0);
 
 	/* PMIC */
-	power_init_board();
+	power_init_board(dev);
 
 	/* DDR initialization */
 	spl_dram_init(dram_sz);
Signature · 1 line
2.25.1