USB: isp1760: don't auto disable Port1 on ISP1761
[deliverable/linux.git] / drivers / usb / core / hub.h
CommitLineData
1da177e4
LT
1#ifndef __LINUX_HUB_H
2#define __LINUX_HUB_H
3
4/*
5 * Hub protocol and driver data structures.
6 *
7 * Some of these are known to the "virtual root hub" code
8 * in host controller drivers.
9 */
10
11#include <linux/list.h>
12#include <linux/workqueue.h>
13#include <linux/compiler.h> /* likely()/unlikely() */
14
15/*
16 * Hub request types
17 */
18
19#define USB_RT_HUB (USB_TYPE_CLASS | USB_RECIP_DEVICE)
20#define USB_RT_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER)
21
22/*
23 * Hub class requests
24 * See USB 2.0 spec Table 11-16
25 */
26#define HUB_CLEAR_TT_BUFFER 8
27#define HUB_RESET_TT 9
28#define HUB_GET_TT_STATE 10
29#define HUB_STOP_TT 11
30
31/*
32 * Hub Class feature numbers
33 * See USB 2.0 spec Table 11-17
34 */
35#define C_HUB_LOCAL_POWER 0
36#define C_HUB_OVER_CURRENT 1
37
38/*
39 * Port feature numbers
40 * See USB 2.0 spec Table 11-17
41 */
42#define USB_PORT_FEAT_CONNECTION 0
43#define USB_PORT_FEAT_ENABLE 1
dbe0dbb7 44#define USB_PORT_FEAT_SUSPEND 2 /* L2 suspend */
1da177e4
LT
45#define USB_PORT_FEAT_OVER_CURRENT 3
46#define USB_PORT_FEAT_RESET 4
dbe0dbb7 47#define USB_PORT_FEAT_L1 5 /* L1 suspend */
1da177e4
LT
48#define USB_PORT_FEAT_POWER 8
49#define USB_PORT_FEAT_LOWSPEED 9
50#define USB_PORT_FEAT_HIGHSPEED 10
51#define USB_PORT_FEAT_C_CONNECTION 16
52#define USB_PORT_FEAT_C_ENABLE 17
53#define USB_PORT_FEAT_C_SUSPEND 18
54#define USB_PORT_FEAT_C_OVER_CURRENT 19
55#define USB_PORT_FEAT_C_RESET 20
56#define USB_PORT_FEAT_TEST 21
57#define USB_PORT_FEAT_INDICATOR 22
dbe0dbb7 58#define USB_PORT_FEAT_C_PORT_L1 23
1da177e4 59
84cca820 60/*
1da177e4
LT
61 * Hub Status and Hub Change results
62 * See USB 2.0 spec Table 11-19 and Table 11-20
63 */
64struct usb_port_status {
65 __le16 wPortStatus;
84cca820 66 __le16 wPortChange;
1da177e4
LT
67} __attribute__ ((packed));
68
84cca820 69/*
1da177e4
LT
70 * wPortStatus bit field
71 * See USB 2.0 spec Table 11-21
72 */
73#define USB_PORT_STAT_CONNECTION 0x0001
74#define USB_PORT_STAT_ENABLE 0x0002
75#define USB_PORT_STAT_SUSPEND 0x0004
76#define USB_PORT_STAT_OVERCURRENT 0x0008
77#define USB_PORT_STAT_RESET 0x0010
dbe0dbb7
DB
78#define USB_PORT_STAT_L1 0x0020
79/* bits 6 to 7 are reserved */
1da177e4
LT
80#define USB_PORT_STAT_POWER 0x0100
81#define USB_PORT_STAT_LOW_SPEED 0x0200
82#define USB_PORT_STAT_HIGH_SPEED 0x0400
83#define USB_PORT_STAT_TEST 0x0800
84#define USB_PORT_STAT_INDICATOR 0x1000
85/* bits 13 to 15 are reserved */
86
84cca820 87/*
1da177e4
LT
88 * wPortChange bit field
89 * See USB 2.0 spec Table 11-22
90 * Bits 0 to 4 shown, bits 5 to 15 are reserved
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
dbe0dbb7 97#define USB_PORT_STAT_C_L1 0x0020
1da177e4
LT
98
99/*
84cca820 100 * wHubCharacteristics (masks)
1da177e4
LT
101 * See USB 2.0 spec Table 11-13, offset 3
102 */
103#define HUB_CHAR_LPSM 0x0003 /* D1 .. D0 */
104#define HUB_CHAR_COMPOUND 0x0004 /* D2 */
105#define HUB_CHAR_OCPM 0x0018 /* D4 .. D3 */
106#define HUB_CHAR_TTTT 0x0060 /* D6 .. D5 */
107#define HUB_CHAR_PORTIND 0x0080 /* D7 */
108
109struct usb_hub_status {
110 __le16 wHubStatus;
111 __le16 wHubChange;
112} __attribute__ ((packed));
113
114/*
115 * Hub Status & Hub Change bit masks
116 * See USB 2.0 spec Table 11-19 and Table 11-20
117 * Bits 0 and 1 for wHubStatus and wHubChange
118 * Bits 2 to 15 are reserved for both
119 */
120#define HUB_STATUS_LOCAL_POWER 0x0001
121#define HUB_STATUS_OVERCURRENT 0x0002
122#define HUB_CHANGE_LOCAL_POWER 0x0001
123#define HUB_CHANGE_OVERCURRENT 0x0002
124
125
84cca820
GKH
126/*
127 * Hub descriptor
1da177e4
LT
128 * See USB 2.0 spec Table 11-13
129 */
130
131#define USB_DT_HUB (USB_TYPE_CLASS | 0x09)
132#define USB_DT_HUB_NONVAR_SIZE 7
133
134struct usb_hub_descriptor {
135 __u8 bDescLength;
136 __u8 bDescriptorType;
137 __u8 bNbrPorts;
74ad9bd2 138 __le16 wHubCharacteristics;
1da177e4
LT
139 __u8 bPwrOn2PwrGood;
140 __u8 bHubContrCurrent;
84cca820 141 /* add 1 bit for hub status change; round to bytes */
1da177e4
LT
142 __u8 DeviceRemovable[(USB_MAXCHILDREN + 1 + 7) / 8];
143 __u8 PortPwrCtrlMask[(USB_MAXCHILDREN + 1 + 7) / 8];
144} __attribute__ ((packed));
145
146
147/* port indicator status selectors, tables 11-7 and 11-25 */
148#define HUB_LED_AUTO 0
149#define HUB_LED_AMBER 1
150#define HUB_LED_GREEN 2
151#define HUB_LED_OFF 3
152
153enum hub_led_mode {
154 INDICATOR_AUTO = 0,
155 INDICATOR_CYCLE,
156 /* software blinks for attention: software, hardware, reserved */
157 INDICATOR_GREEN_BLINK, INDICATOR_GREEN_BLINK_OFF,
158 INDICATOR_AMBER_BLINK, INDICATOR_AMBER_BLINK_OFF,
159 INDICATOR_ALT_BLINK, INDICATOR_ALT_BLINK_OFF
160} __attribute__ ((packed));
161
162struct usb_device;
163
e09711ae 164/* Transaction Translator Think Times, in bits */
165#define HUB_TTTT_8_BITS 0x00
166#define HUB_TTTT_16_BITS 0x20
167#define HUB_TTTT_24_BITS 0x40
168#define HUB_TTTT_32_BITS 0x60
169
1da177e4
LT
170/*
171 * As of USB 2.0, full/low speed devices are segregated into trees.
172 * One type grows from USB 1.1 host controllers (OHCI, UHCI etc).
173 * The other type grows from high speed hubs when they connect to
174 * full/low speed devices using "Transaction Translators" (TTs).
175 *
176 * TTs should only be known to the hub driver, and high speed bus
177 * drivers (only EHCI for now). They affect periodic scheduling and
178 * sometimes control/bulk error recovery.
179 */
180struct usb_tt {
181 struct usb_device *hub; /* upstream highspeed hub */
182 int multi; /* true means one TT per port */
e09711ae 183 unsigned think_time; /* think time in ns */
1da177e4
LT
184
185 /* for control/bulk error recovery (CLEAR_TT_BUFFER) */
186 spinlock_t lock;
187 struct list_head clear_list; /* of usb_tt_clear */
188 struct work_struct kevent;
189};
190
191struct usb_tt_clear {
192 struct list_head clear_list;
193 unsigned tt;
194 u16 devinfo;
195};
196
84cca820 197extern void usb_hub_tt_clear_buffer(struct usb_device *dev, int pipe);
fc721f51 198extern void usb_ep0_reinit(struct usb_device *);
1da177e4 199
1da177e4 200#endif /* __LINUX_HUB_H */
This page took 0.468938 seconds and 5 git commands to generate.