History

usb: pd: Add definitions for the Enter_USB message

Version 2.0 of the USB Power Delivery Specification R3.0 defines a new message called Enter_USB, which is made with USB4 in mind. Enter_USB message is in practice the same as the Enter Mode command (used when entering alternate modes) that just needs to be used when entering USB4 mode. The message does also support entering USB 2.0 or USB 3.2 mode instead of USB4 mode, but it is only required with USB4. I.e. with USB2 and USB3 Enter_USB message is optional.

Heikki Krogerus committed 6 years ago

Commit 78239051 parent b66b40e1 file · +32 −1Browse files

Showing the changes to include/linux (1 of 1 file). Show all

Unified · Split

include/linux/usb/pd.h+32−1
@@ -45,7 +45,8 @@ enum pd_data_msg_type { · 44 unmodified lines
45 PD_DATA_BATT_STATUS = 5,45 PD_DATA_BATT_STATUS = 5,
46 PD_DATA_ALERT = 6,46 PD_DATA_ALERT = 6,
47 PD_DATA_GET_COUNTRY_INFO = 7,47 PD_DATA_GET_COUNTRY_INFO = 7,
48 /* 8-14 Reserved */48 PD_DATA_ENTER_USB = 8,
49 /* 9-14 Reserved */
49 PD_DATA_VENDOR_DEF = 15,50 PD_DATA_VENDOR_DEF = 15,
50 /* 16-31 Reserved */51 /* 16-31 Reserved */
51};52};
@@ -418,6 +419,36 @@ static inline unsigned int rdo_max_power(u32 rdo) · 366 unmodified lines
418 return ((rdo >> RDO_BATT_MAX_PWR_SHIFT) & RDO_PWR_MASK) * 250;419 return ((rdo >> RDO_BATT_MAX_PWR_SHIFT) & RDO_PWR_MASK) * 250;
419}420}
420 421
422/* Enter_USB Data Object */
423#define EUDO_USB_MODE_MASK GENMASK(30, 28)
424#define EUDO_USB_MODE_SHIFT 28
425#define EUDO_USB_MODE_USB2 0
426#define EUDO_USB_MODE_USB3 1
427#define EUDO_USB_MODE_USB4 2
428#define EUDO_USB4_DRD BIT(26)
429#define EUDO_USB3_DRD BIT(25)
430#define EUDO_CABLE_SPEED_MASK GENMASK(23, 21)
431#define EUDO_CABLE_SPEED_SHIFT 21
432#define EUDO_CABLE_SPEED_USB2 0
433#define EUDO_CABLE_SPEED_USB3_GEN1 1
434#define EUDO_CABLE_SPEED_USB4_GEN2 2
435#define EUDO_CABLE_SPEED_USB4_GEN3 3
436#define EUDO_CABLE_TYPE_MASK GENMASK(20, 19)
437#define EUDO_CABLE_TYPE_SHIFT 19
438#define EUDO_CABLE_TYPE_PASSIVE 0
439#define EUDO_CABLE_TYPE_RE_TIMER 1
440#define EUDO_CABLE_TYPE_RE_DRIVER 2
441#define EUDO_CABLE_TYPE_OPTICAL 3
442#define EUDO_CABLE_CURRENT_MASK GENMASK(18, 17)
443#define EUDO_CABLE_CURRENT_SHIFT 17
444#define EUDO_CABLE_CURRENT_NOTSUPP 0
445#define EUDO_CABLE_CURRENT_3A 2
446#define EUDO_CABLE_CURRENT_5A 3
447#define EUDO_PCIE_SUPPORT BIT(16)
448#define EUDO_DP_SUPPORT BIT(15)
449#define EUDO_TBT_SUPPORT BIT(14)
450#define EUDO_HOST_PRESENT BIT(13)
451
421/* USB PD timers and counters */452/* USB PD timers and counters */
422#define PD_T_NO_RESPONSE 5000 /* 4.5 - 5.5 seconds */453#define PD_T_NO_RESPONSE 5000 /* 4.5 - 5.5 seconds */
423#define PD_T_DB_DETECT 10000 /* 10 - 15 seconds */454#define PD_T_DB_DETECT 10000 /* 10 - 15 seconds */