Skip to content

Commit ca469c2

Browse files
Heikki Krogerusgregkh
authored andcommitted
usb: typec: Add definitions for Thunderbolt 3 Alternate Mode
This adds separate header file for the Thunderbolt 3 Alternate Mode (aka. TBT). The header supplies definitions for all the Thunderbolt specific VDOs (Vendor Defined Objects) that are described in the USB Type-C Connector specification v2.0, as well as definition for the Thunderbolt 3 Standard ID (SID). There is also a new connector state value for the Thunderbolt 3 Alternate Mode that can be used with the mux drivers. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Link: https://lore.kernel.org/r/20200302135353.56659-9-heikki.krogerus@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent a7914d1 commit ca469c2

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

‎include/linux/usb/typec_tbt.h‎

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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+
7+
#define USB_TYPEC_VENDOR_INTEL 0x8087
8+
/* Alias for convenience */
9+
#define USB_TYPEC_TBT_SID USB_TYPEC_VENDOR_INTEL
10+
11+
/* Connector state for Thunderbolt3 */
12+
#define TYPEC_TBT_MODE TYPEC_STATE_MODAL
13+
14+
/**
15+
* struct typec_thunderbolt_data - Thundebolt3 Alt Mode specific data
16+
* @device_mode: Device Discover Mode VDO
17+
* @cable_mode: Cable Discover Mode VDO
18+
* @enter_vdo: Enter Mode VDO
19+
*/
20+
struct typec_thunderbolt_data {
21+
u32 device_mode;
22+
u32 cable_mode;
23+
u32 enter_vdo;
24+
};
25+
26+
/* TBT3 Device Discover Mode VDO bits */
27+
#define TBT_MODE BIT(0)
28+
#define TBT_ADAPTER(_vdo_) (((_vdo_) & BIT(16)) >> 16)
29+
#define TBT_ADAPTER_LEGACY 0
30+
#define TBT_ADAPTER_TBT3 1
31+
#define TBT_INTEL_SPECIFIC_B0 BIT(26)
32+
#define TBT_VENDOR_SPECIFIC_B0 BIT(30)
33+
#define TBT_VENDOR_SPECIFIC_B1 BIT(31)
34+
35+
#define TBT_SET_ADAPTER(a) (((a) & 1) << 16)
36+
37+
/* TBT3 Cable Discover Mode VDO bits */
38+
#define TBT_CABLE_SPEED(_vdo_) (((_vdo_) & GENMASK(18, 16)) >> 16)
39+
#define TBT_CABLE_USB3_GEN1 1
40+
#define TBT_CABLE_USB3_PASSIVE 2
41+
#define TBT_CABLE_10_AND_20GBPS 3
42+
#define TBT_CABLE_ROUNDED BIT(19)
43+
#define TBT_CABLE_OPTICAL BIT(21)
44+
#define TBT_CABLE_RETIMER BIT(22)
45+
#define TBT_CABLE_LINK_TRAINING BIT(23)
46+
47+
#define TBT_SET_CABLE_SPEED(_s_) (((_s_) & GENMASK(2, 0)) << 16)
48+
49+
/* TBT3 Device Enter Mode VDO bits */
50+
#define TBT_ENTER_MODE_CABLE_SPEED(s) TBT_SET_CABLE_SPEED(s)
51+
#define TBT_ENTER_MODE_ACTIVE_CABLE BIT(24)
52+
53+
#endif /* __USB_TYPEC_TBT_H */

0 commit comments

Comments
 (0)