33 #ifndef _UAPI__LINUX_USB_CH9_H
34 #define _UAPI__LINUX_USB_CH9_H
36 #include <linux/types.h>
37 #include <asm/byteorder.h>
50 #define USB_DIR_IN 0x80
55 #define USB_TYPE_MASK (0x03 << 5)
56 #define USB_TYPE_STANDARD (0x00 << 5)
57 #define USB_TYPE_CLASS (0x01 << 5)
58 #define USB_TYPE_VENDOR (0x02 << 5)
59 #define USB_TYPE_RESERVED (0x03 << 5)
64 #define USB_RECIP_MASK 0x1f
65 #define USB_RECIP_DEVICE 0x00
66 #define USB_RECIP_INTERFACE 0x01
67 #define USB_RECIP_ENDPOINT 0x02
68 #define USB_RECIP_OTHER 0x03
70 #define USB_RECIP_PORT 0x04
71 #define USB_RECIP_RPIPE 0x05
80 #define USB_REQ_GET_STATUS 0x00
81 #define USB_REQ_CLEAR_FEATURE 0x01
82 #define USB_REQ_SET_FEATURE 0x03
83 #define USB_REQ_SET_ADDRESS 0x05
84 #define USB_REQ_GET_DESCRIPTOR 0x06
85 #define USB_REQ_SET_DESCRIPTOR 0x07
86 #define USB_REQ_GET_CONFIGURATION 0x08
87 #define USB_REQ_SET_CONFIGURATION 0x09
88 #define USB_REQ_GET_INTERFACE 0x0A
89 #define USB_REQ_SET_INTERFACE 0x0B
90 #define USB_REQ_SYNCH_FRAME 0x0C
91 #define USB_REQ_SET_SEL 0x30
92 #define USB_REQ_SET_ISOCH_DELAY 0x31
94 #define USB_REQ_SET_ENCRYPTION 0x0D
95 #define USB_REQ_GET_ENCRYPTION 0x0E
96 #define USB_REQ_RPIPE_ABORT 0x0E
97 #define USB_REQ_SET_HANDSHAKE 0x0F
98 #define USB_REQ_RPIPE_RESET 0x0F
99 #define USB_REQ_GET_HANDSHAKE 0x10
100 #define USB_REQ_SET_CONNECTION 0x11
101 #define USB_REQ_SET_SECURITY_DATA 0x12
102 #define USB_REQ_GET_SECURITY_DATA 0x13
103 #define USB_REQ_SET_WUSB_DATA 0x14
104 #define USB_REQ_LOOPBACK_DATA_WRITE 0x15
105 #define USB_REQ_LOOPBACK_DATA_READ 0x16
106 #define USB_REQ_SET_INTERFACE_DS 0x17
119 #define USB_DEVICE_SELF_POWERED 0
120 #define USB_DEVICE_REMOTE_WAKEUP 1
121 #define USB_DEVICE_TEST_MODE 2
122 #define USB_DEVICE_BATTERY 2
123 #define USB_DEVICE_B_HNP_ENABLE 3
124 #define USB_DEVICE_WUSB_DEVICE 3
125 #define USB_DEVICE_A_HNP_SUPPORT 4
126 #define USB_DEVICE_A_ALT_HNP_SUPPORT 5
127 #define USB_DEVICE_DEBUG_MODE 6
135 #define TEST_SE0_NAK 3
136 #define TEST_PACKET 4
137 #define TEST_FORCE_EN 5
143 #define USB_DEVICE_U1_ENABLE 48
144 #define USB_DEVICE_U2_ENABLE 49
145 #define USB_DEVICE_LTM_ENABLE 50
146 #define USB_INTRF_FUNC_SUSPEND 0
148 #define USB_INTR_FUNC_SUSPEND_OPT_MASK 0xFF00
152 #define USB_INTRF_FUNC_SUSPEND_LP (1 << (8 + 0))
153 #define USB_INTRF_FUNC_SUSPEND_RW (1 << (8 + 1))
155 #define USB_ENDPOINT_HALT 0
158 #define USB_DEV_STAT_U1_ENABLED 2
159 #define USB_DEV_STAT_U2_ENABLED 3
160 #define USB_DEV_STAT_LTM_ENABLED 4
205 #define USB_DT_DEVICE 0x01
206 #define USB_DT_CONFIG 0x02
207 #define USB_DT_STRING 0x03
208 #define USB_DT_INTERFACE 0x04
209 #define USB_DT_ENDPOINT 0x05
210 #define USB_DT_DEVICE_QUALIFIER 0x06
211 #define USB_DT_OTHER_SPEED_CONFIG 0x07
212 #define USB_DT_INTERFACE_POWER 0x08
214 #define USB_DT_OTG 0x09
215 #define USB_DT_DEBUG 0x0a
216 #define USB_DT_INTERFACE_ASSOCIATION 0x0b
218 #define USB_DT_SECURITY 0x0c
219 #define USB_DT_KEY 0x0d
220 #define USB_DT_ENCRYPTION_TYPE 0x0e
221 #define USB_DT_BOS 0x0f
222 #define USB_DT_DEVICE_CAPABILITY 0x10
223 #define USB_DT_WIRELESS_ENDPOINT_COMP 0x11
224 #define USB_DT_WIRE_ADAPTER 0x21
225 #define USB_DT_RPIPE 0x22
226 #define USB_DT_CS_RADIO_CONTROL 0x23
228 #define USB_DT_PIPE_USAGE 0x24
230 #define USB_DT_SS_ENDPOINT_COMP 0x30
236 #define USB_DT_CS_DEVICE (USB_TYPE_CLASS | USB_DT_DEVICE)
237 #define USB_DT_CS_CONFIG (USB_TYPE_CLASS | USB_DT_CONFIG)
238 #define USB_DT_CS_STRING (USB_TYPE_CLASS | USB_DT_STRING)
239 #define USB_DT_CS_INTERFACE (USB_TYPE_CLASS | USB_DT_INTERFACE)
240 #define USB_DT_CS_ENDPOINT (USB_TYPE_CLASS | USB_DT_ENDPOINT)
270 #define USB_DT_DEVICE_SIZE 18
278 #define USB_CLASS_PER_INTERFACE 0
279 #define USB_CLASS_AUDIO 1
280 #define USB_CLASS_COMM 2
281 #define USB_CLASS_HID 3
282 #define USB_CLASS_PHYSICAL 5
283 #define USB_CLASS_STILL_IMAGE 6
284 #define USB_CLASS_PRINTER 7
285 #define USB_CLASS_MASS_STORAGE 8
286 #define USB_CLASS_HUB 9
287 #define USB_CLASS_CDC_DATA 0x0a
288 #define USB_CLASS_CSCID 0x0b
289 #define USB_CLASS_CONTENT_SEC 0x0d
290 #define USB_CLASS_VIDEO 0x0e
291 #define USB_CLASS_WIRELESS_CONTROLLER 0xe0
292 #define USB_CLASS_MISC 0xef
293 #define USB_CLASS_APP_SPEC 0xfe
294 #define USB_CLASS_VENDOR_SPEC 0xff
296 #define USB_SUBCLASS_VENDOR_SPEC 0xff
320 #define USB_DT_CONFIG_SIZE 9
323 #define USB_CONFIG_ATT_ONE (1 << 7)
324 #define USB_CONFIG_ATT_SELFPOWER (1 << 6)
325 #define USB_CONFIG_ATT_WAKEUP (1 << 5)
326 #define USB_CONFIG_ATT_BATTERY (1 << 4)
358 #define USB_DT_INTERFACE_SIZE 9
378 #define USB_DT_ENDPOINT_SIZE 7
379 #define USB_DT_ENDPOINT_AUDIO_SIZE 9
385 #define USB_ENDPOINT_NUMBER_MASK 0x0f
386 #define USB_ENDPOINT_DIR_MASK 0x80
388 #define USB_ENDPOINT_XFERTYPE_MASK 0x03
389 #define USB_ENDPOINT_XFER_CONTROL 0
390 #define USB_ENDPOINT_XFER_ISOC 1
391 #define USB_ENDPOINT_XFER_BULK 2
392 #define USB_ENDPOINT_XFER_INT 3
393 #define USB_ENDPOINT_MAX_ADJUSTABLE 0x80
396 #define USB_ENDPOINT_INTRTYPE 0x30
397 #define USB_ENDPOINT_INTR_PERIODIC (0 << 4)
398 #define USB_ENDPOINT_INTR_NOTIFICATION (1 << 4)
400 #define USB_ENDPOINT_SYNCTYPE 0x0c
401 #define USB_ENDPOINT_SYNC_NONE (0 << 2)
402 #define USB_ENDPOINT_SYNC_ASYNC (1 << 2)
403 #define USB_ENDPOINT_SYNC_ADAPTIVE (2 << 2)
404 #define USB_ENDPOINT_SYNC_SYNC (3 << 2)
406 #define USB_ENDPOINT_USAGE_MASK 0x30
407 #define USB_ENDPOINT_USAGE_DATA 0x00
408 #define USB_ENDPOINT_USAGE_FEEDBACK 0x10
409 #define USB_ENDPOINT_USAGE_IMPLICIT_FB 0x20
453 static inline int usb_endpoint_dir_out(
465 static inline int usb_endpoint_xfer_bulk(
478 static inline int usb_endpoint_xfer_control(
492 static inline int usb_endpoint_xfer_int(
506 static inline int usb_endpoint_xfer_isoc(
520 static inline int usb_endpoint_is_bulk_in(
523 return usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd);
533 static inline int usb_endpoint_is_bulk_out(
536 return usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd);
546 static inline int usb_endpoint_is_int_in(
549 return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd);
559 static inline int usb_endpoint_is_int_out(
562 return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd);
572 static inline int usb_endpoint_is_isoc_in(
575 return usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd);
585 static inline int usb_endpoint_is_isoc_out(
588 return usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd);
602 static inline int usb_endpoint_interrupt_type(
620 #define USB_DT_SS_EP_COMP_SIZE 6
636 max_streams = 1 << max_streams;
642 #define USB_SS_MULT(p) (1 + ((p) & 0x3))
672 #define USB_OTG_SRP (1 << 0)
673 #define USB_OTG_HNP (1 << 1)
738 #define USB_ENC_TYPE_UNSECURE 0
739 #define USB_ENC_TYPE_WIRED 1
740 #define USB_ENC_TYPE_CCM_1 2
741 #define USB_ENC_TYPE_RSA_1 3
758 #define USB_DT_BOS_SIZE 5
768 #define USB_CAP_TYPE_WIRELESS_USB 1
776 #define USB_WIRELESS_P2P_DRD (1 << 1)
777 #define USB_WIRELESS_BEACON_MASK (3 << 2)
778 #define USB_WIRELESS_BEACON_SELF (1 << 2)
779 #define USB_WIRELESS_BEACON_DIRECTED (2 << 2)
780 #define USB_WIRELESS_BEACON_NONE (3 << 2)
782 #define USB_WIRELESS_PHY_53 (1 << 0)
783 #define USB_WIRELESS_PHY_80 (1 << 1)
784 #define USB_WIRELESS_PHY_107 (1 << 2)
785 #define USB_WIRELESS_PHY_160 (1 << 3)
786 #define USB_WIRELESS_PHY_200 (1 << 4)
787 #define USB_WIRELESS_PHY_320 (1 << 5)
788 #define USB_WIRELESS_PHY_400 (1 << 6)
789 #define USB_WIRELESS_PHY_480 (1 << 7)
797 #define USB_CAP_TYPE_EXT 2
804 #define USB_LPM_SUPPORT (1 << 1)
805 #define USB_BESL_SUPPORT (1 << 2)
806 #define USB_BESL_BASELINE_VALID (1 << 3)
807 #define USB_BESL_DEEP_VALID (1 << 4)
808 #define USB_GET_BESL_BASELINE(p) (((p) & (0xf << 8)) >> 8)
809 #define USB_GET_BESL_DEEP(p) (((p) & (0xf << 12)) >> 12)
812 #define USB_DT_USB_EXT_CAP_SIZE 7
818 #define USB_SS_CAP_TYPE 3
824 #define USB_LTM_SUPPORT (1 << 1)
826 #define USB_LOW_SPEED_OPERATION (1)
827 #define USB_FULL_SPEED_OPERATION (1 << 1)
828 #define USB_HIGH_SPEED_OPERATION (1 << 2)
829 #define USB_5GBPS_OPERATION (1 << 3)
835 #define USB_DT_USB_SS_CAP_SIZE 10
841 #define CONTAINER_ID_TYPE 4
850 #define USB_DT_USB_SS_CONTN_ID_SIZE 20
866 #define USB_ENDPOINT_SWITCH_MASK 0x03
867 #define USB_ENDPOINT_SWITCH_NO 0
868 #define USB_ENDPOINT_SWITCH_SWITCH 1
869 #define USB_ENDPOINT_SWITCH_SCALE 2
963 #define USB3_LPM_DISABLED 0x0
964 #define USB3_LPM_U1_MAX_TIMEOUT 0x7F
965 #define USB3_LPM_U2_MAX_TIMEOUT 0xFE
966 #define USB3_LPM_DEVICE_INITIATED 0xFF
980 #define USB3_LPM_MAX_U1_SEL_PEL 0xFF
981 #define USB3_LPM_MAX_U2_SEL_PEL 0xFFFF
991 #define USB_SELF_POWER_VBUS_MAX_DRAW 100