1 /* 2 * This header was generated from the Linux kernel headers by update_headers.py, 3 * to provide necessary information from kernel to userspace, such as constants, 4 * structures, and macros, and thus, contains no copyrightable information. 5 */ 6 #ifndef __LINUX_CH11_H 7 #define __LINUX_CH11_H 8 #include <linux/types.h> 9 #define USB_MAXCHILDREN 31 10 #define USB_SS_MAXPORTS 15 11 #define USB_RT_HUB (USB_TYPE_CLASS | USB_RECIP_DEVICE) 12 #define USB_RT_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER) 13 #define HUB_PORT_STATUS 0 14 #define HUB_PORT_PD_STATUS 1 15 #define HUB_EXT_PORT_STATUS 2 16 #define HUB_CLEAR_TT_BUFFER 8 17 #define HUB_RESET_TT 9 18 #define HUB_GET_TT_STATE 10 19 #define HUB_STOP_TT 11 20 #define HUB_SET_DEPTH 12 21 #define HUB_GET_PORT_ERR_COUNT 13 22 #define C_HUB_LOCAL_POWER 0 23 #define C_HUB_OVER_CURRENT 1 24 #define USB_PORT_FEAT_CONNECTION 0 25 #define USB_PORT_FEAT_ENABLE 1 26 #define USB_PORT_FEAT_SUSPEND 2 27 #define USB_PORT_FEAT_OVER_CURRENT 3 28 #define USB_PORT_FEAT_RESET 4 29 #define USB_PORT_FEAT_L1 5 30 #define USB_PORT_FEAT_POWER 8 31 #define USB_PORT_FEAT_LOWSPEED 9 32 #define USB_PORT_FEAT_C_CONNECTION 16 33 #define USB_PORT_FEAT_C_ENABLE 17 34 #define USB_PORT_FEAT_C_SUSPEND 18 35 #define USB_PORT_FEAT_C_OVER_CURRENT 19 36 #define USB_PORT_FEAT_C_RESET 20 37 #define USB_PORT_FEAT_TEST 21 38 #define USB_PORT_FEAT_INDICATOR 22 39 #define USB_PORT_FEAT_C_PORT_L1 23 40 #define USB_PORT_FEAT_LINK_STATE 5 41 #define USB_PORT_FEAT_U1_TIMEOUT 23 42 #define USB_PORT_FEAT_U2_TIMEOUT 24 43 #define USB_PORT_FEAT_C_PORT_LINK_STATE 25 44 #define USB_PORT_FEAT_C_PORT_CONFIG_ERROR 26 45 #define USB_PORT_FEAT_REMOTE_WAKE_MASK 27 46 #define USB_PORT_FEAT_BH_PORT_RESET 28 47 #define USB_PORT_FEAT_C_BH_PORT_RESET 29 48 #define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30 49 #define USB_PORT_LPM_TIMEOUT(p) (((p) & 0xff) << 8) 50 #define USB_PORT_FEAT_REMOTE_WAKE_CONNECT (1 << 8) 51 #define USB_PORT_FEAT_REMOTE_WAKE_DISCONNECT (1 << 9) 52 #define USB_PORT_FEAT_REMOTE_WAKE_OVER_CURRENT (1 << 10) 53 struct usb_port_status { 54 __le16 wPortStatus; 55 __le16 wPortChange; 56 __le32 dwExtPortStatus; 57 } __attribute__ ((packed)); 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 #define USB_PORT_STAT_LINK_STATE 0x01e0 70 #define USB_SS_PORT_STAT_POWER 0x0200 71 #define USB_SS_PORT_STAT_SPEED 0x1c00 72 #define USB_PORT_STAT_SPEED_5GBPS 0x0000 73 #define USB_SS_PORT_STAT_MASK (USB_PORT_STAT_CONNECTION | \ 74 USB_PORT_STAT_ENABLE | \ 75 USB_PORT_STAT_OVERCURRENT | \ 76 USB_PORT_STAT_RESET) 77 #define USB_SS_PORT_LS_U0 0x0000 78 #define USB_SS_PORT_LS_U1 0x0020 79 #define USB_SS_PORT_LS_U2 0x0040 80 #define USB_SS_PORT_LS_U3 0x0060 81 #define USB_SS_PORT_LS_SS_DISABLED 0x0080 82 #define USB_SS_PORT_LS_RX_DETECT 0x00a0 83 #define USB_SS_PORT_LS_SS_INACTIVE 0x00c0 84 #define USB_SS_PORT_LS_POLLING 0x00e0 85 #define USB_SS_PORT_LS_RECOVERY 0x0100 86 #define USB_SS_PORT_LS_HOT_RESET 0x0120 87 #define USB_SS_PORT_LS_COMP_MOD 0x0140 88 #define USB_SS_PORT_LS_LOOPBACK 0x0160 89 #define USB_PORT_STAT_C_CONNECTION 0x0001 90 #define USB_PORT_STAT_C_ENABLE 0x0002 91 #define USB_PORT_STAT_C_SUSPEND 0x0004 92 #define USB_PORT_STAT_C_OVERCURRENT 0x0008 93 #define USB_PORT_STAT_C_RESET 0x0010 94 #define USB_PORT_STAT_C_L1 0x0020 95 #define USB_PORT_STAT_C_BH_RESET 0x0020 96 #define USB_PORT_STAT_C_LINK_STATE 0x0040 97 #define USB_PORT_STAT_C_CONFIG_ERROR 0x0080 98 #define USB_EXT_PORT_STAT_RX_SPEED_ID 0x0000000f 99 #define USB_EXT_PORT_STAT_TX_SPEED_ID 0x000000f0 100 #define USB_EXT_PORT_STAT_RX_LANES 0x00000f00 101 #define USB_EXT_PORT_STAT_TX_LANES 0x0000f000 102 #define USB_EXT_PORT_RX_LANES(p) \ 103 (((p) & USB_EXT_PORT_STAT_RX_LANES) >> 8) 104 #define USB_EXT_PORT_TX_LANES(p) \ 105 (((p) & USB_EXT_PORT_STAT_TX_LANES) >> 12) 106 #define HUB_CHAR_LPSM 0x0003 107 #define HUB_CHAR_COMMON_LPSM 0x0000 108 #define HUB_CHAR_INDV_PORT_LPSM 0x0001 109 #define HUB_CHAR_NO_LPSM 0x0002 110 #define HUB_CHAR_COMPOUND 0x0004 111 #define HUB_CHAR_OCPM 0x0018 112 #define HUB_CHAR_COMMON_OCPM 0x0000 113 #define HUB_CHAR_INDV_PORT_OCPM 0x0008 114 #define HUB_CHAR_NO_OCPM 0x0010 115 #define HUB_CHAR_TTTT 0x0060 116 #define HUB_CHAR_PORTIND 0x0080 117 struct usb_hub_status { 118 __le16 wHubStatus; 119 __le16 wHubChange; 120 } __attribute__ ((packed)); 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 125 #define USB_DT_HUB (USB_TYPE_CLASS | 0x09) 126 #define USB_DT_SS_HUB (USB_TYPE_CLASS | 0x0a) 127 #define USB_DT_HUB_NONVAR_SIZE 7 128 #define USB_DT_SS_HUB_SIZE 12 129 #define USB_HUB_PR_FS 0 130 #define USB_HUB_PR_HS_NO_TT 0 131 #define USB_HUB_PR_HS_SINGLE_TT 1 132 #define USB_HUB_PR_HS_MULTI_TT 2 133 #define USB_HUB_PR_SS 3 134 struct usb_hub_descriptor { 135 __u8 bDescLength; 136 __u8 bDescriptorType; 137 __u8 bNbrPorts; 138 __le16 wHubCharacteristics; 139 __u8 bPwrOn2PwrGood; 140 __u8 bHubContrCurrent; 141 142 union { 143 struct { 144 145 __u8 DeviceRemovable[(USB_MAXCHILDREN + 1 + 7) / 8]; 146 __u8 PortPwrCtrlMask[(USB_MAXCHILDREN + 1 + 7) / 8]; 147 } __attribute__ ((packed)) hs; 148 struct { 149 __u8 bHubHdrDecLat; 150 __le16 wHubDelay; 151 __le16 DeviceRemovable; 152 } __attribute__ ((packed)) ss; 153 } u; 154 } __attribute__ ((packed)); 155 #define HUB_LED_AUTO 0 156 #define HUB_LED_AMBER 1 157 #define HUB_LED_GREEN 2 158 #define HUB_LED_OFF 3 159 enum hub_led_mode { 160 INDICATOR_AUTO = 0, 161 INDICATOR_CYCLE, 162 163 INDICATOR_GREEN_BLINK, INDICATOR_GREEN_BLINK_OFF, 164 INDICATOR_AMBER_BLINK, INDICATOR_AMBER_BLINK_OFF, 165 INDICATOR_ALT_BLINK, INDICATOR_ALT_BLINK_OFF 166 } __attribute__ ((packed)); 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 #endif 172