summaryrefslogtreecommitdiff
path: root/include/usb_pd.h
diff options
context:
space:
mode:
authorAyushee Shah <ayushee.shah@intel.com>2019-12-17 12:00:54 -0800
committerCommit Bot <commit-bot@chromium.org>2020-01-31 01:49:45 +0000
commit6d26f78208fbaab8a41264b52bee36eee3668bcc (patch)
tree58f65d76a37ee756b5fa5bda0932672b944b964a /include/usb_pd.h
parentd682d368eeeaae56063859b2503c75fc4299022b (diff)
downloadchrome-ec-6d26f78208fbaab8a41264b52bee36eee3668bcc.tar.gz
TCPMv1: Add support for USB4.0
USB4 is based on the Thunderbolt 3 protocol specification. It supports 40 Gbit/s throughput, is compatible with Thunderbolt 3, and backwards compatible with USB 3.2, USB 2.0. USB4.0 PD Flow: Ref: USB Type-C Cable and Connector Specification 2.0 Figure 5-1 USB4 Discovery and Entry Flow Model USB PD Explicit Contract Discover ID SOP -------- USB4 compatible? | -------------yes------------|------No----- Exit USB4 Discovery | Discover ID SOP' --------- Product type | Passive cable----------|----Active Cable---USB4? | | | (Not implemented in this CL) USB Signaling ----------------------- | | | | USB4 with USB4 active cable Exit USB4 | Discovery --------------------------------------------- | | | | USB4 Gen3 USB3.2 Gen2 USB3.2 Gen1 USB2.0 | | | | Enter USB4 with | Enter USB4 with Exit USB4 Discovery USB4 Gen3 | USB4 Gen1 Passive cable | Passive cable | DFP Gen3 capable? | ------yes---- |---------No-------- | | Discover SVID SOP Enter USB4 with USB3.2 Gen2 Passive Cable | Discover SVID SOP' | Discover Mode SOP | Discover Mode SOP' --------Is TBT3? | -----yes----|-----No---- | | Enter USB4 with TBT3 Enter USB4 with TBT Gen3 passive cable Gen2 passive cable BUG=b:140819518 BRANCH=None TEST=With Gatkex creek 3 device, TGLRVP can enter to USB4.0 mode Change-Id: Id861661c66c53a0a32679388bb7e2e81aae3ceb5 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Signed-off-by: Ayushee <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1926382 Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'include/usb_pd.h')
-rw-r--r--include/usb_pd.h76
1 files changed, 58 insertions, 18 deletions
diff --git a/include/usb_pd.h b/include/usb_pd.h
index 59b293fe15..eaff1212c9 100644
--- a/include/usb_pd.h
+++ b/include/usb_pd.h
@@ -436,18 +436,24 @@ struct pd_policy {
* [2] :: Cert Stat VDO
* [3] :: (Product | Cable) VDO
* [4] :: AMA VDO
+ * [4] :: Product type UFP1 VDO
* [4] :: Product type Cable VDO 1
+ * [5] :: Product type UFP2 VDO
* [5] :: Product type Cable VDO 2
- *
- */
-#define VDO_INDEX_HDR 0
-#define VDO_INDEX_IDH 1
-#define VDO_INDEX_CSTAT 2
-#define VDO_INDEX_CABLE 3
-#define VDO_INDEX_PRODUCT 3
-#define VDO_INDEX_AMA 4
-#define VDO_INDEX_PTYPE_CABLE1 4
-#define VDO_INDEX_PTYPE_CABLE2 5
+ * [6] :: Product type DFP VDO
+ *
+ */
+#define VDO_INDEX_HDR 0
+#define VDO_INDEX_IDH 1
+#define VDO_INDEX_CSTAT 2
+#define VDO_INDEX_CABLE 3
+#define VDO_INDEX_PRODUCT 3
+#define VDO_INDEX_AMA 4
+#define VDO_INDEX_PTYPE_UFP1_VDO 4
+#define VDO_INDEX_PTYPE_CABLE1 4
+#define VDO_INDEX_PTYPE_UFP2_VDO 4
+#define VDO_INDEX_PTYPE_CABLE2 5
+#define VDO_INDEX_PTYPE_DFP_VDO 6
#define VDO_I(name) VDO_INDEX_##name
/*
@@ -514,6 +520,13 @@ union active_cable_vdo2 {
uint32_t raw_value;
};
+/* Protocol revision */
+enum pd_rev_type {
+ PD_REV10,
+ PD_REV20,
+ PD_REV30,
+};
+
/* Cable structure for storing cable attributes */
struct pd_cable {
uint8_t is_identified;
@@ -526,7 +539,7 @@ struct pd_cable {
/* For USB PD REV3, active cable has 2 VDOs */
union active_cable_vdo2 attr2;
/* Cable revision */
- uint8_t rev;
+ enum pd_rev_type rev;
/* For storing Discover mode response from device */
union tbt_mode_resp_device dev_mode_resp;
/* For storing Discover mode response from cable */
@@ -541,6 +554,10 @@ struct pd_cable {
#define CABLE_FLAGS_TBT_COMPAT_ENABLE BIT(2)
/* Flag to limit speed to TBT Gen 2 passive cable */
#define CABLE_FLAGS_TBT_COMPAT_LIMIT_SPEED BIT(3)
+/* Flag for checking if device is USB4.0 capable */
+#define CABLE_FLAGS_USB4_CAPABLE BIT(4)
+/* Flag for entering ENTER_USB mode */
+#define CABLE_FLAGS_ENTER_USB_MODE BIT(5)
/*
* SVDM Discover SVIDs request -> response
@@ -773,6 +790,7 @@ enum pd_states {
PD_STATE_BIST_RX, /* C36 */
PD_STATE_BIST_TX, /* C37 */
PD_STATE_DRP_AUTO_TOGGLE, /* C38 */
+ PD_STATE_ENTER_USB, /* C39 */
/* Number of states. Not an actual state. */
PD_STATE_COUNT,
};
@@ -1065,16 +1083,10 @@ enum pd_data_msg_type {
PD_DATA_ALERT = 6,
PD_DATA_GET_COUNTRY_INFO = 7,
/* 8-14 Reserved for REV 3.0 */
+ PD_DATA_ENTER_USB = 8,
PD_DATA_VENDOR_DEF = 15,
};
-/* Protocol revision */
-enum pd_rev_type {
- PD_REV10,
- PD_REV20,
- PD_REV30
-};
-
/*
* Power role. See 6.2.1.1.4 Port Power Role. Only applies to SOP packets.
* Replaced by pd_cable_plug for SOP' and SOP" packets.
@@ -1700,6 +1712,34 @@ void reset_pd_cable(int port);
enum idh_ptype get_usb_pd_cable_type(int port);
/**
+ * Return enter USB message payload
+ *
+ * @param port USB-C port number
+ */
+uint32_t get_enter_usb_msg_payload(int port);
+
+/**
+ * Enter USB4 mode
+ *
+ * @param port USB-C port number
+ */
+void enter_usb4_mode(int port);
+
+/**
+ * Clear enter USB4 mode
+ *
+ * @param port USB-C port number
+ */
+void disable_enter_usb4_mode(int port);
+
+/**
+ * Return if need to enter into USB4 mode
+ *
+ * @param port USB-C port number
+ */
+bool should_enter_usb4_mode(int port);
+
+/**
* Return the response of discover mode SOP prime, with SVID = 0x8087
*
* @param port USB-C port number