Skip to contentSkip to conversation

usb: usb3.0 ch9 definitions

PATCH Superseded Brokhman Tatyana 4 participants 5 messages Oct 7, 2010 – Oct 8, 2010

Subsystems (2)

v3 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 usb: usb3.0 ch9 definitions

Adding SuperSpeed usb definitions as defined by ch9 of the USB3.0 spec. This patch is a preparation for adding SuperSpeed support to the gadget framework.

---
 include/linux/usb/ch9.h |   58 ++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 57 insertions(+), 1 deletions(-)
include/linux/usb/ch9.h +57 -1
index da2ed77..a779b86 100644
@@ -123,8 +123,23 @@
 #define USB_DEVICE_A_ALT_HNP_SUPPORT	5	/* (otg) other RH port does */
 #define USB_DEVICE_DEBUG_MODE		6	/* (special devices only) */
 
+/*
+ * New Feature Selectors as added by USB 3.0
+ * See USB 3.0 spec Table 9-6
+ */
+#define USB_DEVICE_U1_ENABLE	48	/* dev may initiate U1 transition */
+#define USB_DEVICE_U2_ENABLE	49	/* dev may initiate U2 transition*/
+#define USB_DEVICE_LTM_ENABLE	50	/* dev may send LTM*/
+#define USB_INTRF_FUNC_SUSPEND	0	/* function suspend*/
+
+#define USB_INTR_FUNC_SUSPEND_OPT_MASK	0xFF00
+
 #define USB_ENDPOINT_HALT		0	/* IN/OUT will STALL */
 
+/* Bit array elements as returned by the USB_REQ_GET_STATUS request. */
+#define USB_DEV_STAT_U1_ENABLED		2	/* transition into U1 state */
+#define USB_DEV_STAT_U2_ENABLED		3	/* transition into U2 state */
+#define USB_DEV_STAT_LTM_ENABLED	4	/* Latency tolerance messages*/
 
 /**
  * struct usb_ctrlrequest - SETUP data for a USB device control request
@@ -675,6 +690,7 @@ struct usb_bos_descriptor {
 	__u8  bNumDeviceCaps;
 } __attribute__((packed));
 
+#define USB_DT_BOS_SIZE		5
 /*-------------------------------------------------------------------------*/
 
 /* USB_DT_DEVICE_CAPABILITY:  grouped with BOS */
@@ -712,16 +728,56 @@ struct usb_wireless_cap_descriptor {	/* Ultra Wide Band */
 	__u8  bReserved;
 } __attribute__((packed));
 
+/* USB 2.0 Extension descriptor */
 #define	USB_CAP_TYPE_EXT		2
 
 struct usb_ext_cap_descriptor {		/* Link Power Management */
 	__u8  bLength;
 	__u8  bDescriptorType;
 	__u8  bDevCapabilityType;
-	__u8  bmAttributes;
+	__u32 bmAttributes;
 #define USB_LPM_SUPPORT			(1 << 1)	/* supports LPM */
 } __attribute__((packed));
 
+#define USB_DT_USB_EXT_CAP_SIZE	7
+
+/*
+ * SuperSpeed USB Capability descriptor: Defines the set of SuperSpeed USB
+ * specific device level capabilities
+ */
+#define		USB_SS_CAP_TYPE		3
+struct usb_ss_cap_descriptor {		/* Link Power Management */
+	__u8  bLength;
+	__u8  bDescriptorType;
+	__u8  bDevCapabilityType;
+	__u8  bmAttributes;
+#define USB_LTM_SUPPORT			(1 << 1) /* supports LTM */
+	__u16 wSpeedSupported;
+#define USB_LOW_SPEED_OPERATION		(1)	 /* Low speed operation */
+#define USB_FULL_SPEED_OPERATION	(1 << 1) /* Full speed operation */
+#define USB_HIGH_SPEED_OPERATION	(1 << 2) /* High speed operation */
+#define USB_5GBPS_OPERATION		(1 << 3) /* Operation at 5Gbps */
+	__u8  bFunctionalitySupport;
+	__u8  bU1devExitLat;
+	__u16 bU2DevExitLat;
+} __attribute__((packed));
+
+#define USB_DT_USB_SS_CAP_SIZE	10
+
+/*
+ * Container ID Capability descriptor: Defines the instance unique ID used to
+ * identify the instance across all operating modes
+ */
+#define	CONTAINER_ID_TYPE	4
+struct usb_ss_container_id_descriptor {
+	__u8  bLength;
+	__u8  bDescriptorType;
+	__u8  bDevCapabilityType;
+	__u8  bReserved;
+	__u8  ContainerID[16]; /* 128-bit number */
+} __attribute__((packed));
+
+#define USB_DT_USB_SS_CONTN_ID_SIZE	20
 /*-------------------------------------------------------------------------*/
 
 /* USB_DT_WIRELESS_ENDPOINT_COMP:  companion descriptor associated with
Signature · 1 line
1.6.3.3
#1 lore raw
Quoted 5 lines · Brokhman Tatyana

Adding SuperSpeed usb definitions as defined by ch9 of the USB3.0 spec. This patch is a preparation for adding SuperSpeed support to the gadget framework.

Is this still a [RFC] or is it something that you think should be applied to the tree?

Quoted 45 lines
---
 include/linux/usb/ch9.h |   58 ++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 57 insertions(+), 1 deletions(-)
include/linux/usb/ch9.h +17 -0
index da2ed77..a779b86 100644
@@ -123,8 +123,23 @@
 #define USB_DEVICE_A_ALT_HNP_SUPPORT	5	/* (otg) other RH port does */
 #define USB_DEVICE_DEBUG_MODE		6	/* (special devices only) */
 
