diff options
author | Eric Lescouet <Eric.Lescouet@virtuallogix.com> | 2010-04-24 17:38:17 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-20 16:21:30 -0400 |
commit | d20db4b4e938aa8e4e5735b5a1b202de5800400e (patch) | |
tree | 7433cdfb9df46cb19016da85682e98a724ae8efb /include/linux/usb/ch11.h | |
parent | d65d7e7ef3dc5e61e4dfaac54ec6d3e97f9a1108 (diff) |
USB: split hub.h into ch11.h and merge-in hcd.h
Base on inputs from Alan Stern, split the hub.h header into:
- new ch11.h header (most of it) containing constants and
structures from chapter 11 of the USB 2.0 spec.
- a small remaining part being merged into hcd.h.
Signed-of-by: Eric Lescouet <eric@lescouet.org>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux/usb/ch11.h')
-rw-r--r-- | include/linux/usb/ch11.h | 172 |
1 files changed, 172 insertions, 0 deletions
diff --git a/include/linux/usb/ch11.h b/include/linux/usb/ch11.h new file mode 100644 index 000000000000..35cb7357ff72 --- /dev/null +++ b/include/linux/usb/ch11.h | |||
@@ -0,0 +1,172 @@ | |||
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. | ||
4 | * | ||
5 | * It is used/shared between the USB core, the HCDs and couple of other USB | ||
6 | * drivers. | ||
7 | */ | ||
8 | |||
9 | #ifndef __LINUX_HUB_H | ||
10 | #define __LINUX_HUB_H | ||
11 | |||
12 | #include <linux/list.h> | ||
13 | #include <linux/workqueue.h> | ||
14 | #include <linux/compiler.h> /* likely()/unlikely() */ | ||
15 | |||
16 | /* | ||
17 | * Hub request types | ||
18 | */ | ||
19 | |||
20 | #define USB_RT_HUB (USB_TYPE_CLASS | USB_RECIP_DEVICE) | ||
21 | #define USB_RT_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER) | ||
22 | |||
23 | /* | ||
24 | * Hub class requests | ||
25 | * See USB 2.0 spec Table 11-16 | ||
26 | */ | ||
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 | ||
31 | |||
32 | /* | ||
33 | * Hub Class feature numbers | ||
34 | * See USB 2.0 spec Table 11-17 | ||
35 | */ | ||
36 | #define C_HUB_LOCAL_POWER 0 | ||
37 | #define C_HUB_OVER_CURRENT 1 | ||
38 | |||
39 | /* | ||
40 | * Port feature numbers | ||
41 | * See USB 2.0 spec Table 11-17 | ||
42 | */ | ||
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 | ||
63 | |||
64 | /* | ||
65 | * Hub Status and Hub Change results | ||
66 | * See USB 2.0 spec Table 11-19 and Table 11-20 | ||
67 | */ | ||
68 | struct usb_port_status { | ||
69 | __le16 wPortStatus; | ||
70 | __le16 wPortChange; | ||
71 | } __attribute__ ((packed)); | ||
72 | |||
73 | /* | ||
74 | * wPortStatus bit field | ||
75 | * See USB 2.0 spec Table 11-21 | ||
76 | */ | ||
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 */ | ||
90 | |||
91 | /* | ||
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 | ||
95 | */ | ||
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 | ||
102 | |||
103 | /* | ||
104 | * wHubCharacteristics (masks) | ||
105 | * See USB 2.0 spec Table 11-13, offset 3 | ||
106 | */ | ||
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 */ | ||
112 | |||
113 | struct usb_hub_status { | ||
114 | __le16 wHubStatus; | ||
115 | __le16 wHubChange; | ||
116 | } __attribute__ ((packed)); | ||
117 | |||
118 | /* | ||
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 | ||
123 | */ | ||
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 | ||
128 | |||
129 | |||
130 | /* | ||
131 | * Hub descriptor | ||
132 | * See USB 2.0 spec Table 11-13 | ||
133 | */ | ||
134 | |||
135 | #define USB_DT_HUB (USB_TYPE_CLASS | 0x09) | ||
136 | #define USB_DT_HUB_NONVAR_SIZE 7 | ||
137 | |||
138 | struct usb_hub_descriptor { | ||
139 | __u8 bDescLength; | ||
140 | __u8 bDescriptorType; | ||
141 | __u8 bNbrPorts; | ||
142 | __le16 wHubCharacteristics; | ||
143 | __u8 bPwrOn2PwrGood; | ||
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)); | ||
149 | |||
150 | |||
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 | ||
156 | |||
157 | enum hub_led_mode { | ||
158 | INDICATOR_AUTO = 0, | ||
159 | INDICATOR_CYCLE, | ||
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)); | ||
165 | |||
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 | ||
171 | |||
172 | #endif /* __LINUX_HUB_H */ | ||