2
* This file holds Hub protocol constants and data structures that are
3
* defined in chapter 11 (Hub Specification) of the USB 2.0 specification.
5
* It is used/shared between the USB core, the HCDs and couple of other USB
10
#define __LINUX_CH11_H
12
#include <linux/types.h> /* __u8 etc */
18
#define USB_RT_HUB (USB_TYPE_CLASS | USB_RECIP_DEVICE)
19
#define USB_RT_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER)
23
* See USB 2.0 spec Table 11-16
25
#define HUB_CLEAR_TT_BUFFER 8
26
#define HUB_RESET_TT 9
27
#define HUB_GET_TT_STATE 10
28
#define HUB_STOP_TT 11
31
* Hub class additional requests defined by USB 3.0 spec
32
* See USB 3.0 spec Table 10-6
34
#define HUB_SET_DEPTH 12
35
#define HUB_GET_PORT_ERR_COUNT 13
38
* Hub Class feature numbers
39
* See USB 2.0 spec Table 11-17
41
#define C_HUB_LOCAL_POWER 0
42
#define C_HUB_OVER_CURRENT 1
45
* Port feature numbers
46
* See USB 2.0 spec Table 11-17
48
#define USB_PORT_FEAT_CONNECTION 0
49
#define USB_PORT_FEAT_ENABLE 1
50
#define USB_PORT_FEAT_SUSPEND 2 /* L2 suspend */
51
#define USB_PORT_FEAT_OVER_CURRENT 3
52
#define USB_PORT_FEAT_RESET 4
53
#define USB_PORT_FEAT_L1 5 /* L1 suspend */
54
#define USB_PORT_FEAT_POWER 8
55
#define USB_PORT_FEAT_LOWSPEED 9 /* Should never be used */
56
#define USB_PORT_FEAT_C_CONNECTION 16
57
#define USB_PORT_FEAT_C_ENABLE 17
58
#define USB_PORT_FEAT_C_SUSPEND 18
59
#define USB_PORT_FEAT_C_OVER_CURRENT 19
60
#define USB_PORT_FEAT_C_RESET 20
61
#define USB_PORT_FEAT_TEST 21
62
#define USB_PORT_FEAT_INDICATOR 22
63
#define USB_PORT_FEAT_C_PORT_L1 23
66
* Port feature selectors added by USB 3.0 spec.
67
* See USB 3.0 spec Table 10-7
69
#define USB_PORT_FEAT_LINK_STATE 5
70
#define USB_PORT_FEAT_U1_TIMEOUT 23
71
#define USB_PORT_FEAT_U2_TIMEOUT 24
72
#define USB_PORT_FEAT_C_LINK_STATE 25
73
#define USB_PORT_FEAT_C_CONFIG_ERR 26
74
#define USB_PORT_FEAT_REMOTE_WAKE_MASK 27
75
#define USB_PORT_FEAT_BH_PORT_RESET 28
76
#define USB_PORT_FEAT_C_BH_PORT_RESET 29
77
#define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30
80
* Hub Status and Hub Change results
81
* See USB 2.0 spec Table 11-19 and Table 11-20
83
struct usb_port_status {
86
} __attribute__ ((packed));
89
* wPortStatus bit field
90
* See USB 2.0 spec Table 11-21
92
#define USB_PORT_STAT_CONNECTION 0x0001
93
#define USB_PORT_STAT_ENABLE 0x0002
94
#define USB_PORT_STAT_SUSPEND 0x0004
95
#define USB_PORT_STAT_OVERCURRENT 0x0008
96
#define USB_PORT_STAT_RESET 0x0010
97
#define USB_PORT_STAT_L1 0x0020
98
/* bits 6 to 7 are reserved */
99
#define USB_PORT_STAT_POWER 0x0100
100
#define USB_PORT_STAT_LOW_SPEED 0x0200
101
#define USB_PORT_STAT_HIGH_SPEED 0x0400
102
#define USB_PORT_STAT_TEST 0x0800
103
#define USB_PORT_STAT_INDICATOR 0x1000
104
/* bits 13 to 15 are reserved */
105
#define USB_PORT_STAT_SUPER_SPEED 0x8000 /* Linux-internal */
108
* Additions to wPortStatus bit field from USB 3.0
109
* See USB 3.0 spec Table 10-10
111
#define USB_PORT_STAT_LINK_STATE 0x01e0
112
#define USB_SS_PORT_STAT_POWER 0x0200
113
#define USB_PORT_STAT_SPEED_5GBPS 0x0000
114
/* Valid only if port is enabled */
117
* Definitions for PORT_LINK_STATE values
118
* (bits 5-8) in wPortStatus
120
#define USB_SS_PORT_LS_U0 0x0000
121
#define USB_SS_PORT_LS_U1 0x0020
122
#define USB_SS_PORT_LS_U2 0x0040
123
#define USB_SS_PORT_LS_U3 0x0060
124
#define USB_SS_PORT_LS_SS_DISABLED 0x0080
125
#define USB_SS_PORT_LS_RX_DETECT 0x00a0
126
#define USB_SS_PORT_LS_SS_INACTIVE 0x00c0
127
#define USB_SS_PORT_LS_POLLING 0x00e0
128
#define USB_SS_PORT_LS_RECOVERY 0x0100
129
#define USB_SS_PORT_LS_HOT_RESET 0x0120
130
#define USB_SS_PORT_LS_COMP_MOD 0x0140
131
#define USB_SS_PORT_LS_LOOPBACK 0x0160
134
* wPortChange bit field
135
* See USB 2.0 spec Table 11-22
136
* Bits 0 to 4 shown, bits 5 to 15 are reserved
138
#define USB_PORT_STAT_C_CONNECTION 0x0001
139
#define USB_PORT_STAT_C_ENABLE 0x0002
140
#define USB_PORT_STAT_C_SUSPEND 0x0004
141
#define USB_PORT_STAT_C_OVERCURRENT 0x0008
142
#define USB_PORT_STAT_C_RESET 0x0010
143
#define USB_PORT_STAT_C_L1 0x0020
146
* wHubCharacteristics (masks)
147
* See USB 2.0 spec Table 11-13, offset 3
149
#define HUB_CHAR_LPSM 0x0003 /* D1 .. D0 */
150
#define HUB_CHAR_COMPOUND 0x0004 /* D2 */
151
#define HUB_CHAR_OCPM 0x0018 /* D4 .. D3 */
152
#define HUB_CHAR_TTTT 0x0060 /* D6 .. D5 */
153
#define HUB_CHAR_PORTIND 0x0080 /* D7 */
155
struct usb_hub_status {
158
} __attribute__ ((packed));
161
* Hub Status & Hub Change bit masks
162
* See USB 2.0 spec Table 11-19 and Table 11-20
163
* Bits 0 and 1 for wHubStatus and wHubChange
164
* Bits 2 to 15 are reserved for both
166
#define HUB_STATUS_LOCAL_POWER 0x0001
167
#define HUB_STATUS_OVERCURRENT 0x0002
168
#define HUB_CHANGE_LOCAL_POWER 0x0001
169
#define HUB_CHANGE_OVERCURRENT 0x0002
174
* See USB 2.0 spec Table 11-13
177
#define USB_DT_HUB (USB_TYPE_CLASS | 0x09)
178
#define USB_DT_HUB_NONVAR_SIZE 7
180
struct usb_hub_descriptor {
182
__u8 bDescriptorType;
184
__le16 wHubCharacteristics;
186
__u8 bHubContrCurrent;
187
/* add 1 bit for hub status change; round to bytes */
188
__u8 DeviceRemovable[(USB_MAXCHILDREN + 1 + 7) / 8];
189
__u8 PortPwrCtrlMask[(USB_MAXCHILDREN + 1 + 7) / 8];
190
} __attribute__ ((packed));
193
/* port indicator status selectors, tables 11-7 and 11-25 */
194
#define HUB_LED_AUTO 0
195
#define HUB_LED_AMBER 1
196
#define HUB_LED_GREEN 2
197
#define HUB_LED_OFF 3
202
/* software blinks for attention: software, hardware, reserved */
203
INDICATOR_GREEN_BLINK, INDICATOR_GREEN_BLINK_OFF,
204
INDICATOR_AMBER_BLINK, INDICATOR_AMBER_BLINK_OFF,
205
INDICATOR_ALT_BLINK, INDICATOR_ALT_BLINK_OFF
206
} __attribute__ ((packed));
208
/* Transaction Translator Think Times, in bits */
209
#define HUB_TTTT_8_BITS 0x00
210
#define HUB_TTTT_16_BITS 0x20
211
#define HUB_TTTT_24_BITS 0x40
212
#define HUB_TTTT_32_BITS 0x60
214
#endif /* __LINUX_CH11_H */