blob: 41fc972b3bcbb88ec28468a05df5f8276696fdff [file] [log] [blame]
Ben Cheng655a7c02013-10-16 16:09:24 -07001/****************************************************************************
2 ****************************************************************************
3 ***
4 *** This header was automatically generated from a Linux kernel header
5 *** of the same name, to make information necessary for userspace to
6 *** call into the kernel available to libc. It contains only constants,
7 *** structures, and macros generated from the original header, and thus,
8 *** contains no copyrightable information.
9 ***
10 *** To edit the content of this header, modify the corresponding
11 *** source file (e.g. under external/kernel-headers/original/) then
12 *** run bionic/libc/kernel/tools/update_all.py
13 ***
14 *** Any manual change here will be lost the next time this script will
15 *** be run. You've been warned!
16 ***
17 ****************************************************************************
18 ****************************************************************************/
19#ifndef __LINUX_CH11_H
20#define __LINUX_CH11_H
21#include <linux/types.h>
Christopher Ferris38062f92014-07-09 15:33:25 -070022#define USB_MAXCHILDREN 31
Christopher Ferris38062f92014-07-09 15:33:25 -070023#define USB_RT_HUB (USB_TYPE_CLASS | USB_RECIP_DEVICE)
Ben Cheng655a7c02013-10-16 16:09:24 -070024#define USB_RT_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER)
Christopher Ferris106b3a82016-08-24 12:15:38 -070025#define HUB_PORT_STATUS 0
26#define HUB_PORT_PD_STATUS 1
Christopher Ferris106b3a82016-08-24 12:15:38 -070027#define HUB_EXT_PORT_STATUS 2
Ben Cheng655a7c02013-10-16 16:09:24 -070028#define HUB_CLEAR_TT_BUFFER 8
29#define HUB_RESET_TT 9
Christopher Ferris38062f92014-07-09 15:33:25 -070030#define HUB_GET_TT_STATE 10
Ben Cheng655a7c02013-10-16 16:09:24 -070031#define HUB_STOP_TT 11
32#define HUB_SET_DEPTH 12
33#define HUB_GET_PORT_ERR_COUNT 13
Christopher Ferris38062f92014-07-09 15:33:25 -070034#define C_HUB_LOCAL_POWER 0
Ben Cheng655a7c02013-10-16 16:09:24 -070035#define C_HUB_OVER_CURRENT 1
36#define USB_PORT_FEAT_CONNECTION 0
37#define USB_PORT_FEAT_ENABLE 1
Christopher Ferris38062f92014-07-09 15:33:25 -070038#define USB_PORT_FEAT_SUSPEND 2
Ben Cheng655a7c02013-10-16 16:09:24 -070039#define USB_PORT_FEAT_OVER_CURRENT 3
40#define USB_PORT_FEAT_RESET 4
41#define USB_PORT_FEAT_L1 5
Christopher Ferris38062f92014-07-09 15:33:25 -070042#define USB_PORT_FEAT_POWER 8
Ben Cheng655a7c02013-10-16 16:09:24 -070043#define USB_PORT_FEAT_LOWSPEED 9
44#define USB_PORT_FEAT_C_CONNECTION 16
45#define USB_PORT_FEAT_C_ENABLE 17
Christopher Ferris38062f92014-07-09 15:33:25 -070046#define USB_PORT_FEAT_C_SUSPEND 18
Ben Cheng655a7c02013-10-16 16:09:24 -070047#define USB_PORT_FEAT_C_OVER_CURRENT 19
48#define USB_PORT_FEAT_C_RESET 20
49#define USB_PORT_FEAT_TEST 21
Christopher Ferris38062f92014-07-09 15:33:25 -070050#define USB_PORT_FEAT_INDICATOR 22
Ben Cheng655a7c02013-10-16 16:09:24 -070051#define USB_PORT_FEAT_C_PORT_L1 23
52#define USB_PORT_FEAT_LINK_STATE 5
53#define USB_PORT_FEAT_U1_TIMEOUT 23
Christopher Ferris38062f92014-07-09 15:33:25 -070054#define USB_PORT_FEAT_U2_TIMEOUT 24
Ben Cheng655a7c02013-10-16 16:09:24 -070055#define USB_PORT_FEAT_C_PORT_LINK_STATE 25
56#define USB_PORT_FEAT_C_PORT_CONFIG_ERROR 26
57#define USB_PORT_FEAT_REMOTE_WAKE_MASK 27
Christopher Ferris38062f92014-07-09 15:33:25 -070058#define USB_PORT_FEAT_BH_PORT_RESET 28
Ben Cheng655a7c02013-10-16 16:09:24 -070059#define USB_PORT_FEAT_C_BH_PORT_RESET 29
60#define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30
61#define USB_PORT_LPM_TIMEOUT(p) (((p) & 0xff) << 8)
Christopher Ferris38062f92014-07-09 15:33:25 -070062#define USB_PORT_FEAT_REMOTE_WAKE_CONNECT (1 << 8)
Ben Cheng655a7c02013-10-16 16:09:24 -070063#define USB_PORT_FEAT_REMOTE_WAKE_DISCONNECT (1 << 9)
64#define USB_PORT_FEAT_REMOTE_WAKE_OVER_CURRENT (1 << 10)
65struct usb_port_status {
Tao Baod7db5942015-01-28 10:07:51 -080066 __le16 wPortStatus;
67 __le16 wPortChange;
Christopher Ferris106b3a82016-08-24 12:15:38 -070068 __le32 dwExtPortStatus;
Tao Baod7db5942015-01-28 10:07:51 -080069} __attribute__((packed));
Ben Cheng655a7c02013-10-16 16:09:24 -070070#define USB_PORT_STAT_CONNECTION 0x0001
Christopher Ferris38062f92014-07-09 15:33:25 -070071#define USB_PORT_STAT_ENABLE 0x0002
Ben Cheng655a7c02013-10-16 16:09:24 -070072#define USB_PORT_STAT_SUSPEND 0x0004
73#define USB_PORT_STAT_OVERCURRENT 0x0008
74#define USB_PORT_STAT_RESET 0x0010
Christopher Ferris38062f92014-07-09 15:33:25 -070075#define USB_PORT_STAT_L1 0x0020
Ben Cheng655a7c02013-10-16 16:09:24 -070076#define USB_PORT_STAT_POWER 0x0100
77#define USB_PORT_STAT_LOW_SPEED 0x0200
78#define USB_PORT_STAT_HIGH_SPEED 0x0400
Christopher Ferris38062f92014-07-09 15:33:25 -070079#define USB_PORT_STAT_TEST 0x0800
Ben Cheng655a7c02013-10-16 16:09:24 -070080#define USB_PORT_STAT_INDICATOR 0x1000
81#define USB_PORT_STAT_LINK_STATE 0x01e0
82#define USB_SS_PORT_STAT_POWER 0x0200
Christopher Ferris38062f92014-07-09 15:33:25 -070083#define USB_SS_PORT_STAT_SPEED 0x1c00
Ben Cheng655a7c02013-10-16 16:09:24 -070084#define USB_PORT_STAT_SPEED_5GBPS 0x0000
Tao Baod7db5942015-01-28 10:07:51 -080085#define USB_SS_PORT_STAT_MASK (USB_PORT_STAT_CONNECTION | USB_PORT_STAT_ENABLE | USB_PORT_STAT_OVERCURRENT | USB_PORT_STAT_RESET)
Ben Cheng655a7c02013-10-16 16:09:24 -070086#define USB_SS_PORT_LS_U0 0x0000
Christopher Ferris38062f92014-07-09 15:33:25 -070087#define USB_SS_PORT_LS_U1 0x0020
Ben Cheng655a7c02013-10-16 16:09:24 -070088#define USB_SS_PORT_LS_U2 0x0040
89#define USB_SS_PORT_LS_U3 0x0060
90#define USB_SS_PORT_LS_SS_DISABLED 0x0080
Christopher Ferris38062f92014-07-09 15:33:25 -070091#define USB_SS_PORT_LS_RX_DETECT 0x00a0
Ben Cheng655a7c02013-10-16 16:09:24 -070092#define USB_SS_PORT_LS_SS_INACTIVE 0x00c0
93#define USB_SS_PORT_LS_POLLING 0x00e0
94#define USB_SS_PORT_LS_RECOVERY 0x0100
Christopher Ferris38062f92014-07-09 15:33:25 -070095#define USB_SS_PORT_LS_HOT_RESET 0x0120
Ben Cheng655a7c02013-10-16 16:09:24 -070096#define USB_SS_PORT_LS_COMP_MOD 0x0140
97#define USB_SS_PORT_LS_LOOPBACK 0x0160
98#define USB_PORT_STAT_C_CONNECTION 0x0001
Christopher Ferris38062f92014-07-09 15:33:25 -070099#define USB_PORT_STAT_C_ENABLE 0x0002
Ben Cheng655a7c02013-10-16 16:09:24 -0700100#define USB_PORT_STAT_C_SUSPEND 0x0004
101#define USB_PORT_STAT_C_OVERCURRENT 0x0008
102#define USB_PORT_STAT_C_RESET 0x0010
Christopher Ferris38062f92014-07-09 15:33:25 -0700103#define USB_PORT_STAT_C_L1 0x0020
Ben Cheng655a7c02013-10-16 16:09:24 -0700104#define USB_PORT_STAT_C_BH_RESET 0x0020
105#define USB_PORT_STAT_C_LINK_STATE 0x0040
106#define USB_PORT_STAT_C_CONFIG_ERROR 0x0080
Christopher Ferris106b3a82016-08-24 12:15:38 -0700107#define USB_EXT_PORT_STAT_RX_SPEED_ID 0x0000000f
108#define USB_EXT_PORT_STAT_TX_SPEED_ID 0x000000f0
109#define USB_EXT_PORT_STAT_RX_LANES 0x00000f00
110#define USB_EXT_PORT_STAT_TX_LANES 0x0000f000
Christopher Ferris38062f92014-07-09 15:33:25 -0700111#define HUB_CHAR_LPSM 0x0003
Ben Cheng655a7c02013-10-16 16:09:24 -0700112#define HUB_CHAR_COMMON_LPSM 0x0000
113#define HUB_CHAR_INDV_PORT_LPSM 0x0001
114#define HUB_CHAR_NO_LPSM 0x0002
Christopher Ferris38062f92014-07-09 15:33:25 -0700115#define HUB_CHAR_COMPOUND 0x0004
Ben Cheng655a7c02013-10-16 16:09:24 -0700116#define HUB_CHAR_OCPM 0x0018
117#define HUB_CHAR_COMMON_OCPM 0x0000
118#define HUB_CHAR_INDV_PORT_OCPM 0x0008
Christopher Ferris38062f92014-07-09 15:33:25 -0700119#define HUB_CHAR_NO_OCPM 0x0010
Ben Cheng655a7c02013-10-16 16:09:24 -0700120#define HUB_CHAR_TTTT 0x0060
121#define HUB_CHAR_PORTIND 0x0080
122struct usb_hub_status {
Tao Baod7db5942015-01-28 10:07:51 -0800123 __le16 wHubStatus;
124 __le16 wHubChange;
125} __attribute__((packed));
Ben Cheng655a7c02013-10-16 16:09:24 -0700126#define HUB_STATUS_LOCAL_POWER 0x0001
Christopher Ferris38062f92014-07-09 15:33:25 -0700127#define HUB_STATUS_OVERCURRENT 0x0002
Ben Cheng655a7c02013-10-16 16:09:24 -0700128#define HUB_CHANGE_LOCAL_POWER 0x0001
129#define HUB_CHANGE_OVERCURRENT 0x0002
130#define USB_DT_HUB (USB_TYPE_CLASS | 0x09)
Christopher Ferris38062f92014-07-09 15:33:25 -0700131#define USB_DT_SS_HUB (USB_TYPE_CLASS | 0x0a)
Ben Cheng655a7c02013-10-16 16:09:24 -0700132#define USB_DT_HUB_NONVAR_SIZE 7
133#define USB_DT_SS_HUB_SIZE 12
134#define USB_HUB_PR_FS 0
Christopher Ferris38062f92014-07-09 15:33:25 -0700135#define USB_HUB_PR_HS_NO_TT 0
Ben Cheng655a7c02013-10-16 16:09:24 -0700136#define USB_HUB_PR_HS_SINGLE_TT 1
137#define USB_HUB_PR_HS_MULTI_TT 2
138#define USB_HUB_PR_SS 3
Christopher Ferris38062f92014-07-09 15:33:25 -0700139struct usb_hub_descriptor {
Tao Baod7db5942015-01-28 10:07:51 -0800140 __u8 bDescLength;
141 __u8 bDescriptorType;
142 __u8 bNbrPorts;
Tao Baod7db5942015-01-28 10:07:51 -0800143 __le16 wHubCharacteristics;
144 __u8 bPwrOn2PwrGood;
145 __u8 bHubContrCurrent;
146 union {
Tao Baod7db5942015-01-28 10:07:51 -0800147 struct {
148 __u8 DeviceRemovable[(USB_MAXCHILDREN + 1 + 7) / 8];
149 __u8 PortPwrCtrlMask[(USB_MAXCHILDREN + 1 + 7) / 8];
150 } __attribute__((packed)) hs;
Tao Baod7db5942015-01-28 10:07:51 -0800151 struct {
152 __u8 bHubHdrDecLat;
153 __le16 wHubDelay;
154 __le16 DeviceRemovable;
Tao Baod7db5942015-01-28 10:07:51 -0800155 } __attribute__((packed)) ss;
156 } u;
157} __attribute__((packed));
Ben Cheng655a7c02013-10-16 16:09:24 -0700158#define HUB_LED_AUTO 0
Christopher Ferris38062f92014-07-09 15:33:25 -0700159#define HUB_LED_AMBER 1
Ben Cheng655a7c02013-10-16 16:09:24 -0700160#define HUB_LED_GREEN 2
161#define HUB_LED_OFF 3
162enum hub_led_mode {
Tao Baod7db5942015-01-28 10:07:51 -0800163 INDICATOR_AUTO = 0,
164 INDICATOR_CYCLE,
165 INDICATOR_GREEN_BLINK,
166 INDICATOR_GREEN_BLINK_OFF,
Tao Baod7db5942015-01-28 10:07:51 -0800167 INDICATOR_AMBER_BLINK,
168 INDICATOR_AMBER_BLINK_OFF,
169 INDICATOR_ALT_BLINK,
170 INDICATOR_ALT_BLINK_OFF
Tao Baod7db5942015-01-28 10:07:51 -0800171} __attribute__((packed));
Ben Cheng655a7c02013-10-16 16:09:24 -0700172#define HUB_TTTT_8_BITS 0x00
173#define HUB_TTTT_16_BITS 0x20
Christopher Ferris38062f92014-07-09 15:33:25 -0700174#define HUB_TTTT_24_BITS 0x40
Ben Cheng655a7c02013-10-16 16:09:24 -0700175#define HUB_TTTT_32_BITS 0x60
176#endif