summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Short <keithshort@chromium.org>2020-05-29 16:10:45 -0600
committerCommit Bot <commit-bot@chromium.org>2020-06-02 18:52:19 +0000
commitf1c730f6eee9856e6bf42c37d01579dd1f06d8e2 (patch)
treed806adc10cfe7891df813b7a58a1a42c22ec1af0
parent7229fab3bb2d4c1983dab388210eb894855aec7d (diff)
downloadchrome-ec-f1c730f6eee9856e6bf42c37d01579dd1f06d8e2.tar.gz
volteer: add support for USB4 Gen3
Latest Volteer motherboards and USB4 daughterboards support USB4 Gen3 speeds. Create new USB daughterboard type in CBI FW_CONFIG to support this configuration. BUG=b:157483704 BRANCH=none TEST=make buildall TEST=Set USB DB type to 3 (USB4_GEN3), verify TBT cable speed is reported as Gen3 to the kernel extcon-tcss-cros-ec driver. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I7873db70436cb9500387620a0e800c3ee79a384d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2223912 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Commit-Queue: Abe Levkoy <alevkoy@chromium.org>
-rw-r--r--baseboard/volteer/baseboard.c21
-rw-r--r--baseboard/volteer/baseboard.h4
-rw-r--r--board/volteer/board.c26
3 files changed, 39 insertions, 12 deletions
diff --git a/baseboard/volteer/baseboard.c b/baseboard/volteer/baseboard.c
index 0964f53122..2f2f3837fd 100644
--- a/baseboard/volteer/baseboard.c
+++ b/baseboard/volteer/baseboard.c
@@ -588,6 +588,11 @@ uint8_t get_board_id(void)
return board_id;
}
+enum usb_db_id get_usb_db_type(void)
+{
+ return usb_db_type;
+}
+
uint32_t get_fw_config(void)
{
return fw_config;
@@ -606,6 +611,7 @@ __overridable void config_volteer_gpios(void)
{
}
+static const char *db_type_prefix = "USB DB type: ";
/*
* Read CBI from i2c eeprom and initialize variables for board variants
*
@@ -631,7 +637,7 @@ static void cbi_init(void)
/* FW config */
if (cbi_get_fw_config(&cbi_val) != EC_SUCCESS) {
CPRINTS("CBI: Read FW config failed, assuming USB4");
- usb_db_val = USB_DB_USB4;
+ usb_db_val = USB_DB_USB4_GEN2;
} else {
fw_config = cbi_val;
usb_db_val = CBI_FW_CONFIG_USB_DB_TYPE(cbi_val);
@@ -639,17 +645,20 @@ static void cbi_init(void)
switch (usb_db_val) {
case USB_DB_NONE:
- CPRINTS("Daughterboard type: None");
+ CPRINTS("%sNone", db_type_prefix);
+ break;
+ case USB_DB_USB4_GEN2:
+ CPRINTS("%sUSB4 Gen1/2", db_type_prefix);
break;
- case USB_DB_USB4:
- CPRINTS("Daughterboard type: USB4");
+ case USB_DB_USB4_GEN3:
+ CPRINTS("%sUSB4 Gen3", db_type_prefix);
break;
case USB_DB_USB3:
config_db_usb3();
- CPRINTS("Daughterboard type: USB3");
+ CPRINTS("%sUSB3", db_type_prefix);
break;
default:
- CPRINTS("Daughterboard ID %d not supported", usb_db_val);
+ CPRINTS("%sID %d not supported", db_type_prefix, usb_db_val);
usb_db_val = USB_DB_NONE;
}
usb_db_type = usb_db_val;
diff --git a/baseboard/volteer/baseboard.h b/baseboard/volteer/baseboard.h
index c7b2d17ef9..427fd714c4 100644
--- a/baseboard/volteer/baseboard.h
+++ b/baseboard/volteer/baseboard.h
@@ -274,8 +274,9 @@ enum usbc_port {
enum usb_db_id {
USB_DB_NONE = 0,
- USB_DB_USB4 = 1,
+ USB_DB_USB4_GEN2 = 1,
USB_DB_USB3 = 2,
+ USB_DB_USB4_GEN3 = 3,
USB_DB_COUNT
};
@@ -309,6 +310,7 @@ void tcpc_alert_event(enum gpio_signal signal);
void bc12_interrupt(enum gpio_signal signal);
unsigned char get_board_id(void);
+enum usb_db_id get_usb_db_type(void);
/**
* Configure GPIOs based on the CBI board version. Boards in the Volteer
diff --git a/board/volteer/board.c b/board/volteer/board.c
index 76b1aefff1..68515fd95e 100644
--- a/board/volteer/board.c
+++ b/board/volteer/board.c
@@ -63,9 +63,20 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
__override enum tbt_compat_cable_speed board_get_max_tbt_speed(int port)
{
- /* Routing length exceeds 205mm prior to connection to re-timer */
- if (port == USBC_PORT_C1)
- return TBT_SS_U32_GEN1_GEN2;
+ enum usb_db_id usb_db_type = get_usb_db_type();
+
+ if (port == USBC_PORT_C1) {
+ if (usb_db_type == USB_DB_USB4_GEN2) {
+ /*
+ * Older boards violate 205mm trace length prior
+ * to connection to the re-timer and only support up
+ * to GEN2 speeds.
+ */
+ return TBT_SS_U32_GEN1_GEN2;
+ } else if (usb_db_type == USB_DB_USB4_GEN3) {
+ return TBT_SS_TBT_GEN3;
+ }
+ }
/*
* Thunderbolt-compatible mode not supported
@@ -78,13 +89,18 @@ __override enum tbt_compat_cable_speed board_get_max_tbt_speed(int port)
__override bool board_is_tbt_usb4_port(int port)
{
+ enum usb_db_id usb_db_type = get_usb_db_type();
+
/*
- * On Proto-1 only Port 1 supports TBT & USB4
+ * Volteer reference design only supports TBT & USB4 on port 1
+ * if the USB4 DB is present.
*
* TODO (b/147732807): All the USB-C ports need to support same
* features. Need to fix once USB-C feature set is known for Volteer.
*/
- return port == USBC_PORT_C1;
+ return ((port == USBC_PORT_C1)
+ && ((usb_db_type == USB_DB_USB4_GEN2)
+ || (usb_db_type == USB_DB_USB4_GEN3)));
}
/******************************************************************************/