+/*
+ * New Feature Selectors as added by USB 3.0
+ * See USB 3.0 spec Table 9-6
+ */
+#define USB_DEVICE_U1_ENABLE	48	/* dev may initiate U1 transition */
+#define USB_DEVICE_U2_ENABLE	49	/* dev may initiate U2 transition*/
+#define USB_DEVICE_LTM_ENABLE	50	/* dev may send LTM*/
+#define USB_INTRF_FUNC_SUSPEND	0	/* function suspend*/
+
+#define USB_INTR_FUNC_SUSPEND_OPT_MASK	0xFF00
+
 #define USB_ENDPOINT_HALT		0	/* IN/OUT will STALL */
 
+/* Bit array elements as returned by the USB_REQ_GET_STATUS request. */
+#define USB_DEV_STAT_U1_ENABLED		2	/* transition into U1 state */
+#define USB_DEV_STAT_U2_ENABLED		3	/* transition into U2 state */
+#define USB_DEV_STAT_LTM_ENABLED	4	/* Latency tolerance messages*/
 
 /**
  * struct usb_ctrlrequest - SETUP data for a USB device control request
@@ -675,6 +690,7 @@ struct usb_bos_descriptor {
 	__u8  bNumDeviceCaps;
 } __attribute__((packed));
 
+#define USB_DT_BOS_SIZE		5
 /*-------------------------------------------------------------------------*/
 
 /* USB_DT_DEVICE_CAPABILITY:  grouped with BOS */
@@ -712,16 +728,56 @@ struct usb_wireless_cap_descriptor {	/* Ultra Wide Band */
 	__u8  bReserved;
 } __attribute__((packed));
 
+/* USB 2.0 Extension descriptor */

