USB: remove bogus USB_PORT_FEAT_*_SPEED symbols
[linux-2.6.git] / include / linux / usb / ch11.h
blobbd3185aba4eee9f878d87696c4e79371f1e6bf27
1 /*
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
6 * drivers.
7 */
9 #ifndef __LINUX_HUB_H
10 #define __LINUX_HUB_H
12 #include <linux/list.h>
13 #include <linux/workqueue.h>
14 #include <linux/compiler.h> /* likely()/unlikely() */
17 * Hub request types
20 #define USB_RT_HUB (USB_TYPE_CLASS | USB_RECIP_DEVICE)
21 #define USB_RT_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER)
24 * Hub class requests
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 /* Should never be used */
51 #define USB_PORT_FEAT_C_CONNECTION 16
52 #define USB_PORT_FEAT_C_ENABLE 17
53 #define USB_PORT_FEAT_C_SUSPEND 18
54 #define USB_PORT_FEAT_C_OVER_CURRENT 19
55 #define USB_PORT_FEAT_C_RESET 20
56 #define USB_PORT_FEAT_TEST 21
57 #define USB_PORT_FEAT_INDICATOR 22
58 #define USB_PORT_FEAT_C_PORT_L1 23
61 * Hub Status and Hub Change results
62 * See USB 2.0 spec Table 11-19 and Table 11-20
64 struct usb_port_status {
65 __le16 wPortStatus;
66 __le16 wPortChange;
67 } __attribute__ ((packed));
70 * wPortStatus bit field
71 * See USB 2.0 spec Table 11-21
73 #define USB_PORT_STAT_CONNECTION 0x0001
74 #define USB_PORT_STAT_ENABLE 0x0002
75 #define USB_PORT_STAT_SUSPEND 0x0004
76 #define USB_PORT_STAT_OVERCURRENT 0x0008
77 #define USB_PORT_STAT_RESET 0x0010
78 #define USB_PORT_STAT_L1 0x0020
79 /* bits 6 to 7 are reserved */
80 #define USB_PORT_STAT_POWER 0x0100
81 #define USB_PORT_STAT_LOW_SPEED 0x0200
82 #define USB_PORT_STAT_HIGH_SPEED 0x0400
83 #define USB_PORT_STAT_TEST 0x0800
84 #define USB_PORT_STAT_INDICATOR 0x1000
85 /* bits 13 to 15 are reserved */
86 #define USB_PORT_STAT_SUPER_SPEED 0x8000 /* Linux-internal */
89 * wPortChange bit field
90 * See USB 2.0 spec Table 11-22
91 * Bits 0 to 4 shown, bits 5 to 15 are reserved
93 #define USB_PORT_STAT_C_CONNECTION 0x0001
94 #define USB_PORT_STAT_C_ENABLE 0x0002
95 #define USB_PORT_STAT_C_SUSPEND 0x0004
96 #define USB_PORT_STAT_C_OVERCURRENT 0x0008
97 #define USB_PORT_STAT_C_RESET 0x0010
98 #define USB_PORT_STAT_C_L1 0x0020
101 * wHubCharacteristics (masks)
102 * See USB 2.0 spec Table 11-13, offset 3
104 #define HUB_CHAR_LPSM 0x0003 /* D1 .. D0 */
105 #define HUB_CHAR_COMPOUND 0x0004 /* D2 */
106 #define HUB_CHAR_OCPM 0x0018 /* D4 .. D3 */
107 #define HUB_CHAR_TTTT 0x0060 /* D6 .. D5 */
108 #define HUB_CHAR_PORTIND 0x0080 /* D7 */
110 struct usb_hub_status {
111 __le16 wHubStatus;
112 __le16 wHubChange;
113 } __attribute__ ((packed));
116 * Hub Status & Hub Change bit masks
117 * See USB 2.0 spec Table 11-19 and Table 11-20
118 * Bits 0 and 1 for wHubStatus and wHubChange
119 * Bits 2 to 15 are reserved for both
121 #define HUB_STATUS_LOCAL_POWER 0x0001
122 #define HUB_STATUS_OVERCURRENT 0x0002
123 #define HUB_CHANGE_LOCAL_POWER 0x0001
124 #define HUB_CHANGE_OVERCURRENT 0x0002
128 * Hub descriptor
129 * See USB 2.0 spec Table 11-13
132 #define USB_DT_HUB (USB_TYPE_CLASS | 0x09)
133 #define USB_DT_HUB_NONVAR_SIZE 7
135 struct usb_hub_descriptor {
136 __u8 bDescLength;
137 __u8 bDescriptorType;
138 __u8 bNbrPorts;
139 __le16 wHubCharacteristics;
140 __u8 bPwrOn2PwrGood;
141 __u8 bHubContrCurrent;
142 /* add 1 bit for hub status change; round to bytes */
143 __u8 DeviceRemovable[(USB_MAXCHILDREN + 1 + 7) / 8];
144 __u8 PortPwrCtrlMask[(USB_MAXCHILDREN + 1 + 7) / 8];
145 } __attribute__ ((packed));
148 /* port indicator status selectors, tables 11-7 and 11-25 */
149 #define HUB_LED_AUTO 0
150 #define HUB_LED_AMBER 1
151 #define HUB_LED_GREEN 2
152 #define HUB_LED_OFF 3
154 enum hub_led_mode {
155 INDICATOR_AUTO = 0,
156 INDICATOR_CYCLE,
157 /* software blinks for attention: software, hardware, reserved */
158 INDICATOR_GREEN_BLINK, INDICATOR_GREEN_BLINK_OFF,
159 INDICATOR_AMBER_BLINK, INDICATOR_AMBER_BLINK_OFF,
160 INDICATOR_ALT_BLINK, INDICATOR_ALT_BLINK_OFF
161 } __attribute__ ((packed));
163 /* Transaction Translator Think Times, in bits */
164 #define HUB_TTTT_8_BITS 0x00
165 #define HUB_TTTT_16_BITS 0x20
166 #define HUB_TTTT_24_BITS 0x40
167 #define HUB_TTTT_32_BITS 0x60
169 #endif /* __LINUX_HUB_H */