xref: /openbmc/u-boot/include/usb.h (revision 48867208444cb2a82e2af9c3249e90b7ed4a1751)
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>
30012771d8Swdenk 
31012771d8Swdenk /* Everything is aribtrary */
32012771d8Swdenk #define USB_ALTSETTINGALLOC		4
33012771d8Swdenk #define USB_MAXALTSETTING		128	/* Hard limit */
34012771d8Swdenk 
35012771d8Swdenk #define USB_MAX_DEVICE			32
36012771d8Swdenk #define USB_MAXCONFIG			8
37012771d8Swdenk #define USB_MAXINTERFACES		8
38012771d8Swdenk #define USB_MAXENDPOINTS		16
39012771d8Swdenk #define USB_MAXCHILDREN			8	/* This is arbitrary */
40012771d8Swdenk #define USB_MAX_HUB			16
41012771d8Swdenk 
42012771d8Swdenk #define USB_CNTL_TIMEOUT 100 /* 100ms timeout */
43012771d8Swdenk 
44012771d8Swdenk /* String descriptor */
45012771d8Swdenk struct usb_string_descriptor {
46012771d8Swdenk 	unsigned char  bLength;
47012771d8Swdenk 	unsigned char  bDescriptorType;
48012771d8Swdenk 	unsigned short wData[1];
49012771d8Swdenk } __attribute__ ((packed));
50012771d8Swdenk 
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 
61012771d8Swdenk /* All standard descriptors have these 2 fields in common */
62012771d8Swdenk struct usb_descriptor_header {
63012771d8Swdenk 	unsigned char  bLength;
64012771d8Swdenk 	unsigned char  bDescriptorType;
65012771d8Swdenk } __attribute__ ((packed));
66012771d8Swdenk 
67012771d8Swdenk /* Device descriptor */
68012771d8Swdenk struct usb_device_descriptor {
69012771d8Swdenk 	unsigned char  bLength;
70012771d8Swdenk 	unsigned char  bDescriptorType;
71012771d8Swdenk 	unsigned short bcdUSB;
72012771d8Swdenk 	unsigned char  bDeviceClass;
73012771d8Swdenk 	unsigned char  bDeviceSubClass;
74012771d8Swdenk 	unsigned char  bDeviceProtocol;
75012771d8Swdenk 	unsigned char  bMaxPacketSize0;
76012771d8Swdenk 	unsigned short idVendor;
77012771d8Swdenk 	unsigned short idProduct;
78012771d8Swdenk 	unsigned short bcdDevice;
79012771d8Swdenk 	unsigned char  iManufacturer;
80012771d8Swdenk 	unsigned char  iProduct;
81012771d8Swdenk 	unsigned char  iSerialNumber;
82012771d8Swdenk 	unsigned char  bNumConfigurations;
83012771d8Swdenk } __attribute__ ((packed));
84012771d8Swdenk 
85012771d8Swdenk 
86012771d8Swdenk /* Endpoint descriptor */
87012771d8Swdenk struct usb_endpoint_descriptor {
88012771d8Swdenk 	unsigned char  bLength;
89012771d8Swdenk 	unsigned char  bDescriptorType;
90012771d8Swdenk 	unsigned char  bEndpointAddress;
91012771d8Swdenk 	unsigned char  bmAttributes;
92012771d8Swdenk 	unsigned short wMaxPacketSize;
93012771d8Swdenk 	unsigned char  bInterval;
94012771d8Swdenk 	unsigned char  bRefresh;
95012771d8Swdenk 	unsigned char  bSynchAddress;
96012771d8Swdenk 
97012771d8Swdenk } __attribute__ ((packed));
98012771d8Swdenk /* Interface descriptor */
99012771d8Swdenk struct usb_interface_descriptor {
100012771d8Swdenk 	unsigned char  bLength;
101012771d8Swdenk 	unsigned char  bDescriptorType;
102012771d8Swdenk 	unsigned char  bInterfaceNumber;
103012771d8Swdenk 	unsigned char  bAlternateSetting;
104012771d8Swdenk 	unsigned char  bNumEndpoints;
105012771d8Swdenk 	unsigned char  bInterfaceClass;
106012771d8Swdenk 	unsigned char  bInterfaceSubClass;
107012771d8Swdenk 	unsigned char  bInterfaceProtocol;
108012771d8Swdenk 	unsigned char  iInterface;
109012771d8Swdenk 
110012771d8Swdenk 	unsigned char  no_of_ep;
1117455af41SBartlomiej Sieka 	unsigned char  num_altsetting;
112012771d8Swdenk 	unsigned char  act_altsetting;
113012771d8Swdenk 	struct usb_endpoint_descriptor ep_desc[USB_MAXENDPOINTS];
114012771d8Swdenk } __attribute__ ((packed));
115012771d8Swdenk 
116012771d8Swdenk 
117012771d8Swdenk /* Configuration descriptor information.. */
118012771d8Swdenk struct usb_config_descriptor {
119012771d8Swdenk 	unsigned char  bLength;
120012771d8Swdenk 	unsigned char  bDescriptorType;
121012771d8Swdenk 	unsigned short wTotalLength;
122012771d8Swdenk 	unsigned char  bNumInterfaces;
123012771d8Swdenk 	unsigned char  bConfigurationValue;
124012771d8Swdenk 	unsigned char  iConfiguration;
125012771d8Swdenk 	unsigned char  bmAttributes;
126012771d8Swdenk 	unsigned char  MaxPower;
127012771d8Swdenk 
128012771d8Swdenk 	unsigned char  no_of_if;		/* number of interfaces */
129012771d8Swdenk 	struct usb_interface_descriptor if_desc[USB_MAXINTERFACES];
130012771d8Swdenk } __attribute__ ((packed));
131012771d8Swdenk 
132*48867208SRemy Bohmer enum {
133*48867208SRemy Bohmer 	/* Maximum packet size; encoded as 0,1,2,3 = 8,16,32,64 */
134*48867208SRemy Bohmer 	PACKET_SIZE_8   = 0,
135*48867208SRemy Bohmer 	PACKET_SIZE_16  = 1,
136*48867208SRemy Bohmer 	PACKET_SIZE_32  = 2,
137*48867208SRemy Bohmer 	PACKET_SIZE_64  = 3,
138*48867208SRemy Bohmer };
139012771d8Swdenk 
140012771d8Swdenk struct usb_device {
141012771d8Swdenk 	int devnum;			/* Device number on USB bus */
142012771d8Swdenk 	int slow;			/* Slow device? */
143012771d8Swdenk 	char mf[32];			/* manufacturer */
144012771d8Swdenk 	char prod[32];			/* product */
145012771d8Swdenk 	char serial[32];		/* serial number */
146012771d8Swdenk 
147*48867208SRemy Bohmer 	/* Maximum packet size; one of: PACKET_SIZE_* */
148*48867208SRemy Bohmer 	int maxpacketsize;
149*48867208SRemy Bohmer 	/* one bit for each endpoint ([0] = IN, [1] = OUT) */
150*48867208SRemy Bohmer 	unsigned int toggle[2];
151*48867208SRemy Bohmer 	/* endpoint halts; one bit per endpoint # & direction; */
152*48867208SRemy Bohmer 	unsigned int halted[2];
153012771d8Swdenk 			    /* [0] = IN, [1] = OUT */
154012771d8Swdenk 	int epmaxpacketin[16];		/* INput endpoint specific maximums */
155012771d8Swdenk 	int epmaxpacketout[16];		/* OUTput endpoint specific maximums */
156012771d8Swdenk 
157012771d8Swdenk 	int configno;			/* selected config number */
158012771d8Swdenk 	struct usb_device_descriptor descriptor; /* Device Descriptor */
159012771d8Swdenk 	struct usb_config_descriptor config; /* config descriptor */
160012771d8Swdenk 
161012771d8Swdenk 	int have_langid;		/* whether string_langid is valid yet */
162012771d8Swdenk 	int string_langid;		/* language ID for strings */
163012771d8Swdenk 	int (*irq_handle)(struct usb_device *dev);
164012771d8Swdenk 	unsigned long irq_status;
165012771d8Swdenk 	int irq_act_len;		/* transfered bytes */
166012771d8Swdenk 	void *privptr;
167012771d8Swdenk 	/*
168012771d8Swdenk 	 * Child devices -  if this is a hub device
169012771d8Swdenk 	 * Each instance needs its own set of data structures.
170012771d8Swdenk 	 */
171012771d8Swdenk 	unsigned long status;
172012771d8Swdenk 	int act_len;			/* transfered bytes */
173012771d8Swdenk 	int maxchild;			/* Number of ports if hub */
174012771d8Swdenk 	struct usb_device *parent;
175012771d8Swdenk 	struct usb_device *children[USB_MAXCHILDREN];
176012771d8Swdenk };
177012771d8Swdenk 
178012771d8Swdenk /**********************************************************************
179012771d8Swdenk  * this is how the lowlevel part communicate with the outer world
180012771d8Swdenk  */
181012771d8Swdenk 
182822af351SRodolfo Giometti #if defined(CONFIG_USB_UHCI) || defined(CONFIG_USB_OHCI) || \
183822af351SRodolfo Giometti 	defined(CONFIG_USB_OHCI_NEW) || defined (CONFIG_USB_SL811HS) || \
184fd0f2f37SYoshihiro Shimoda 	defined(CONFIG_USB_ISP116X_HCD) || defined(CONFIG_USB_R8A66597_HCD)
185822af351SRodolfo Giometti 
186012771d8Swdenk int usb_lowlevel_init(void);
187012771d8Swdenk int usb_lowlevel_stop(void);
188012771d8Swdenk int submit_bulk_msg(struct usb_device *dev, unsigned long pipe, void *buffer,int transfer_len);
189012771d8Swdenk int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
190012771d8Swdenk 			int transfer_len,struct devrequest *setup);
191012771d8Swdenk int submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
192012771d8Swdenk 			int transfer_len, int interval);
193fdcfaa1bSZhang Wei void usb_event_poll(void);
194012771d8Swdenk 
195012771d8Swdenk /* Defines */
196012771d8Swdenk #define USB_UHCI_VEND_ID 0x8086
197012771d8Swdenk #define USB_UHCI_DEV_ID	 0x7112
198012771d8Swdenk 
199012771d8Swdenk #else
200012771d8Swdenk #error USB Lowlevel not defined
201012771d8Swdenk #endif
202012771d8Swdenk 
203012771d8Swdenk #ifdef CONFIG_USB_STORAGE
204012771d8Swdenk 
205012771d8Swdenk #define USB_MAX_STOR_DEV 5
206012771d8Swdenk block_dev_desc_t *usb_stor_get_dev(int index);
207012771d8Swdenk int usb_stor_scan(int mode);
208e813eae3SAnatolij Gustschin int usb_stor_info(void);
209012771d8Swdenk 
210012771d8Swdenk #endif
211012771d8Swdenk 
212012771d8Swdenk #ifdef CONFIG_USB_KEYBOARD
213012771d8Swdenk 
214012771d8Swdenk int drv_usb_kbd_init(void);
215012771d8Swdenk int usb_kbd_deregister(void);
216012771d8Swdenk 
217012771d8Swdenk #endif
218012771d8Swdenk /* routines */
219012771d8Swdenk int usb_init(void); /* initialize the USB Controller */
220012771d8Swdenk int usb_stop(void); /* stop the USB Controller */
221012771d8Swdenk 
222012771d8Swdenk 
223012771d8Swdenk int usb_set_protocol(struct usb_device *dev, int ifnum, int protocol);
224012771d8Swdenk int usb_set_idle(struct usb_device *dev, int ifnum, int duration, int report_id);
225012771d8Swdenk struct usb_device * usb_get_dev_index(int index);
226012771d8Swdenk int usb_control_msg(struct usb_device *dev, unsigned int pipe,
227012771d8Swdenk 			unsigned char request, unsigned char requesttype,
228012771d8Swdenk 			unsigned short value, unsigned short index,
229012771d8Swdenk 			void *data, unsigned short size, int timeout);
230012771d8Swdenk int usb_bulk_msg(struct usb_device *dev, unsigned int pipe,
231012771d8Swdenk 			void *data, int len, int *actual_length, int timeout);
232012771d8Swdenk int usb_submit_int_msg(struct usb_device *dev, unsigned long pipe,
233012771d8Swdenk 			void *buffer,int transfer_len, int interval);
234012771d8Swdenk void usb_disable_asynch(int disable);
235012771d8Swdenk int usb_maxpacket(struct usb_device *dev,unsigned long pipe);
236012771d8Swdenk void __inline__ wait_ms(unsigned long ms);
237012771d8Swdenk int usb_get_configuration_no(struct usb_device *dev,unsigned char *buffer,int cfgno);
238012771d8Swdenk int usb_get_report(struct usb_device *dev, int ifnum, unsigned char type, unsigned char id, void *buf, int size);
239012771d8Swdenk int usb_get_class_descriptor(struct usb_device *dev, int ifnum,
240012771d8Swdenk 		unsigned char type, unsigned char id, void *buf, int size);
241012771d8Swdenk int usb_clear_halt(struct usb_device *dev, int pipe);
242012771d8Swdenk int usb_string(struct usb_device *dev, int index, char *buf, size_t size);
243012771d8Swdenk int usb_set_interface(struct usb_device *dev, int interface, int alternate);
244012771d8Swdenk 
245012771d8Swdenk /* big endian -> little endian conversion */
246149dded2Swdenk /* some CPUs are already little endian e.g. the ARM920T */
247ae3b770eSMarkus Klotzbuecher #define __swap_16(x) \
2483f85ce27Swdenk 	({ unsigned short x_ = (unsigned short)x; \
2493f85ce27Swdenk 	 (unsigned short)( \
2503f85ce27Swdenk 		((x_ & 0x00FFU) << 8) | ((x_ & 0xFF00U) >> 8) ); \
2513f85ce27Swdenk 	})
252ae3b770eSMarkus Klotzbuecher #define __swap_32(x) \
2533f85ce27Swdenk 	({ unsigned long x_ = (unsigned long)x; \
2543f85ce27Swdenk 	 (unsigned long)( \
2553f85ce27Swdenk 		((x_ & 0x000000FFUL) << 24) | \
2563f85ce27Swdenk 		((x_ & 0x0000FF00UL) <<	 8) | \
2573f85ce27Swdenk 		((x_ & 0x00FF0000UL) >>	 8) | \
2583f85ce27Swdenk 		((x_ & 0xFF000000UL) >> 24) ); \
2593f85ce27Swdenk 	})
260ae3b770eSMarkus Klotzbuecher 
261ae3b770eSMarkus Klotzbuecher #ifdef LITTLEENDIAN
262ae3b770eSMarkus Klotzbuecher # define swap_16(x) (x)
263ae3b770eSMarkus Klotzbuecher # define swap_32(x) (x)
264ae3b770eSMarkus Klotzbuecher #else
265ae3b770eSMarkus Klotzbuecher # define swap_16(x) __swap_16(x)
266ae3b770eSMarkus Klotzbuecher # define swap_32(x) __swap_32(x)
267149dded2Swdenk #endif /* LITTLEENDIAN */
268012771d8Swdenk 
269012771d8Swdenk /*
270012771d8Swdenk  * Calling this entity a "pipe" is glorifying it. A USB pipe
271012771d8Swdenk  * is something embarrassingly simple: it basically consists
272012771d8Swdenk  * of the following information:
273012771d8Swdenk  *  - device number (7 bits)
274012771d8Swdenk  *  - endpoint number (4 bits)
275012771d8Swdenk  *  - current Data0/1 state (1 bit)
276012771d8Swdenk  *  - direction (1 bit)
277012771d8Swdenk  *  - speed (1 bit)
278012771d8Swdenk  *  - max packet size (2 bits: 8, 16, 32 or 64)
279012771d8Swdenk  *  - pipe type (2 bits: control, interrupt, bulk, isochronous)
280012771d8Swdenk  *
281012771d8Swdenk  * That's 18 bits. Really. Nothing more. And the USB people have
282012771d8Swdenk  * documented these eighteen bits as some kind of glorious
283012771d8Swdenk  * virtual data structure.
284012771d8Swdenk  *
285012771d8Swdenk  * Let's not fall in that trap. We'll just encode it as a simple
286012771d8Swdenk  * unsigned int. The encoding is:
287012771d8Swdenk  *
288012771d8Swdenk  *  - max size:		bits 0-1	(00 = 8, 01 = 16, 10 = 32, 11 = 64)
289012771d8Swdenk  *  - direction:	bit 7		(0 = Host-to-Device [Out], 1 = Device-to-Host [In])
290012771d8Swdenk  *  - device:		bits 8-14
291012771d8Swdenk  *  - endpoint:		bits 15-18
292012771d8Swdenk  *  - Data0/1:		bit 19
293012771d8Swdenk  *  - speed:		bit 26		(0 = Full, 1 = Low Speed)
294012771d8Swdenk  *  - pipe type:	bits 30-31	(00 = isochronous, 01 = interrupt, 10 = control, 11 = bulk)
295012771d8Swdenk  *
296012771d8Swdenk  * Why? Because it's arbitrary, and whatever encoding we select is really
297012771d8Swdenk  * up to us. This one happens to share a lot of bit positions with the UHCI
298012771d8Swdenk  * specification, so that much of the uhci driver can just mask the bits
299012771d8Swdenk  * appropriately.
300012771d8Swdenk  */
301012771d8Swdenk /* Create various pipes... */
302012771d8Swdenk #define create_pipe(dev,endpoint) \
303012771d8Swdenk 		(((dev)->devnum << 8) | (endpoint << 15) | ((dev)->slow << 26) | (dev)->maxpacketsize)
304012771d8Swdenk #define default_pipe(dev) ((dev)->slow <<26)
305012771d8Swdenk 
306012771d8Swdenk #define usb_sndctrlpipe(dev,endpoint)	((PIPE_CONTROL << 30) | create_pipe(dev,endpoint))
307012771d8Swdenk #define usb_rcvctrlpipe(dev,endpoint)	((PIPE_CONTROL << 30) | create_pipe(dev,endpoint) | USB_DIR_IN)
308012771d8Swdenk #define usb_sndisocpipe(dev,endpoint)	((PIPE_ISOCHRONOUS << 30) | create_pipe(dev,endpoint))
309012771d8Swdenk #define usb_rcvisocpipe(dev,endpoint)	((PIPE_ISOCHRONOUS << 30) | create_pipe(dev,endpoint) | USB_DIR_IN)
310012771d8Swdenk #define usb_sndbulkpipe(dev,endpoint)	((PIPE_BULK << 30) | create_pipe(dev,endpoint))
311012771d8Swdenk #define usb_rcvbulkpipe(dev,endpoint)	((PIPE_BULK << 30) | create_pipe(dev,endpoint) | USB_DIR_IN)
312012771d8Swdenk #define usb_sndintpipe(dev,endpoint)	((PIPE_INTERRUPT << 30) | create_pipe(dev,endpoint))
313012771d8Swdenk #define usb_rcvintpipe(dev,endpoint)	((PIPE_INTERRUPT << 30) | create_pipe(dev,endpoint) | USB_DIR_IN)
314012771d8Swdenk #define usb_snddefctrl(dev)		((PIPE_CONTROL << 30) | default_pipe(dev))
315012771d8Swdenk #define usb_rcvdefctrl(dev)		((PIPE_CONTROL << 30) | default_pipe(dev) | USB_DIR_IN)
316012771d8Swdenk 
317012771d8Swdenk /* The D0/D1 toggle bits */
318012771d8Swdenk #define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> ep) & 1)
319012771d8Swdenk #define usb_dotoggle(dev, ep, out)  ((dev)->toggle[out] ^= (1 << ep))
320012771d8Swdenk #define usb_settoggle(dev, ep, out, bit) ((dev)->toggle[out] = ((dev)->toggle[out] & ~(1 << ep)) | ((bit) << ep))
321012771d8Swdenk 
322012771d8Swdenk /* Endpoint halt control/status */
323012771d8Swdenk #define usb_endpoint_out(ep_dir)	(((ep_dir >> 7) & 1) ^ 1)
324012771d8Swdenk #define usb_endpoint_halt(dev, ep, out) ((dev)->halted[out] |= (1 << (ep)))
325012771d8Swdenk #define usb_endpoint_running(dev, ep, out) ((dev)->halted[out] &= ~(1 << (ep)))
326012771d8Swdenk #define usb_endpoint_halted(dev, ep, out) ((dev)->halted[out] & (1 << (ep)))
327012771d8Swdenk 
328012771d8Swdenk #define usb_packetid(pipe)	(((pipe) & USB_DIR_IN) ? USB_PID_IN : USB_PID_OUT)
329012771d8Swdenk 
330012771d8Swdenk #define usb_pipeout(pipe)	((((pipe) >> 7) & 1) ^ 1)
331012771d8Swdenk #define usb_pipein(pipe)	(((pipe) >> 7) & 1)
332012771d8Swdenk #define usb_pipedevice(pipe)	(((pipe) >> 8) & 0x7f)
333012771d8Swdenk #define usb_pipe_endpdev(pipe)	(((pipe) >> 8) & 0x7ff)
334012771d8Swdenk #define usb_pipeendpoint(pipe)	(((pipe) >> 15) & 0xf)
335012771d8Swdenk #define usb_pipedata(pipe)	(((pipe) >> 19) & 1)
336012771d8Swdenk #define usb_pipeslow(pipe)	(((pipe) >> 26) & 1)
337012771d8Swdenk #define usb_pipetype(pipe)	(((pipe) >> 30) & 3)
338012771d8Swdenk #define usb_pipeisoc(pipe)	(usb_pipetype((pipe)) == PIPE_ISOCHRONOUS)
339012771d8Swdenk #define usb_pipeint(pipe)	(usb_pipetype((pipe)) == PIPE_INTERRUPT)
340012771d8Swdenk #define usb_pipecontrol(pipe)	(usb_pipetype((pipe)) == PIPE_CONTROL)
341012771d8Swdenk #define usb_pipebulk(pipe)	(usb_pipetype((pipe)) == PIPE_BULK)
342012771d8Swdenk 
343012771d8Swdenk 
344012771d8Swdenk /*************************************************************************
345012771d8Swdenk  * Hub Stuff
346012771d8Swdenk  */
347012771d8Swdenk struct usb_port_status {
348012771d8Swdenk 	unsigned short wPortStatus;
349012771d8Swdenk 	unsigned short wPortChange;
350012771d8Swdenk } __attribute__ ((packed));
351012771d8Swdenk 
352012771d8Swdenk struct usb_hub_status {
353012771d8Swdenk 	unsigned short wHubStatus;
354012771d8Swdenk 	unsigned short wHubChange;
355012771d8Swdenk } __attribute__ ((packed));
356012771d8Swdenk 
357012771d8Swdenk 
358012771d8Swdenk /* Hub descriptor */
359012771d8Swdenk struct usb_hub_descriptor {
360012771d8Swdenk 	unsigned char  bLength;
361012771d8Swdenk 	unsigned char  bDescriptorType;
362012771d8Swdenk 	unsigned char  bNbrPorts;
363012771d8Swdenk 	unsigned short wHubCharacteristics;
364012771d8Swdenk 	unsigned char  bPwrOn2PwrGood;
365012771d8Swdenk 	unsigned char  bHubContrCurrent;
366012771d8Swdenk 	unsigned char  DeviceRemovable[(USB_MAXCHILDREN+1+7)/8];
367012771d8Swdenk 	unsigned char  PortPowerCtrlMask[(USB_MAXCHILDREN+1+7)/8];
368012771d8Swdenk 		/* DeviceRemovable and PortPwrCtrlMask want to be variable-length
369012771d8Swdenk 	   bitmaps that hold max 255 entries. (bit0 is ignored) */
370012771d8Swdenk } __attribute__ ((packed));
371012771d8Swdenk 
372012771d8Swdenk 
373012771d8Swdenk struct usb_hub_device {
374012771d8Swdenk 	struct usb_device *pusb_dev;
375012771d8Swdenk 	struct usb_hub_descriptor desc;
376012771d8Swdenk };
377012771d8Swdenk 
378012771d8Swdenk #endif /*_USB_H_ */
379