include/linux/usb/ch9.h struct usb_wireless_cap_descriptor { /* Ultra Wide Band */ · line 740

Quoted 10 lines
include/linux/usb/ch9.h +1 -1
 #define	USB_CAP_TYPE_EXT		2
 
 struct usb_ext_cap_descriptor {		/* Link Power Management */
 	__u8  bLength;
 	__u8  bDescriptorType;
 	__u8  bDevCapabilityType;
-	__u8  bmAttributes;
+	__u32 bmAttributes;
 #define USB_LPM_SUPPORT			(1 << 1)	/* supports LPM */
 } __attribute__((packed));

This structure just got bigger? How is that going to affect existing users of it? And shoudn't that be in __le32 format instead of __u32?

Quoted 5 lines
include/linux/usb/ch9.h +4 -0
+#define USB_DT_USB_EXT_CAP_SIZE	7
+
+/*
+ * SuperSpeed USB Capability descriptor: Defines the set of SuperSpeed USB

include/linux/usb/ch9.h struct usb_wireless_cap_descriptor { /* Ultra Wide Band */ · line 755

Quoted 10 lines
include/linux/usb/ch9.h +10 -0
+ * specific device level capabilities
+ */
+#define		USB_SS_CAP_TYPE		3
+struct usb_ss_cap_descriptor {		/* Link Power Management */
+	__u8  bLength;
+	__u8  bDescriptorType;
+	__u8  bDevCapabilityType;
+	__u8  bmAttributes;
+#define USB_LTM_SUPPORT			(1 << 1) /* supports LTM */
+	__u16 wSpeedSupported;

__le16?

include/linux/usb/ch9.h struct usb_wireless_cap_descriptor { /* Ultra Wide Band */ · line 762

Quoted 7 lines
include/linux/usb/ch9.h +7 -0
+#define USB_LOW_SPEED_OPERATION		(1)	 /* Low speed operation */
+#define USB_FULL_SPEED_OPERATION	(1 << 1) /* Full speed operation */
+#define USB_HIGH_SPEED_OPERATION	(1 << 2) /* High speed operation */
+#define USB_5GBPS_OPERATION		(1 << 3) /* Operation at 5Gbps */
+	__u8  bFunctionalitySupport;
+	__u8  bU1devExitLat;
+	__u16 bU2DevExitLat;

__le16? I'm guessing these fields haven't actually been used for anything?

Quoted 5 lines
include/linux/usb/ch9.h +5 -0
+} __attribute__((packed));
+
+#define USB_DT_USB_SS_CAP_SIZE	10
+
+/*

include/linux/usb/ch9.h struct usb_wireless_cap_descriptor { /* Ultra Wide Band */ · line 777

Quoted 10 lines
include/linux/usb/ch9.h +10 -0
+ * Container ID Capability descriptor: Defines the instance unique ID used to
+ * identify the instance across all operating modes
+ */
+#define	CONTAINER_ID_TYPE	4
+struct usb_ss_container_id_descriptor {
+	__u8  bLength;
+	__u8  bDescriptorType;
+	__u8  bDevCapabilityType;
+	__u8  bReserved;
+	__u8  ContainerID[16]; /* 128-bit number */

Is this number in any specific endian format? If so, you're going to have a hard time handling it as an array of bytes, aren't you? How is this going to be managed?

thanks,

greg k-h

#2 lore raw
Quoted 10 lines · Brokhman Tatyana
Quoted 5 lines

Adding SuperSpeed usb definitions as defined by ch9 of the USB3.0 spec. This patch is a preparation for adding SuperSpeed support to the gadget framework.

Is this still a [RFC] or is it something that you think should be applied to the tree?

You are right. It's not an RFC any more.
(Sorry, it's a first time for me.)

Quoted 49 lines
Quoted 49 lines
---
 include/linux/usb/ch9.h |   58
++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 57 insertions(+), 1 deletions(-)
include/linux/usb/ch9.h +16 -0
index da2ed77..a779b86 100644
@@ -123,8 +123,23 @@
 #define USB_DEVICE_A_ALT_HNP_SUPPORT	5	/* (otg) other RH port does */
 #define USB_DEVICE_DEBUG_MODE		6	/* (special devices only) */
 
+/*
+ * New Feature Selectors as added by USB 3.0
+ * See USB 3.0 spec Table 9-6
+ */
+#define USB_DEVICE_U1_ENABLE	48	/* dev may initiate U1 transition */
+#define USB_DEVICE_U2_ENABLE	49	/* dev may initiate U2 transition*/
+#define USB_DEVICE_LTM_ENABLE	50	/* dev may send LTM*/
+#define USB_INTRF_FUNC_SUSPEND	0	/* function suspend*/
+
+#define USB_INTR_FUNC_SUSPEND_OPT_MASK	0xFF00
+
 #define USB_ENDPOINT_HALT		0	/* IN/OUT will STALL */
 
+/* Bit array elements as returned by the USB_REQ_GET_STATUS request. */
+#define USB_DEV_STAT_U1_ENABLED		2	/* transition into U1 state */
+#define USB_DEV_STAT_U2_ENABLED		3	/* transition into U2 state */
+#define USB_DEV_STAT_LTM_ENABLED	4	/* Latency tolerance messages*/
 
 /**
  * struct usb_ctrlrequest - SETUP data for a USB device control request
@@ -675,6 +690,7 @@ struct usb_bos_descriptor {
 	__u8  bNumDeviceCaps;
 } __attribute__((packed));
 
+#define USB_DT_BOS_SIZE		5
 /*-------------------------------------------------------------------------*/
 
 /* USB_DT_DEVICE_CAPABILITY:  grouped with BOS */
@@ -712,16 +728,56 @@ struct usb_wireless_cap_descriptor {	/* Ultra Wide

Band */

include/linux/usb/ch9.h +1 -0
 	__u8  bReserved;
 } __attribute__((packed));
 
+/* USB 2.0 Extension descriptor */
 #define	USB_CAP_TYPE_EXT		2
Quoted 11 lines

include/linux/usb/ch9.h struct usb_wireless_cap_descriptor { /* Ultra Wide Band */ · line 740

Quoted 8 lines

struct usb_ext_cap_descriptor { /* Link Power Management */

include/linux/usb/ch9.h +1 -1
 	__u8  bLength;
 	__u8  bDescriptorType;
 	__u8  bDevCapabilityType;
-	__u8  bmAttributes;
+	__u32 bmAttributes;
 #define USB_LPM_SUPPORT			(1 << 1)	/* supports LPM */
 } __attribute__((packed));

This structure just got bigger? How is that going to affect existing users of it? And shoudn't that be in __le32 format instead of __u32?

I didn't find any existing users of this structure. I'll update it to _le32

Quoted 11 lines
Quoted 11 lines
include/linux/usb/ch9.h +4 -0
+#define USB_DT_USB_EXT_CAP_SIZE	7
+
+/*
+ * SuperSpeed USB Capability descriptor: Defines the set of SuperSpeed

USB
+ * specific device level capabilities
+ */

include/linux/usb/ch9.h +2 -0
+#define		USB_SS_CAP_TYPE		3
+struct usb_ss_cap_descriptor {		/* Link Power Management */
Quoted 8 lines

include/linux/usb/ch9.h struct usb_wireless_cap_descriptor { /* Ultra Wide Band */ · line 755

Quoted 6 lines
include/linux/usb/ch9.h +6 -0
+	__u8  bLength;
+	__u8  bDescriptorType;
+	__u8  bDevCapabilityType;
+	__u8  bmAttributes;
+#define USB_LTM_SUPPORT			(1 << 1) /* supports LTM */
+	__u16 wSpeedSupported;

__le16?

ok.

Quoted 11 lines

include/linux/usb/ch9.h struct usb_wireless_cap_descriptor { /* Ultra Wide Band */ · line 762

Quoted 8 lines
include/linux/usb/ch9.h +7 -0
+#define USB_LOW_SPEED_OPERATION		(1)	 /* Low speed operation */
+#define USB_FULL_SPEED_OPERATION	(1 << 1) /* Full speed operation */
+#define USB_HIGH_SPEED_OPERATION	(1 << 2) /* High speed operation */
+#define USB_5GBPS_OPERATION		(1 << 3) /* Operation at 5Gbps */
+	__u8  bFunctionalitySupport;
+	__u8  bU1devExitLat;
+	__u16 bU2DevExitLat;

__le16? I'm guessing these fields haven't actually been used for anything?

Actually __bU2DevExitLat is not bitwise field so it can remain __u16. And no, their values have been used for nothing but testing the descriptor.

Quoted 13 lines
Quoted 13 lines
include/linux/usb/ch9.h +6 -0
+} __attribute__((packed));
+
+#define USB_DT_USB_SS_CAP_SIZE	10
+
+/*
+ * Container ID Capability descriptor: Defines the instance unique ID

used to
+ * identify the instance across all operating modes
+ */

include/linux/usb/ch9.h +3 -0
+#define	CONTAINER_ID_TYPE	4
+struct usb_ss_container_id_descriptor {
+	__u8  bLength;
Quoted 8 lines

include/linux/usb/ch9.h struct usb_wireless_cap_descriptor { /* Ultra Wide Band */ · line 777

Quoted 4 lines
include/linux/usb/ch9.h +4 -0
+	__u8  bDescriptorType;
+	__u8  bDevCapabilityType;
+	__u8  bReserved;
+	__u8  ContainerID[16]; /* 128-bit number */

Is this number in any specific endian format? If so, you're going to have a hard time handling it as an array of bytes, aren't you? How is this going to be managed?

It's not mentioned to be in any specific endian format. This is a 128-bit number that is unique to a device instance and is used to uniquely identify the device instance across all modes of operations. Note that container ID is optional for all USB30 devices except for hubs. We implemented SuperSpeed support in the gadget framework only so it wasn't used by us. We defined it in order for this patch to be complete with all USB30 required definitions.

Quoted 5 lines

thanks,

greg k-h

Signature · 2 lines
Sent by an consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#3 lore raw
Quoted 5 lines · Brokhman Tatyana
Quoted 5 lines

include/linux/usb/ch9.h line 133

Quoted 5 lines

+ */

include/linux/usb/ch9.h +4 -0
+#define USB_DEVICE_U1_ENABLE	48	/* dev may initiate U1 transition */
+#define USB_DEVICE_U2_ENABLE	49	/* dev may initiate U2 transition*/
+#define USB_DEVICE_LTM_ENABLE	50	/* dev may send LTM*/
+#define USB_INTRF_FUNC_SUSPEND	0	/* function suspend*/

Missing space before the '*/' on these three lines.

Quoted 5 lines
Quoted 2 lines

__le16? I'm guessing these fields haven't actually been used for anything?

Actually __bU2DevExitLat is not bitwise field so it can remain __u16. And no, their values have been used for nothing but testing the descriptor.

The __le16 isn't about bitfields. It's about the fact that the bytes are stored in little-endian form.

#4 lore raw
In reply to Brokhman Tatyana
Quoted 5 lines · Brokhman Tatyana

Adding SuperSpeed usb definitions as defined by ch9 of the USB3.0 spec. This patch is a preparation for adding SuperSpeed support to the gadget framework.

Shouldn't your name be reversed? First Last . Isn't Tatyana your first name?

Daniel

Signature · 2 lines
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.