summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--driver/gl3590.c17
-rw-r--r--driver/gl3590.h14
2 files changed, 31 insertions, 0 deletions
diff --git a/driver/gl3590.c b/driver/gl3590.c
index 2faf69178a..40e4df2d05 100644
--- a/driver/gl3590.c
+++ b/driver/gl3590.c
@@ -193,3 +193,20 @@ enum ec_error_list gl3590_ufp_pwr(int hub, struct pwr_con_t *pwr)
return EC_ERROR_UNKNOWN;
}
}
+
+int gl3590_enable_ports(int hub, uint8_t port_mask, bool enable)
+{
+ uint8_t buf[4] = {0};
+ uint8_t en_mask = 0;
+ int rv;
+
+ if (!enable)
+ en_mask = port_mask;
+
+ buf[0] = en_mask;
+ buf[2] = port_mask;
+
+ rv = gl3590_write(hub, GL3590_PORT_DISABLED_REG, buf, sizeof(buf));
+
+ return rv;
+}
diff --git a/driver/gl3590.h b/driver/gl3590.h
index 991796c306..089bcd7b7b 100644
--- a/driver/gl3590.h
+++ b/driver/gl3590.h
@@ -4,6 +4,7 @@
*/
#include "pwr_defs.h"
+#include "stdbool.h"
/* Registers definitions */
#define GL3590_HUB_MODE_REG 0x0
@@ -14,6 +15,7 @@
#define GL3590_INT_CLEAR 0x1
#define GL3590_RESPONSE_REG 0x2
#define GL3590_RESPONSE_REG_SYNC_MASK 0x80
+#define GL3590_PORT_DISABLED_REG 0x4
#define GL3590_HUB_STS_REG 0xA
#define GL3590_HUB_STS_HOST_PWR_MASK 0x30
#define GL3590_HUB_STS_HOST_PWR_SHIFT 4
@@ -35,6 +37,18 @@ void gl3590_irq_handler(int hub);
/* Get power capabilities of UFP host connection */
enum ec_error_list gl3590_ufp_pwr(int hub, struct pwr_con_t *pwr);
+#define GL3590_DFP1 BIT(0)
+#define GL3590_DFP2 BIT(1)
+#define GL3590_DFP3 BIT(2)
+#define GL3590_DFP4 BIT(3)
+#define GL3590_DFP5 BIT(4)
+#define GL3590_DFP6 BIT(5)
+#define GL3590_DFP7 BIT(6)
+#define GL3590_DFP8 BIT(7)
+
+/* Enable/disable power to particular downstream facing ports */
+int gl3590_enable_ports(int hub, uint8_t port_mask, bool enable);
+
/* Generic USB HUB I2C interface */
struct uhub_i2c_iface_t {
int i2c_host_port;