blob: bb5c1ae151c44ff3a7c0abf0a03ed409e4fcd744 [file] [log] [blame]
Nicholas Flintham1e3d3112013-04-10 10:48:38 +01001
2#ifndef __LINUX_CH11_H
3#define __LINUX_CH11_H
4
5#include <linux/types.h>
6
7
8#define USB_RT_HUB (USB_TYPE_CLASS | USB_RECIP_DEVICE)
9#define USB_RT_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER)
10
11#define HUB_CLEAR_TT_BUFFER 8
12#define HUB_RESET_TT 9
13#define HUB_GET_TT_STATE 10
14#define HUB_STOP_TT 11
15
16#define HUB_SET_DEPTH 12
17#define HUB_GET_PORT_ERR_COUNT 13
18
19#define C_HUB_LOCAL_POWER 0
20#define C_HUB_OVER_CURRENT 1
21
22#define USB_PORT_FEAT_CONNECTION 0
23#define USB_PORT_FEAT_ENABLE 1
24#define USB_PORT_FEAT_SUSPEND 2
25#define USB_PORT_FEAT_OVER_CURRENT 3
26#define USB_PORT_FEAT_RESET 4
27#define USB_PORT_FEAT_L1 5
28#define USB_PORT_FEAT_POWER 8
29#define USB_PORT_FEAT_LOWSPEED 9
30#define USB_PORT_FEAT_C_CONNECTION 16
31#define USB_PORT_FEAT_C_ENABLE 17
32#define USB_PORT_FEAT_C_SUSPEND 18
33#define USB_PORT_FEAT_C_OVER_CURRENT 19
34#define USB_PORT_FEAT_C_RESET 20
35#define USB_PORT_FEAT_TEST 21
36#define USB_PORT_FEAT_INDICATOR 22
37#define USB_PORT_FEAT_C_PORT_L1 23
38
39#define USB_PORT_FEAT_LINK_STATE 5
40#define USB_PORT_FEAT_U1_TIMEOUT 23
41#define USB_PORT_FEAT_U2_TIMEOUT 24
42#define USB_PORT_FEAT_C_PORT_LINK_STATE 25
43#define USB_PORT_FEAT_C_PORT_CONFIG_ERROR 26
44#define USB_PORT_FEAT_REMOTE_WAKE_MASK 27
45#define USB_PORT_FEAT_BH_PORT_RESET 28
46#define USB_PORT_FEAT_C_BH_PORT_RESET 29
47#define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30
48
49#define USB_PORT_FEAT_REMOTE_WAKE_CONNECT (1 << 8)
50#define USB_PORT_FEAT_REMOTE_WAKE_DISCONNECT (1 << 9)
51#define USB_PORT_FEAT_REMOTE_WAKE_OVER_CURRENT (1 << 10)
52
53struct usb_port_status {
54 __le16 wPortStatus;
55 __le16 wPortChange;
56} __attribute__ ((packed));
57
58#define USB_PORT_STAT_CONNECTION 0x0001
59#define USB_PORT_STAT_ENABLE 0x0002
60#define USB_PORT_STAT_SUSPEND 0x0004
61#define USB_PORT_STAT_OVERCURRENT 0x0008
62#define USB_PORT_STAT_RESET 0x0010
63#define USB_PORT_STAT_L1 0x0020
64#define USB_PORT_STAT_POWER 0x0100
65#define USB_PORT_STAT_LOW_SPEED 0x0200
66#define USB_PORT_STAT_HIGH_SPEED 0x0400
67#define USB_PORT_STAT_TEST 0x0800
68#define USB_PORT_STAT_INDICATOR 0x1000
69
70#define USB_PORT_STAT_LINK_STATE 0x01e0
71#define USB_SS_PORT_STAT_POWER 0x0200
72#define USB_SS_PORT_STAT_SPEED 0x1c00
73#define USB_PORT_STAT_SPEED_5GBPS 0x0000
74#define USB_SS_PORT_STAT_MASK (USB_PORT_STAT_CONNECTION | \
75 USB_PORT_STAT_ENABLE | \
76 USB_PORT_STAT_OVERCURRENT | \
77 USB_PORT_STAT_RESET)
78
79#define USB_SS_PORT_LS_U0 0x0000
80#define USB_SS_PORT_LS_U1 0x0020
81#define USB_SS_PORT_LS_U2 0x0040
82#define USB_SS_PORT_LS_U3 0x0060
83#define USB_SS_PORT_LS_SS_DISABLED 0x0080
84#define USB_SS_PORT_LS_RX_DETECT 0x00a0
85#define USB_SS_PORT_LS_SS_INACTIVE 0x00c0
86#define USB_SS_PORT_LS_POLLING 0x00e0
87#define USB_SS_PORT_LS_RECOVERY 0x0100
88#define USB_SS_PORT_LS_HOT_RESET 0x0120
89#define USB_SS_PORT_LS_COMP_MOD 0x0140
90#define USB_SS_PORT_LS_LOOPBACK 0x0160
91
92#define USB_PORT_STAT_C_CONNECTION 0x0001
93#define USB_PORT_STAT_C_ENABLE 0x0002
94#define USB_PORT_STAT_C_SUSPEND 0x0004
95#define USB_PORT_STAT_C_OVERCURRENT 0x0008
96#define USB_PORT_STAT_C_RESET 0x0010
97#define USB_PORT_STAT_C_L1 0x0020
98#define USB_PORT_STAT_C_BH_RESET 0x0020
99#define USB_PORT_STAT_C_LINK_STATE 0x0040
100#define USB_PORT_STAT_C_CONFIG_ERROR 0x0080
101
102#define HUB_CHAR_LPSM 0x0003
103#define HUB_CHAR_COMMON_LPSM 0x0000
104#define HUB_CHAR_INDV_PORT_LPSM 0x0001
105#define HUB_CHAR_NO_LPSM 0x0002
106
107#define HUB_CHAR_COMPOUND 0x0004
108
109#define HUB_CHAR_OCPM 0x0018
110#define HUB_CHAR_COMMON_OCPM 0x0000
111#define HUB_CHAR_INDV_PORT_OCPM 0x0008
112#define HUB_CHAR_NO_OCPM 0x0010
113
114#define HUB_CHAR_TTTT 0x0060
115#define HUB_CHAR_PORTIND 0x0080
116
117struct usb_hub_status {
118 __le16 wHubStatus;
119 __le16 wHubChange;
120} __attribute__ ((packed));
121
122#define HUB_STATUS_LOCAL_POWER 0x0001
123#define HUB_STATUS_OVERCURRENT 0x0002
124#define HUB_CHANGE_LOCAL_POWER 0x0001
125#define HUB_CHANGE_OVERCURRENT 0x0002
126
127
128
129#define USB_DT_HUB (USB_TYPE_CLASS | 0x09)
130#define USB_DT_SS_HUB (USB_TYPE_CLASS | 0x0a)
131#define USB_DT_HUB_NONVAR_SIZE 7
132#define USB_DT_SS_HUB_SIZE 12
133
134
135#define USB_HUB_PR_FS 0
136#define USB_HUB_PR_HS_NO_TT 0
137#define USB_HUB_PR_HS_SINGLE_TT 1
138#define USB_HUB_PR_HS_MULTI_TT 2
139#define USB_HUB_PR_SS 3
140
141struct usb_hub_descriptor {
142 __u8 bDescLength;
143 __u8 bDescriptorType;
144 __u8 bNbrPorts;
145 __le16 wHubCharacteristics;
146 __u8 bPwrOn2PwrGood;
147 __u8 bHubContrCurrent;
148
149
150 union {
151 struct {
152
153 __u8 DeviceRemovable[(USB_MAXCHILDREN + 1 + 7) / 8];
154 __u8 PortPwrCtrlMask[(USB_MAXCHILDREN + 1 + 7) / 8];
155 } __attribute__ ((packed)) hs;
156
157 struct {
158 __u8 bHubHdrDecLat;
159 __u16 wHubDelay;
160 __u16 DeviceRemovable;
161 } __attribute__ ((packed)) ss;
162 } u;
163} __attribute__ ((packed));
164
165#define HUB_LED_AUTO 0
166#define HUB_LED_AMBER 1
167#define HUB_LED_GREEN 2
168#define HUB_LED_OFF 3
169
170enum hub_led_mode {
171 INDICATOR_AUTO = 0,
172 INDICATOR_CYCLE,
173
174 INDICATOR_GREEN_BLINK, INDICATOR_GREEN_BLINK_OFF,
175 INDICATOR_AMBER_BLINK, INDICATOR_AMBER_BLINK_OFF,
176 INDICATOR_ALT_BLINK, INDICATOR_ALT_BLINK_OFF
177} __attribute__ ((packed));
178
179#define HUB_TTTT_8_BITS 0x00
180#define HUB_TTTT_16_BITS 0x20
181#define HUB_TTTT_24_BITS 0x40
182#define HUB_TTTT_32_BITS 0x60
183
184#endif