0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef __LINUX_CH11_H
0011 #define __LINUX_CH11_H
0012
0013 #include <linux/types.h> /* __u8 etc */
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 #define USB_MAXCHILDREN 31
0025
0026
0027 #define USB_SS_MAXPORTS 15
0028
0029
0030
0031
0032
0033 #define USB_RT_HUB (USB_TYPE_CLASS | USB_RECIP_DEVICE)
0034 #define USB_RT_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER)
0035
0036
0037
0038
0039
0040 #define HUB_PORT_STATUS 0
0041 #define HUB_PORT_PD_STATUS 1
0042 #define HUB_EXT_PORT_STATUS 2
0043
0044
0045
0046
0047
0048 #define HUB_CLEAR_TT_BUFFER 8
0049 #define HUB_RESET_TT 9
0050 #define HUB_GET_TT_STATE 10
0051 #define HUB_STOP_TT 11
0052
0053
0054
0055
0056
0057 #define HUB_SET_DEPTH 12
0058 #define HUB_GET_PORT_ERR_COUNT 13
0059
0060
0061
0062
0063
0064 #define C_HUB_LOCAL_POWER 0
0065 #define C_HUB_OVER_CURRENT 1
0066
0067
0068
0069
0070
0071 #define USB_PORT_FEAT_CONNECTION 0
0072 #define USB_PORT_FEAT_ENABLE 1
0073 #define USB_PORT_FEAT_SUSPEND 2
0074 #define USB_PORT_FEAT_OVER_CURRENT 3
0075 #define USB_PORT_FEAT_RESET 4
0076 #define USB_PORT_FEAT_L1 5
0077 #define USB_PORT_FEAT_POWER 8
0078 #define USB_PORT_FEAT_LOWSPEED 9
0079 #define USB_PORT_FEAT_C_CONNECTION 16
0080 #define USB_PORT_FEAT_C_ENABLE 17
0081 #define USB_PORT_FEAT_C_SUSPEND 18
0082 #define USB_PORT_FEAT_C_OVER_CURRENT 19
0083 #define USB_PORT_FEAT_C_RESET 20
0084 #define USB_PORT_FEAT_TEST 21
0085 #define USB_PORT_FEAT_INDICATOR 22
0086 #define USB_PORT_FEAT_C_PORT_L1 23
0087
0088
0089
0090
0091
0092 #define USB_PORT_FEAT_LINK_STATE 5
0093 #define USB_PORT_FEAT_U1_TIMEOUT 23
0094 #define USB_PORT_FEAT_U2_TIMEOUT 24
0095 #define USB_PORT_FEAT_C_PORT_LINK_STATE 25
0096 #define USB_PORT_FEAT_C_PORT_CONFIG_ERROR 26
0097 #define USB_PORT_FEAT_REMOTE_WAKE_MASK 27
0098 #define USB_PORT_FEAT_BH_PORT_RESET 28
0099 #define USB_PORT_FEAT_C_BH_PORT_RESET 29
0100 #define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30
0101
0102 #define USB_PORT_LPM_TIMEOUT(p) (((p) & 0xff) << 8)
0103
0104
0105 #define USB_PORT_FEAT_REMOTE_WAKE_CONNECT (1 << 8)
0106 #define USB_PORT_FEAT_REMOTE_WAKE_DISCONNECT (1 << 9)
0107 #define USB_PORT_FEAT_REMOTE_WAKE_OVER_CURRENT (1 << 10)
0108
0109
0110
0111
0112
0113
0114
0115 struct usb_port_status {
0116 __le16 wPortStatus;
0117 __le16 wPortChange;
0118 __le32 dwExtPortStatus;
0119 } __attribute__ ((packed));
0120
0121
0122
0123
0124
0125 #define USB_PORT_STAT_CONNECTION 0x0001
0126 #define USB_PORT_STAT_ENABLE 0x0002
0127 #define USB_PORT_STAT_SUSPEND 0x0004
0128 #define USB_PORT_STAT_OVERCURRENT 0x0008
0129 #define USB_PORT_STAT_RESET 0x0010
0130 #define USB_PORT_STAT_L1 0x0020
0131
0132 #define USB_PORT_STAT_POWER 0x0100
0133 #define USB_PORT_STAT_LOW_SPEED 0x0200
0134 #define USB_PORT_STAT_HIGH_SPEED 0x0400
0135 #define USB_PORT_STAT_TEST 0x0800
0136 #define USB_PORT_STAT_INDICATOR 0x1000
0137
0138
0139
0140
0141
0142
0143 #define USB_PORT_STAT_LINK_STATE 0x01e0
0144 #define USB_SS_PORT_STAT_POWER 0x0200
0145 #define USB_SS_PORT_STAT_SPEED 0x1c00
0146 #define USB_PORT_STAT_SPEED_5GBPS 0x0000
0147
0148
0149 #define USB_SS_PORT_STAT_MASK (USB_PORT_STAT_CONNECTION | \
0150 USB_PORT_STAT_ENABLE | \
0151 USB_PORT_STAT_OVERCURRENT | \
0152 USB_PORT_STAT_RESET)
0153
0154
0155
0156
0157
0158 #define USB_SS_PORT_LS_U0 0x0000
0159 #define USB_SS_PORT_LS_U1 0x0020
0160 #define USB_SS_PORT_LS_U2 0x0040
0161 #define USB_SS_PORT_LS_U3 0x0060
0162 #define USB_SS_PORT_LS_SS_DISABLED 0x0080
0163 #define USB_SS_PORT_LS_RX_DETECT 0x00a0
0164 #define USB_SS_PORT_LS_SS_INACTIVE 0x00c0
0165 #define USB_SS_PORT_LS_POLLING 0x00e0
0166 #define USB_SS_PORT_LS_RECOVERY 0x0100
0167 #define USB_SS_PORT_LS_HOT_RESET 0x0120
0168 #define USB_SS_PORT_LS_COMP_MOD 0x0140
0169 #define USB_SS_PORT_LS_LOOPBACK 0x0160
0170
0171
0172
0173
0174
0175
0176 #define USB_PORT_STAT_C_CONNECTION 0x0001
0177 #define USB_PORT_STAT_C_ENABLE 0x0002
0178 #define USB_PORT_STAT_C_SUSPEND 0x0004
0179 #define USB_PORT_STAT_C_OVERCURRENT 0x0008
0180 #define USB_PORT_STAT_C_RESET 0x0010
0181 #define USB_PORT_STAT_C_L1 0x0020
0182
0183
0184
0185
0186 #define USB_PORT_STAT_C_BH_RESET 0x0020
0187 #define USB_PORT_STAT_C_LINK_STATE 0x0040
0188 #define USB_PORT_STAT_C_CONFIG_ERROR 0x0080
0189
0190
0191
0192
0193
0194
0195 #define USB_EXT_PORT_STAT_RX_SPEED_ID 0x0000000f
0196 #define USB_EXT_PORT_STAT_TX_SPEED_ID 0x000000f0
0197 #define USB_EXT_PORT_STAT_RX_LANES 0x00000f00
0198 #define USB_EXT_PORT_STAT_TX_LANES 0x0000f000
0199
0200 #define USB_EXT_PORT_RX_LANES(p) \
0201 (((p) & USB_EXT_PORT_STAT_RX_LANES) >> 8)
0202 #define USB_EXT_PORT_TX_LANES(p) \
0203 (((p) & USB_EXT_PORT_STAT_TX_LANES) >> 12)
0204
0205
0206
0207
0208
0209 #define HUB_CHAR_LPSM 0x0003
0210 #define HUB_CHAR_COMMON_LPSM 0x0000
0211 #define HUB_CHAR_INDV_PORT_LPSM 0x0001
0212 #define HUB_CHAR_NO_LPSM 0x0002
0213
0214 #define HUB_CHAR_COMPOUND 0x0004
0215
0216 #define HUB_CHAR_OCPM 0x0018
0217 #define HUB_CHAR_COMMON_OCPM 0x0000
0218 #define HUB_CHAR_INDV_PORT_OCPM 0x0008
0219 #define HUB_CHAR_NO_OCPM 0x0010
0220
0221 #define HUB_CHAR_TTTT 0x0060
0222 #define HUB_CHAR_PORTIND 0x0080
0223
0224 struct usb_hub_status {
0225 __le16 wHubStatus;
0226 __le16 wHubChange;
0227 } __attribute__ ((packed));
0228
0229
0230
0231
0232
0233
0234
0235 #define HUB_STATUS_LOCAL_POWER 0x0001
0236 #define HUB_STATUS_OVERCURRENT 0x0002
0237 #define HUB_CHANGE_LOCAL_POWER 0x0001
0238 #define HUB_CHANGE_OVERCURRENT 0x0002
0239
0240
0241
0242
0243
0244
0245
0246 #define USB_DT_HUB (USB_TYPE_CLASS | 0x09)
0247 #define USB_DT_SS_HUB (USB_TYPE_CLASS | 0x0a)
0248 #define USB_DT_HUB_NONVAR_SIZE 7
0249 #define USB_DT_SS_HUB_SIZE 12
0250
0251
0252
0253
0254
0255
0256 #define USB_HUB_PR_FS 0
0257 #define USB_HUB_PR_HS_NO_TT 0
0258 #define USB_HUB_PR_HS_SINGLE_TT 1
0259 #define USB_HUB_PR_HS_MULTI_TT 2
0260 #define USB_HUB_PR_SS 3
0261
0262 struct usb_hub_descriptor {
0263 __u8 bDescLength;
0264 __u8 bDescriptorType;
0265 __u8 bNbrPorts;
0266 __le16 wHubCharacteristics;
0267 __u8 bPwrOn2PwrGood;
0268 __u8 bHubContrCurrent;
0269
0270
0271 union {
0272 struct {
0273
0274 __u8 DeviceRemovable[(USB_MAXCHILDREN + 1 + 7) / 8];
0275 __u8 PortPwrCtrlMask[(USB_MAXCHILDREN + 1 + 7) / 8];
0276 } __attribute__ ((packed)) hs;
0277
0278 struct {
0279 __u8 bHubHdrDecLat;
0280 __le16 wHubDelay;
0281 __le16 DeviceRemovable;
0282 } __attribute__ ((packed)) ss;
0283 } u;
0284 } __attribute__ ((packed));
0285
0286
0287 #define HUB_LED_AUTO 0
0288 #define HUB_LED_AMBER 1
0289 #define HUB_LED_GREEN 2
0290 #define HUB_LED_OFF 3
0291
0292 enum hub_led_mode {
0293 INDICATOR_AUTO = 0,
0294 INDICATOR_CYCLE,
0295
0296 INDICATOR_GREEN_BLINK, INDICATOR_GREEN_BLINK_OFF,
0297 INDICATOR_AMBER_BLINK, INDICATOR_AMBER_BLINK_OFF,
0298 INDICATOR_ALT_BLINK, INDICATOR_ALT_BLINK_OFF
0299 } __attribute__ ((packed));
0300
0301
0302 #define HUB_TTTT_8_BITS 0x00
0303 #define HUB_TTTT_16_BITS 0x20
0304 #define HUB_TTTT_24_BITS 0x40
0305 #define HUB_TTTT_32_BITS 0x60
0306
0307 #endif