Import 2.3.11pre5
[davej-history.git] / drivers / usb / hub.h
blob62f4c0ef93d2fa5888c412ac59c324aae9169031
1 #ifndef __LINUX_HUB_H
2 #define __LINUX_HUB_H
4 #include <linux/list.h>
6 /*
7 * Hub feature numbers
8 */
9 #define C_HUB_LOCAL_POWER 0
10 #define C_HUB_OVER_CURRENT 1
13 * Port feature numbers
15 #define USB_PORT_FEAT_CONNECTION 0
16 #define USB_PORT_FEAT_ENABLE 1
17 #define USB_PORT_FEAT_SUSPEND 2
18 #define USB_PORT_FEAT_OVER_CURRENT 3
19 #define USB_PORT_FEAT_RESET 4
20 #define USB_PORT_FEAT_POWER 8
21 #define USB_PORT_FEAT_LOWSPEED 9
22 #define USB_PORT_FEAT_C_CONNECTION 16
23 #define USB_PORT_FEAT_C_ENABLE 17
24 #define USB_PORT_FEAT_C_SUSPEND 18
25 #define USB_PORT_FEAT_C_OVER_CURRENT 19
26 #define USB_PORT_FEAT_C_RESET 20
28 /* wPortStatus */
29 #define USB_PORT_STAT_CONNECTION 0x0001
30 #define USB_PORT_STAT_ENABLE 0x0002
31 #define USB_PORT_STAT_SUSPEND 0x0004
32 #define USB_PORT_STAT_OVERCURRENT 0x0008
33 #define USB_PORT_STAT_RESET 0x0010
34 #define USB_PORT_STAT_POWER 0x0100
35 #define USB_PORT_STAT_LOW_SPEED 0x0200
37 /* wPortChange */
38 #define USB_PORT_STAT_C_CONNECTION 0x0001
39 #define USB_PORT_STAT_C_ENABLE 0x0002
40 #define USB_PORT_STAT_C_SUSPEND 0x0004
41 #define USB_PORT_STAT_C_OVERCURRENT 0x0008
42 #define USB_PORT_STAT_C_RESET 0x0010
44 /* wHubCharacteristics (masks) */
45 #define HUB_CHAR_LPSM 0x0003
46 #define HUB_CHAR_COMPOUND 0x0004
47 #define HUB_CHAR_OCPM 0x0018
49 struct usb_device;
51 typedef enum {
52 USB_PORT_UNPOWERED = 0, /* Default state */
53 USB_PORT_POWERED, /* When we've put power to it */
54 USB_PORT_ENABLED, /* When it's been enabled */
55 USB_PORT_DISABLED, /* If it's been disabled */
56 USB_PORT_ADMINDISABLED, /* Forced down */
57 } usb_hub_port_state;
59 struct usb_hub_port {
60 usb_hub_port_state cstate; /* Configuration state */
62 struct usb_device *child; /* Device attached to this port */
64 struct usb_hub *parent; /* Parent hub */
67 struct usb_hub {
68 /* Device structure */
69 struct usb_device *dev;
71 /* Reference to the hub's polling IRQ */
72 void* irq_handle;
74 /* List of hubs */
75 struct list_head hub_list;
77 /* Temporary event list */
78 struct list_head event_list;
80 /* Number of ports on the hub */
81 int nports;
83 struct usb_hub_port ports[0]; /* Dynamically allocated */
86 #endif