xref: /openbmc/u-boot/include/usb.h (revision 89d48367edbc878f86db3008a4107331ef07f578)
1012771d8Swdenk /*
2012771d8Swdenk  * (C) Copyright 2001
3012771d8Swdenk  * Denis Peter, MPL AG Switzerland
4012771d8Swdenk  *
5012771d8Swdenk  * See file CREDITS for list of people who contributed to this
6012771d8Swdenk  * project.
7012771d8Swdenk  *
8012771d8Swdenk  * This program is free software; you can redistribute it and/or
9012771d8Swdenk  * modify it under the terms of the GNU General Public License as
10012771d8Swdenk  * published by the Free Software Foundation; either version 2 of
11012771d8Swdenk  * the License, or (at your option) any later version.
12012771d8Swdenk  *
13012771d8Swdenk  * This program is distributed in the hope that it will be useful,
14012771d8Swdenk  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15012771d8Swdenk  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
16012771d8Swdenk  * GNU General Public License for more details.
17012771d8Swdenk  *
18012771d8Swdenk  * You should have received a copy of the GNU General Public License
19012771d8Swdenk  * along with this program; if not, write to the Free Software
20012771d8Swdenk  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21012771d8Swdenk  * MA 02111-1307 USA
22012771d8Swdenk  *
23012771d8Swdenk  * Note: Part of this code has been derived from linux
24012771d8Swdenk  *
25012771d8Swdenk  */
26012771d8Swdenk #ifndef _USB_H_
27012771d8Swdenk #define _USB_H_
28012771d8Swdenk 
29012771d8Swdenk #include <usb_defs.h>
308f8bd565STom Rix #include <usbdescriptors.h>
31012771d8Swdenk 
32012771d8Swdenk /* Everything is aribtrary */
33012771d8Swdenk #define USB_ALTSETTINGALLOC		4
34012771d8Swdenk #define USB_MAXALTSETTING		128	/* Hard limit */
35012771d8Swdenk 
36012771d8Swdenk #define USB_MAX_DEVICE			32
37012771d8Swdenk #define USB_MAXCONFIG			8
38012771d8Swdenk #define USB_MAXINTERFACES		8
39012771d8Swdenk #define USB_MAXENDPOINTS		16
40012771d8Swdenk #define USB_MAXCHILDREN			8	/* This is arbitrary */
41012771d8Swdenk #define USB_MAX_HUB			16
42012771d8Swdenk 
43012771d8Swdenk #define USB_CNTL_TIMEOUT 100 /* 100ms timeout */
44012771d8Swdenk 
4596820a35SSimon Glass /*
4696820a35SSimon Glass  * This is the timeout to allow for submitting an urb in ms. We allow more
4796820a35SSimon Glass  * time for a BULK device to react - some are slow.
4896820a35SSimon Glass  */
4996820a35SSimon Glass #define USB_TIMEOUT_MS(pipe) (usb_pipebulk(pipe) ? 5000 : 100)
5096820a35SSimon Glass 
51012771d8Swdenk /* device request (setup) */
52012771d8Swdenk struct devrequest {
53012771d8Swdenk 	unsigned char	requesttype;
54012771d8Swdenk 	unsigned char	request;
55012771d8Swdenk 	unsigned short	value;
56012771d8Swdenk 	unsigned short	index;
57012771d8Swdenk 	unsigned short	length;
58012771d8Swdenk } __attribute__ ((packed));
59012771d8Swdenk 
60012771d8Swdenk /* All standard descriptors have these 2 fields in common */
61012771d8Swdenk struct usb_descriptor_header {
62012771d8Swdenk 	unsigned char	bLength;
63012771d8Swdenk 	unsigned char	bDescriptorType;
64012771d8Swdenk } __attribute__ ((packed));
65012771d8Swdenk 
668f8bd565STom Rix /* Interface */
678f8bd565STom Rix struct usb_interface {
688f8bd565STom Rix 	struct usb_interface_descriptor desc;
69012771d8Swdenk 
70012771d8Swdenk 	unsigned char	no_of_ep;
717455af41SBartlomiej Sieka 	unsigned char	num_altsetting;
72012771d8Swdenk 	unsigned char	act_altsetting;
73de39f8c1SMichael Trimarchi 
74012771d8Swdenk 	struct usb_endpoint_descriptor ep_desc[USB_MAXENDPOINTS];
75012771d8Swdenk } __attribute__ ((packed));
76012771d8Swdenk 
778f8bd565STom Rix /* Configuration information.. */
788f8bd565STom Rix struct usb_config {
798f8bd565STom Rix 	struct usb_configuration_descriptor desc;
80012771d8Swdenk 
81012771d8Swdenk 	unsigned char	no_of_if;	/* number of interfaces */
828f8bd565STom Rix 	struct usb_interface if_desc[USB_MAXINTERFACES];
83012771d8Swdenk } __attribute__ ((packed));
84012771d8Swdenk 
8548867208SRemy Bohmer enum {
8648867208SRemy Bohmer 	/* Maximum packet size; encoded as 0,1,2,3 = 8,16,32,64 */
8748867208SRemy Bohmer 	PACKET_SIZE_8   = 0,
8848867208SRemy Bohmer 	PACKET_SIZE_16  = 1,
8948867208SRemy Bohmer 	PACKET_SIZE_32  = 2,
9048867208SRemy Bohmer 	PACKET_SIZE_64  = 3,
9148867208SRemy Bohmer };
92012771d8Swdenk 
93012771d8Swdenk struct usb_device {
94012771d8Swdenk 	int	devnum;			/* Device number on USB bus */
953e126484SMichael Trimarchi 	int	speed;			/* full/low/high */
96012771d8Swdenk 	char	mf[32];			/* manufacturer */
97012771d8Swdenk 	char	prod[32];		/* product */
98012771d8Swdenk 	char	serial[32];		/* serial number */
99012771d8Swdenk 
10048867208SRemy Bohmer 	/* Maximum packet size; one of: PACKET_SIZE_* */
10148867208SRemy Bohmer 	int maxpacketsize;
10248867208SRemy Bohmer 	/* one bit for each endpoint ([0] = IN, [1] = OUT) */
10348867208SRemy Bohmer 	unsigned int toggle[2];
104de39f8c1SMichael Trimarchi 	/* endpoint halts; one bit per endpoint # & direction;
105de39f8c1SMichael Trimarchi 	 * [0] = IN, [1] = OUT
106de39f8c1SMichael Trimarchi 	 */
10748867208SRemy Bohmer 	unsigned int halted[2];
108012771d8Swdenk 	int epmaxpacketin[16];		/* INput endpoint specific maximums */
109012771d8Swdenk 	int epmaxpacketout[16];		/* OUTput endpoint specific maximums */
110012771d8Swdenk 
111012771d8Swdenk 	int configno;			/* selected config number */
112012771d8Swdenk 	struct usb_device_descriptor descriptor; /* Device Descriptor */
1138f8bd565STom Rix 	struct usb_config config; /* config descriptor */
114012771d8Swdenk 
115012771d8Swdenk 	int have_langid;		/* whether string_langid is valid yet */
116012771d8Swdenk 	int string_langid;		/* language ID for strings */
117012771d8Swdenk 	int (*irq_handle)(struct usb_device *dev);
118012771d8Swdenk 	unsigned long irq_status;
119012771d8Swdenk 	int irq_act_len;		/* transfered bytes */
120012771d8Swdenk 	void *privptr;
121012771d8Swdenk 	/*
122012771d8Swdenk 	 * Child devices -  if this is a hub device
123012771d8Swdenk 	 * Each instance needs its own set of data structures.
124012771d8Swdenk 	 */
125012771d8Swdenk 	unsigned long status;
126012771d8Swdenk 	int act_len;			/* transfered bytes */
127012771d8Swdenk 	int maxchild;			/* Number of ports if hub */
1283e126484SMichael Trimarchi 	int portnr;
129012771d8Swdenk 	struct usb_device *parent;
130012771d8Swdenk 	struct usb_device *children[USB_MAXCHILDREN];
131012771d8Swdenk };
132012771d8Swdenk 
133012771d8Swdenk /**********************************************************************
134012771d8Swdenk  * this is how the lowlevel part communicate with the outer world
135012771d8Swdenk  */
136012771d8Swdenk 
137822af351SRodolfo Giometti #if defined(CONFIG_USB_UHCI) || defined(CONFIG_USB_OHCI) || \
13851ab142bSmichael 	defined(CONFIG_USB_EHCI) || defined(CONFIG_USB_OHCI_NEW) || \
1393e126484SMichael Trimarchi 	defined(CONFIG_USB_SL811HS) || defined(CONFIG_USB_ISP116X_HCD) || \
140f298e4b6STom Rix 	defined(CONFIG_USB_R8A66597_HCD) || defined(CONFIG_USB_DAVINCI) || \
141e608f221SBryan Wu 	defined(CONFIG_USB_OMAP3) || defined(CONFIG_USB_DA8XX) || \
142dbea3242SAjay Kumar Gupta 	defined(CONFIG_USB_BLACKFIN) || defined(CONFIG_USB_AM35X)
143822af351SRodolfo Giometti 
144012771d8Swdenk int usb_lowlevel_init(void);
145012771d8Swdenk int usb_lowlevel_stop(void);
146de39f8c1SMichael Trimarchi int submit_bulk_msg(struct usb_device *dev, unsigned long pipe,
147de39f8c1SMichael Trimarchi 			void *buffer, int transfer_len);
148012771d8Swdenk int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
149012771d8Swdenk 			int transfer_len, struct devrequest *setup);
150012771d8Swdenk int submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
151012771d8Swdenk 			int transfer_len, int interval);
152fdcfaa1bSZhang Wei void usb_event_poll(void);
153012771d8Swdenk 
154012771d8Swdenk /* Defines */
155012771d8Swdenk #define USB_UHCI_VEND_ID	0x8086
156012771d8Swdenk #define USB_UHCI_DEV_ID		0x7112
157012771d8Swdenk 
158012771d8Swdenk #else
159012771d8Swdenk #error USB Lowlevel not defined
160012771d8Swdenk #endif
161012771d8Swdenk 
162012771d8Swdenk #ifdef CONFIG_USB_STORAGE
163012771d8Swdenk 
164012771d8Swdenk #define USB_MAX_STOR_DEV 5
165012771d8Swdenk block_dev_desc_t *usb_stor_get_dev(int index);
166012771d8Swdenk int usb_stor_scan(int mode);
167e813eae3SAnatolij Gustschin int usb_stor_info(void);
168012771d8Swdenk 
169012771d8Swdenk #endif
170012771d8Swdenk 
171*89d48367SSimon Glass #ifdef CONFIG_USB_HOST_ETHER
172*89d48367SSimon Glass 
173*89d48367SSimon Glass #define USB_MAX_ETH_DEV 5
174*89d48367SSimon Glass int usb_host_eth_scan(int mode);
175*89d48367SSimon Glass 
176*89d48367SSimon Glass #endif
177*89d48367SSimon Glass 
178012771d8Swdenk #ifdef CONFIG_USB_KEYBOARD
179012771d8Swdenk 
180012771d8Swdenk int drv_usb_kbd_init(void);
181012771d8Swdenk int usb_kbd_deregister(void);
182012771d8Swdenk 
183012771d8Swdenk #endif
184012771d8Swdenk /* routines */
185012771d8Swdenk int usb_init(void); /* initialize the USB Controller */
186012771d8Swdenk int usb_stop(void); /* stop the USB Controller */
187012771d8Swdenk 
188012771d8Swdenk 
189012771d8Swdenk int usb_set_protocol(struct usb_device *dev, int ifnum, int protocol);
190de39f8c1SMichael Trimarchi int usb_set_idle(struct usb_device *dev, int ifnum, int duration,
191de39f8c1SMichael Trimarchi 			int report_id);
192012771d8Swdenk struct usb_device *usb_get_dev_index(int index);
193012771d8Swdenk int usb_control_msg(struct usb_device *dev, unsigned int pipe,
194012771d8Swdenk 			unsigned char request, unsigned char requesttype,
195012771d8Swdenk 			unsigned short value, unsigned short index,
196012771d8Swdenk 			void *data, unsigned short size, int timeout);
197012771d8Swdenk int usb_bulk_msg(struct usb_device *dev, unsigned int pipe,
198012771d8Swdenk 			void *data, int len, int *actual_length, int timeout);
199012771d8Swdenk int usb_submit_int_msg(struct usb_device *dev, unsigned long pipe,
200012771d8Swdenk 			void *buffer, int transfer_len, int interval);
201*89d48367SSimon Glass int usb_disable_asynch(int disable);
202012771d8Swdenk int usb_maxpacket(struct usb_device *dev, unsigned long pipe);
203de39f8c1SMichael Trimarchi inline void wait_ms(unsigned long ms);
204de39f8c1SMichael Trimarchi int usb_get_configuration_no(struct usb_device *dev, unsigned char *buffer,
205de39f8c1SMichael Trimarchi 				int cfgno);
206de39f8c1SMichael Trimarchi int usb_get_report(struct usb_device *dev, int ifnum, unsigned char type,
207de39f8c1SMichael Trimarchi 			unsigned char id, void *buf, int size);
208012771d8Swdenk int usb_get_class_descriptor(struct usb_device *dev, int ifnum,
209de39f8c1SMichael Trimarchi 			unsigned char type, unsigned char id, void *buf,
210de39f8c1SMichael Trimarchi 			int size);
211012771d8Swdenk int usb_clear_halt(struct usb_device *dev, int pipe);
212012771d8Swdenk int usb_string(struct usb_device *dev, int index, char *buf, size_t size);
213012771d8Swdenk int usb_set_interface(struct usb_device *dev, int interface, int alternate);
214012771d8Swdenk 
215012771d8Swdenk /* big endian -> little endian conversion */
216149dded2Swdenk /* some CPUs are already little endian e.g. the ARM920T */
217ae3b770eSMarkus Klotzbuecher #define __swap_16(x) \
2183f85ce27Swdenk 	({ unsigned short x_ = (unsigned short)x; \
2193f85ce27Swdenk 	 (unsigned short)( \
2203f85ce27Swdenk 		((x_ & 0x00FFU) << 8) | ((x_ & 0xFF00U) >> 8)); \
2213f85ce27Swdenk 	})
222ae3b770eSMarkus Klotzbuecher #define __swap_32(x) \
2233f85ce27Swdenk 	({ unsigned long x_ = (unsigned long)x; \
2243f85ce27Swdenk 	 (unsigned long)( \
2253f85ce27Swdenk 		((x_ & 0x000000FFUL) << 24) | \
2263f85ce27Swdenk 		((x_ & 0x0000FF00UL) <<	 8) | \
2273f85ce27Swdenk 		((x_ & 0x00FF0000UL) >>	 8) | \
2283f85ce27Swdenk 		((x_ & 0xFF000000UL) >> 24)); \
2293f85ce27Swdenk 	})
230ae3b770eSMarkus Klotzbuecher 
231c7d703f3SMike Frysinger #ifdef __LITTLE_ENDIAN
232ae3b770eSMarkus Klotzbuecher # define swap_16(x) (x)
233ae3b770eSMarkus Klotzbuecher # define swap_32(x) (x)
234ae3b770eSMarkus Klotzbuecher #else
235ae3b770eSMarkus Klotzbuecher # define swap_16(x) __swap_16(x)
236ae3b770eSMarkus Klotzbuecher # define swap_32(x) __swap_32(x)
237c7d703f3SMike Frysinger #endif
238012771d8Swdenk 
239012771d8Swdenk /*
240012771d8Swdenk  * Calling this entity a "pipe" is glorifying it. A USB pipe
241012771d8Swdenk  * is something embarrassingly simple: it basically consists
242012771d8Swdenk  * of the following information:
243012771d8Swdenk  *  - device number (7 bits)
244012771d8Swdenk  *  - endpoint number (4 bits)
245012771d8Swdenk  *  - current Data0/1 state (1 bit)
246012771d8Swdenk  *  - direction (1 bit)
2473e126484SMichael Trimarchi  *  - speed (2 bits)
248012771d8Swdenk  *  - max packet size (2 bits: 8, 16, 32 or 64)
249012771d8Swdenk  *  - pipe type (2 bits: control, interrupt, bulk, isochronous)
250012771d8Swdenk  *
251012771d8Swdenk  * That's 18 bits. Really. Nothing more. And the USB people have
252012771d8Swdenk  * documented these eighteen bits as some kind of glorious
253012771d8Swdenk  * virtual data structure.
254012771d8Swdenk  *
255012771d8Swdenk  * Let's not fall in that trap. We'll just encode it as a simple
256012771d8Swdenk  * unsigned int. The encoding is:
257012771d8Swdenk  *
258012771d8Swdenk  *  - max size:		bits 0-1	(00 = 8, 01 = 16, 10 = 32, 11 = 64)
259de39f8c1SMichael Trimarchi  *  - direction:	bit 7		(0 = Host-to-Device [Out],
260de39f8c1SMichael Trimarchi  *					(1 = Device-to-Host [In])
261012771d8Swdenk  *  - device:		bits 8-14
262012771d8Swdenk  *  - endpoint:		bits 15-18
263012771d8Swdenk  *  - Data0/1:		bit 19
2643e126484SMichael Trimarchi  *  - speed:		bit 26		(0 = Full, 1 = Low Speed, 2 = High)
265de39f8c1SMichael Trimarchi  *  - pipe type:	bits 30-31	(00 = isochronous, 01 = interrupt,
266de39f8c1SMichael Trimarchi  *					 10 = control, 11 = bulk)
267012771d8Swdenk  *
268012771d8Swdenk  * Why? Because it's arbitrary, and whatever encoding we select is really
269012771d8Swdenk  * up to us. This one happens to share a lot of bit positions with the UHCI
270012771d8Swdenk  * specification, so that much of the uhci driver can just mask the bits
271012771d8Swdenk  * appropriately.
272012771d8Swdenk  */
273012771d8Swdenk /* Create various pipes... */
274012771d8Swdenk #define create_pipe(dev,endpoint) \
275d0fe1128SSergei Shtylyov 		(((dev)->devnum << 8) | ((endpoint) << 15) | \
2763e126484SMichael Trimarchi 		((dev)->speed << 26) | (dev)->maxpacketsize)
2773e126484SMichael Trimarchi #define default_pipe(dev) ((dev)->speed << 26)
278012771d8Swdenk 
279de39f8c1SMichael Trimarchi #define usb_sndctrlpipe(dev, endpoint)	((PIPE_CONTROL << 30) | \
280de39f8c1SMichael Trimarchi 					 create_pipe(dev, endpoint))
281de39f8c1SMichael Trimarchi #define usb_rcvctrlpipe(dev, endpoint)	((PIPE_CONTROL << 30) | \
282de39f8c1SMichael Trimarchi 					 create_pipe(dev, endpoint) | \
283de39f8c1SMichael Trimarchi 					 USB_DIR_IN)
284de39f8c1SMichael Trimarchi #define usb_sndisocpipe(dev, endpoint)	((PIPE_ISOCHRONOUS << 30) | \
285de39f8c1SMichael Trimarchi 					 create_pipe(dev, endpoint))
286de39f8c1SMichael Trimarchi #define usb_rcvisocpipe(dev, endpoint)	((PIPE_ISOCHRONOUS << 30) | \
287de39f8c1SMichael Trimarchi 					 create_pipe(dev, endpoint) | \
288de39f8c1SMichael Trimarchi 					 USB_DIR_IN)
289de39f8c1SMichael Trimarchi #define usb_sndbulkpipe(dev, endpoint)	((PIPE_BULK << 30) | \
290de39f8c1SMichael Trimarchi 					 create_pipe(dev, endpoint))
291de39f8c1SMichael Trimarchi #define usb_rcvbulkpipe(dev, endpoint)	((PIPE_BULK << 30) | \
292de39f8c1SMichael Trimarchi 					 create_pipe(dev, endpoint) | \
293de39f8c1SMichael Trimarchi 					 USB_DIR_IN)
294de39f8c1SMichael Trimarchi #define usb_sndintpipe(dev, endpoint)	((PIPE_INTERRUPT << 30) | \
295de39f8c1SMichael Trimarchi 					 create_pipe(dev, endpoint))
296de39f8c1SMichael Trimarchi #define usb_rcvintpipe(dev, endpoint)	((PIPE_INTERRUPT << 30) | \
297de39f8c1SMichael Trimarchi 					 create_pipe(dev, endpoint) | \
298de39f8c1SMichael Trimarchi 					 USB_DIR_IN)
299de39f8c1SMichael Trimarchi #define usb_snddefctrl(dev)		((PIPE_CONTROL << 30) | \
300de39f8c1SMichael Trimarchi 					 default_pipe(dev))
301de39f8c1SMichael Trimarchi #define usb_rcvdefctrl(dev)		((PIPE_CONTROL << 30) | \
302de39f8c1SMichael Trimarchi 					 default_pipe(dev) | \
303de39f8c1SMichael Trimarchi 					 USB_DIR_IN)
304012771d8Swdenk 
305012771d8Swdenk /* The D0/D1 toggle bits */
306012771d8Swdenk #define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> ep) & 1)
307012771d8Swdenk #define usb_dotoggle(dev, ep, out)  ((dev)->toggle[out] ^= (1 << ep))
308de39f8c1SMichael Trimarchi #define usb_settoggle(dev, ep, out, bit) ((dev)->toggle[out] = \
309de39f8c1SMichael Trimarchi 						((dev)->toggle[out] & \
310de39f8c1SMichael Trimarchi 						 ~(1 << ep)) | ((bit) << ep))
311012771d8Swdenk 
312012771d8Swdenk /* Endpoint halt control/status */
313012771d8Swdenk #define usb_endpoint_out(ep_dir)	(((ep_dir >> 7) & 1) ^ 1)
314012771d8Swdenk #define usb_endpoint_halt(dev, ep, out) ((dev)->halted[out] |= (1 << (ep)))
315012771d8Swdenk #define usb_endpoint_running(dev, ep, out) ((dev)->halted[out] &= ~(1 << (ep)))
316012771d8Swdenk #define usb_endpoint_halted(dev, ep, out) ((dev)->halted[out] & (1 << (ep)))
317012771d8Swdenk 
318de39f8c1SMichael Trimarchi #define usb_packetid(pipe)	(((pipe) & USB_DIR_IN) ? USB_PID_IN : \
319de39f8c1SMichael Trimarchi 				 USB_PID_OUT)
320012771d8Swdenk 
321012771d8Swdenk #define usb_pipeout(pipe)	((((pipe) >> 7) & 1) ^ 1)
322012771d8Swdenk #define usb_pipein(pipe)	(((pipe) >> 7) & 1)
323012771d8Swdenk #define usb_pipedevice(pipe)	(((pipe) >> 8) & 0x7f)
324012771d8Swdenk #define usb_pipe_endpdev(pipe)	(((pipe) >> 8) & 0x7ff)
325012771d8Swdenk #define usb_pipeendpoint(pipe)	(((pipe) >> 15) & 0xf)
326012771d8Swdenk #define usb_pipedata(pipe)	(((pipe) >> 19) & 1)
3273e126484SMichael Trimarchi #define usb_pipespeed(pipe)	(((pipe) >> 26) & 3)
3283e126484SMichael Trimarchi #define usb_pipeslow(pipe)	(usb_pipespeed(pipe) == USB_SPEED_LOW)
329012771d8Swdenk #define usb_pipetype(pipe)	(((pipe) >> 30) & 3)
330012771d8Swdenk #define usb_pipeisoc(pipe)	(usb_pipetype((pipe)) == PIPE_ISOCHRONOUS)
331012771d8Swdenk #define usb_pipeint(pipe)	(usb_pipetype((pipe)) == PIPE_INTERRUPT)
332012771d8Swdenk #define usb_pipecontrol(pipe)	(usb_pipetype((pipe)) == PIPE_CONTROL)
333012771d8Swdenk #define usb_pipebulk(pipe)	(usb_pipetype((pipe)) == PIPE_BULK)
334012771d8Swdenk 
335012771d8Swdenk 
336012771d8Swdenk /*************************************************************************
337012771d8Swdenk  * Hub Stuff
338012771d8Swdenk  */
339012771d8Swdenk struct usb_port_status {
340012771d8Swdenk 	unsigned short wPortStatus;
341012771d8Swdenk 	unsigned short wPortChange;
342012771d8Swdenk } __attribute__ ((packed));
343012771d8Swdenk 
344012771d8Swdenk struct usb_hub_status {
345012771d8Swdenk 	unsigned short wHubStatus;
346012771d8Swdenk 	unsigned short wHubChange;
347012771d8Swdenk } __attribute__ ((packed));
348012771d8Swdenk 
349012771d8Swdenk 
350012771d8Swdenk /* Hub descriptor */
351012771d8Swdenk struct usb_hub_descriptor {
352012771d8Swdenk 	unsigned char  bLength;
353012771d8Swdenk 	unsigned char  bDescriptorType;
354012771d8Swdenk 	unsigned char  bNbrPorts;
355012771d8Swdenk 	unsigned short wHubCharacteristics;
356012771d8Swdenk 	unsigned char  bPwrOn2PwrGood;
357012771d8Swdenk 	unsigned char  bHubContrCurrent;
358012771d8Swdenk 	unsigned char  DeviceRemovable[(USB_MAXCHILDREN+1+7)/8];
359012771d8Swdenk 	unsigned char  PortPowerCtrlMask[(USB_MAXCHILDREN+1+7)/8];
360012771d8Swdenk 	/* DeviceRemovable and PortPwrCtrlMask want to be variable-length
361012771d8Swdenk 	   bitmaps that hold max 255 entries. (bit0 is ignored) */
362012771d8Swdenk } __attribute__ ((packed));
363012771d8Swdenk 
364012771d8Swdenk 
365012771d8Swdenk struct usb_hub_device {
366012771d8Swdenk 	struct usb_device *pusb_dev;
367012771d8Swdenk 	struct usb_hub_descriptor desc;
368012771d8Swdenk };
369012771d8Swdenk 
370012771d8Swdenk #endif /*_USB_H_ */
371