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
12 #include <linux/list.h>
13 #include <linux/workqueue.h>
14 #include <linux/compiler.h> /* likely()/unlikely() */
20 #define USB_RT_HUB (USB_TYPE_CLASS | USB_RECIP_DEVICE)
21 #define USB_RT_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER)
25 * See USB 2.0 spec Table 11-16
27 #define HUB_CLEAR_TT_BUFFER 8
28 #define HUB_RESET_TT 9
29 #define HUB_GET_TT_STATE 10
30 #define HUB_STOP_TT 11
33 * Hub Class feature numbers
34 * See USB 2.0 spec Table 11-17
36 #define C_HUB_LOCAL_POWER 0
37 #define C_HUB_OVER_CURRENT 1
40 * Port feature numbers
41 * See USB 2.0 spec Table 11-17
43 #define USB_PORT_FEAT_CONNECTION 0
44 #define USB_PORT_FEAT_ENABLE 1
45 #define USB_PORT_FEAT_SUSPEND 2 /* L2 suspend */
46 #define USB_PORT_FEAT_OVER_CURRENT 3
47 #define USB_PORT_FEAT_RESET 4
48 #define USB_PORT_FEAT_L1 5 /* L1 suspend */
49 #define USB_PORT_FEAT_POWER 8
50 #define USB_PORT_FEAT_LOWSPEED 9
51 /* This value was never in Table 11-17 */
52 #define USB_PORT_FEAT_HIGHSPEED 10
53 /* This value is also fake */
54 #define USB_PORT_FEAT_SUPERSPEED 11
55 #define USB_PORT_FEAT_C_CONNECTION 16
56 #define USB_PORT_FEAT_C_ENABLE 17
57 #define USB_PORT_FEAT_C_SUSPEND 18
58 #define USB_PORT_FEAT_C_OVER_CURRENT 19
59 #define USB_PORT_FEAT_C_RESET 20
60 #define USB_PORT_FEAT_TEST 21
61 #define USB_PORT_FEAT_INDICATOR 22
62 #define USB_PORT_FEAT_C_PORT_L1 23
65 * Hub Status and Hub Change results
66 * See USB 2.0 spec Table 11-19 and Table 11-20
68 struct usb_port_status {
71 } __attribute__ ((packed));
74 * wPortStatus bit field
75 * See USB 2.0 spec Table 11-21
77 #define USB_PORT_STAT_CONNECTION 0x0001
78 #define USB_PORT_STAT_ENABLE 0x0002
79 #define USB_PORT_STAT_SUSPEND 0x0004
80 #define USB_PORT_STAT_OVERCURRENT 0x0008
81 #define USB_PORT_STAT_RESET 0x0010
82 #define USB_PORT_STAT_L1 0x0020
83 /* bits 6 to 7 are reserved */
84 #define USB_PORT_STAT_POWER 0x0100
85 #define USB_PORT_STAT_LOW_SPEED 0x0200
86 #define USB_PORT_STAT_HIGH_SPEED 0x0400
87 #define USB_PORT_STAT_TEST 0x0800
88 #define USB_PORT_STAT_INDICATOR 0x1000
89 /* bits 13 to 15 are reserved */
92 * wPortChange bit field
93 * See USB 2.0 spec Table 11-22
94 * Bits 0 to 4 shown, bits 5 to 15 are reserved
96 #define USB_PORT_STAT_C_CONNECTION 0x0001
97 #define USB_PORT_STAT_C_ENABLE 0x0002
98 #define USB_PORT_STAT_C_SUSPEND 0x0004
99 #define USB_PORT_STAT_C_OVERCURRENT 0x0008
100 #define USB_PORT_STAT_C_RESET 0x0010
101 #define USB_PORT_STAT_C_L1 0x0020
104 * wHubCharacteristics (masks)
105 * See USB 2.0 spec Table 11-13, offset 3
107 #define HUB_CHAR_LPSM 0x0003 /* D1 .. D0 */
108 #define HUB_CHAR_COMPOUND 0x0004 /* D2 */
109 #define HUB_CHAR_OCPM 0x0018 /* D4 .. D3 */
110 #define HUB_CHAR_TTTT 0x0060 /* D6 .. D5 */
111 #define HUB_CHAR_PORTIND 0x0080 /* D7 */
113 struct usb_hub_status {
116 } __attribute__ ((packed));
119 * Hub Status & Hub Change bit masks
120 * See USB 2.0 spec Table 11-19 and Table 11-20
121 * Bits 0 and 1 for wHubStatus and wHubChange
122 * Bits 2 to 15 are reserved for both
124 #define HUB_STATUS_LOCAL_POWER 0x0001
125 #define HUB_STATUS_OVERCURRENT 0x0002
126 #define HUB_CHANGE_LOCAL_POWER 0x0001
127 #define HUB_CHANGE_OVERCURRENT 0x0002
132 * See USB 2.0 spec Table 11-13
135 #define USB_DT_HUB (USB_TYPE_CLASS | 0x09)
136 #define USB_DT_HUB_NONVAR_SIZE 7
138 struct usb_hub_descriptor {
140 __u8 bDescriptorType;
142 __le16 wHubCharacteristics;
144 __u8 bHubContrCurrent;
145 /* add 1 bit for hub status change; round to bytes */
146 __u8 DeviceRemovable[(USB_MAXCHILDREN + 1 + 7) / 8];
147 __u8 PortPwrCtrlMask[(USB_MAXCHILDREN + 1 + 7) / 8];
148 } __attribute__ ((packed));
151 /* port indicator status selectors, tables 11-7 and 11-25 */
152 #define HUB_LED_AUTO 0
153 #define HUB_LED_AMBER 1
154 #define HUB_LED_GREEN 2
155 #define HUB_LED_OFF 3
160 /* software blinks for attention: software, hardware, reserved */
161 INDICATOR_GREEN_BLINK, INDICATOR_GREEN_BLINK_OFF,
162 INDICATOR_AMBER_BLINK, INDICATOR_AMBER_BLINK_OFF,
163 INDICATOR_ALT_BLINK, INDICATOR_ALT_BLINK_OFF
164 } __attribute__ ((packed));
166 /* Transaction Translator Think Times, in bits */
167 #define HUB_TTTT_8_BITS 0x00
168 #define HUB_TTTT_16_BITS 0x20
169 #define HUB_TTTT_24_BITS 0x40
170 #define HUB_TTTT_32_BITS 0x60
172 #endif /* __LINUX_HUB_H */