summaryrefslogtreecommitdiff
path: root/board/volteer
diff options
context:
space:
mode:
authorEric Herrmann <eherrmann@chromium.org>2020-08-03 15:46:58 -0700
committerCommit Bot <commit-bot@chromium.org>2020-09-09 22:59:52 +0000
commit036b58da6630b42470b2f07d286c821670358482 (patch)
tree01da0d67fa64003f7ca6dc8182227cdbda988932 /board/volteer
parent0cd34573caa2b786bfe3528231c3206a00f3c9cf (diff)
downloadchrome-ec-036b58da6630b42470b2f07d286c821670358482.tar.gz
Volteer: Add support for RT1715
Add support for replacing the TUSB422 with the RT1715. Since they are pin-to-pin compatible and currently only used with a rework, make the decision of which to use at runtime. The logic is to check if the RT1715 is both on the I2C bus and the vendor ID matches. If either fail, default to the TUSB422 address and driver. BUG=b:162617664 TEST=make buildall TEST=check both TUSB422 functionality and RT1715 functionality BRANCH=none Change-Id: I8306f086bf030ddd7238532b1f12aa259cb72422 Signed-off-by: Eric Herrmann <eherrmann@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2343734 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
Diffstat (limited to 'board/volteer')
-rw-r--r--board/volteer/board.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/board/volteer/board.c b/board/volteer/board.c
index 9a06e8bddd..2aef1e914b 100644
--- a/board/volteer/board.c
+++ b/board/volteer/board.c
@@ -18,6 +18,7 @@
#include "driver/retimer/bb_retimer.h"
#include "driver/sync.h"
#include "driver/tcpm/ps8xxx.h"
+#include "driver/tcpm/rt1715.h"
#include "driver/tcpm/tcpci.h"
#include "driver/tcpm/tusb422.h"
#include "extpower.h"
@@ -374,6 +375,31 @@ static void config_db_usb3_passive(void)
usb_muxes[USBC_PORT_C1] = mux_config_p1_usb3_passive;
}
+static void config_port_discrete_tcpc(int port)
+{
+ /*
+ * Support 2 Pin-to-Pin compatible parts: TUSB422 and RT1715, for
+ * simplicity allow either and decide at runtime which we are using.
+ * Default to TUSB422, and switch to RT1715 if it is on the I2C bus and
+ * the VID matches.
+ */
+
+ int regval;
+
+ if (i2c_read16(port ? I2C_PORT_USB_C1 : I2C_PORT_USB_C0,
+ RT1715_I2C_ADDR_FLAGS, TCPC_REG_VENDOR_ID,
+ &regval) == EC_SUCCESS) {
+ if (regval == RT1715_VENDOR_ID) {
+ CPRINTS("C%d: RT1715 detected", port);
+ tcpc_config[port].i2c_info.addr_flags =
+ RT1715_I2C_ADDR_FLAGS;
+ tcpc_config[port].drv = &rt1715_tcpm_drv;
+ return;
+ }
+ }
+ CPRINTS("C%d: Default to TUSB422", port);
+}
+
static const char *db_type_prefix = "USB DB type: ";
__override void board_cbi_init(void)
{
@@ -389,15 +415,17 @@ __override void board_cbi_init(void)
GPIO_USB_C1_RT_RST_ODL_BOARDID_0;
ps8xxx_rst_odl = GPIO_USB_C1_RT_RST_ODL_BOARDID_0;
}
-
+ config_port_discrete_tcpc(0);
switch (usb_db) {
case DB_USB_ABSENT:
CPRINTS("%sNone", db_type_prefix);
break;
case DB_USB4_GEN2:
+ config_port_discrete_tcpc(1);
CPRINTS("%sUSB4 Gen1/2", db_type_prefix);
break;
case DB_USB4_GEN3:
+ config_port_discrete_tcpc(1);
CPRINTS("%sUSB4 Gen3", db_type_prefix);
break;
case DB_USB3_ACTIVE:
@@ -406,6 +434,7 @@ __override void board_cbi_init(void)
break;
case DB_USB3_PASSIVE:
config_db_usb3_passive();
+ config_port_discrete_tcpc(1);
CPRINTS("%sUSB3 Passive", db_type_prefix);
break;
default: