diff options
author | li feng <li1.feng@intel.com> | 2020-08-21 15:23:28 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-12-21 22:07:31 +0000 |
commit | fe951556a7be3bc68b342dc941be13ff4f82f41b (patch) | |
tree | 7af452c46edf37398d1419a7cd5d263a1c70781b /include/usb_pd_vdo.h | |
parent | 774cfcbb675455973bb4d7856633d065f5c674fb (diff) | |
download | chrome-ec-fe951556a7be3bc68b342dc941be13ff4f82f41b.tar.gz |
TCPMv2: support TBT Alt mode as UFP
Implemented SVDM responders for TBT Alt mode
BUG=b:148528713,b:157163664,b:162986785
BRANCH=none
TEST=1. Build ec with CL:2382634; OS CPFE 13447, CB CPFE 13535
2. Boot up Volteer, run "pd trysrc 0" on EC console;
3. Then connect port 1 to TGL Windows RVP TBT port;
4. Thunderbolt connection is established. Volteer port 1 as UFP,
Windows RVP TBT port as DFP. From host console, thunderbolt0 is
listed as network interface in ifconfig.
Signed-off-by: li feng <li1.feng@intel.com>
Change-Id: If4c80418677f541e9c1c7c8c84446357000aaecb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2370045
Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Aashay Shringarpure <aashay@google.com>
Diffstat (limited to 'include/usb_pd_vdo.h')
-rw-r--r-- | include/usb_pd_vdo.h | 107 |
1 files changed, 106 insertions, 1 deletions
diff --git a/include/usb_pd_vdo.h b/include/usb_pd_vdo.h index 76772ef893..b0773ae7e7 100644 --- a/include/usb_pd_vdo.h +++ b/include/usb_pd_vdo.h @@ -19,12 +19,62 @@ * ############################################################################ * * Reference: USB Power Delivery Specification Revision 3.0, Version 2.0 + * Updated to ECN released on Feb 07, 2020 * * ############################################################################ */ /*****************************************************************************/ /* + * Table 6-29 ID Header VDO + * ------------------------------------------------------------- + * <31> : USB Communications Capable as USB Host + * <30> : USB Communications Capable as a USB Device + * <29:27> : Product Type (UFP): + * 000b = Undefined + * 001b = PDUSB Hub + * 010b = PDUSB Peripheral + * 011b = PSD (PD 3.0) + * 101b = Alternate Mode Adapter (AMA) + * 110b = Vconn-Powered USB Device (VPD, PD 3.0) + * 111b = Reserved, shall NOT be used + * + * Product Type (Cable Plug): + * 000b = Undefined + * 001b...010b = Reserved, Shall NOT be used + * 011b = Passive Cable + * 100b = Active Cable + * 101b...111b = Reserved, Shall NOT be used + * <26> : Modal Operation Supported + * <25:23> : Product Type (DFP): + * 000b = Undefined + * 001b = PDUSB Hub + * 010b = PDUSB Host + * 011b = Power Brick + * 100b = Alternate Mode Controller (AMC) + * 101b...111b = Reserved, Shall NOT be used + * <22:21> : Connector Type + * 00b = Reserved for compatibility with legacy systems + * 01b = Reserved, Shall Not be used + * 10b = USB Type-C Receptacle + * 11b = USB Type-C Captive Plug + * <20:16> : Reserved + * <15:0> : USB Vendor ID + */ +enum connector_type { + USB_TYPEC_RECEPTACLE = 2, + USB_TYPEC_CAPTIVE_PLUG, +}; + +enum idh_ptype_dfp { + IDH_PTYPE_DFP_UNDEFINED, + IDH_PTYPE_DFP_HUB, + IDH_PTYPE_DFP_HOST, + IDH_PTYPE_DFP_POWER_BRICK, + IDH_PTYPE_DFP_AMC, +}; +/*****************************************************************************/ +/* * Table 6-33 Cert Stat VDO (Note: same as Revision 2.0) * ------------------------------------------------------------- * <31:0> : XID assigned by USB-IF @@ -50,13 +100,21 @@ struct product_vdo { * Table 6-35 UFP VDO 1 * ------------------------------------------------------------- * <31:29> : UFP VDO version + * Version 1.0 = 000b + * Version 1.1 = 001b + * Values 010b...111b are Reserved and Shall Not be used * <28> : Reserved * <27:24> : Device Capability * 0001b = USB2.0 Device capable * 0010b = USB2.0 Device capable (Billboard only) * 0100b = USB3.2 Device capable * 1000b = USB4 Device Capable - * <23:6> : Reserved + * <23:22> : Connector Type + * 00b = Reserved, Shall Not be used + * 01b = Reserved, Shall Not be used + * 10b = USB Type-C Receptacle + * 11b = USB Type-C Captive Plug + * <21:6> : Reserved * <5:3> : Alternate Modes * 001b = Supports TBT3 alternate mode * 010b = Supports Alternate Modes that reconfigure @@ -75,6 +133,53 @@ struct product_vdo { #define PD_PRODUCT_IS_USB4(vdo) ((vdo) >> 24 & BIT(3)) #define PD_PRODUCT_IS_TBT3(vdo) ((vdo) >> 3 & BIT(0)) +/* UFP VDO Version 1.1; update the value when UFP VDO version changes */ +#define VDO_UFP1(cap, ctype, alt, speed) \ + ((0x1) << 29 | ((cap) & 0xf) << 24 \ + | ((ctype) & 0x3) << 22 | ((alt) & 0x7) << 3 | ((speed) & 0x7)) + +/* UFP VDO 1 Alternate Modes */ +#define VDO_UFP1_ALT_MODE_TBT3 BIT(0) +#define VDO_UFP1_ALT_MODE_RECONFIGURE BIT(1) +#define VDO_UFP1_ALT_MODE_NO_RECONFIGURE BIT(2) + +/* UFP VDO 1 Device Capability */ +#define VDO_UFP1_CAPABILITY_USB20 BIT(0) +#define VDO_UFP1_CAPABILITY_USB20_BILLBOARD BIT(1) +#define VDO_UFP1_CAPABILITY_USB32 BIT(2) +#define VDO_UFP1_CAPABILITY_USB4 BIT(3) +/*****************************************************************************/ +/* + * Table 6-37 DFP VDO + * ------------------------------------------------------------- + * <31:29> : DFP VDO version + * Version 1.0 = 000b + * Version 1.1 = 001b + * Values 010b...111b are Reserved and Shall Not be used + * <28:27> : Reserved + * <26:24> : Host Capability + * 001b = USB2.0 host capable + * 010b = USB3.2 host capable + * 100b = USB4 host capable + * <23:22> : Connector Type + * 00b = Reserved, Shall Not be used + * 01b = Reserved, Shall Not be used + * 10b = USB Type-C Receptacle + * 11b = USB Type-C Captive Plug + * <21:5> : Reserved + * <4:0> : Port number + */ +/* DFP VDO Version 1.1; update the value when DFP VDO version changes */ +#define VDO_DFP(cap, ctype, port) \ + ((0x1) << 29 | ((cap) & 0x7) << 24 \ + | ((ctype) & 0x3) << 22 | ((port) & 0x1f)) + +/* DFP VDO Host Capability */ +#define VDO_DFP_HOST_CAPABILITY_USB20 BIT(0) +#define VDO_DFP_HOST_CAPABILITY_USB32 BIT(1) +#define VDO_DFP_HOST_CAPABILITY_USB4 BIT(2) + + /*****************************************************************************/ /* * Table 6-38 Passive Cable VDO |