1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef __USB_TYPEC_TBT_H 3 #define __USB_TYPEC_TBT_H 4 5 #include <linux/usb/typec_altmode.h> 6 #include <linux/bitfield.h> 7 8 #define USB_TYPEC_VENDOR_INTEL 0x8087 9 /* Alias for convenience */ 10 #define USB_TYPEC_TBT_SID USB_TYPEC_VENDOR_INTEL 11 12 /* Connector state for Thunderbolt3 */ 13 #define TYPEC_TBT_MODE TYPEC_STATE_MODAL 14 15 /** 16 * struct typec_thunderbolt_data - Thundebolt3 Alt Mode specific data 17 * @device_mode: Device Discover Mode VDO 18 * @cable_mode: Cable Discover Mode VDO 19 * @enter_vdo: Enter Mode VDO 20 */ 21 struct typec_thunderbolt_data { 22 u32 device_mode; 23 u32 cable_mode; 24 u32 enter_vdo; 25 }; 26 27 /* TBT3 Device Discover Mode VDO bits */ 28 #define TBT_MODE BIT(0) 29 #define TBT_ADAPTER(_vdo_) FIELD_GET(BIT(16), _vdo_) 30 #define TBT_ADAPTER_LEGACY 0 31 #define TBT_ADAPTER_TBT3 1 32 #define TBT_INTEL_SPECIFIC_B0 BIT(26) 33 #define TBT_VENDOR_SPECIFIC_B0 BIT(30) 34 #define TBT_VENDOR_SPECIFIC_B1 BIT(31) 35 36 #define TBT_SET_ADAPTER(a) (((a) & 1) << 16) 37 38 /* TBT3 Cable Discover Mode VDO bits */ 39 #define TBT_CABLE_SPEED(_vdo_) FIELD_GET(GENMASK(18, 16), _vdo_) 40 #define TBT_CABLE_USB3_GEN1 1 41 #define TBT_CABLE_USB3_PASSIVE 2 42 #define TBT_CABLE_10_AND_20GBPS 3 43 #define TBT_CABLE_ROUNDED_SUPPORT(_vdo_) FIELD_GET(GENMASK(20, 19), _vdo_) 44 45 #define TBT_GEN3_NON_ROUNDED 0 46 #define TBT_GEN3_GEN4_ROUNDED_NON_ROUNDED 1 47 #define TBT_CABLE_OPTICAL BIT(21) 48 #define TBT_CABLE_RETIMER BIT(22) 49 #define TBT_CABLE_LINK_TRAINING BIT(23) 50 #define TBT_CABLE_ACTIVE_PASSIVE BIT(25) 51 52 #define TBT_SET_CABLE_SPEED(_s_) (((_s_) & GENMASK(2, 0)) << 16) 53 #define TBT_SET_CABLE_ROUNDED(_g_) (((_g_) & GENMASK(1, 0)) << 19) 54 55 /* TBT3 Device Enter Mode VDO bits */ 56 #define TBT_ENTER_MODE_CABLE_SPEED(s) TBT_SET_CABLE_SPEED(s) 57 #define TBT_ENTER_MODE_ACTIVE_CABLE BIT(24) 58 59 #endif /* __USB_TYPEC_TBT_H */ 60