4 #include <linux/list.h>
7 * Hub Class feature numbers
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 struct usb_port_status
{
31 } __attribute__ ((packed
));
33 /* wPortStatus bits */
34 #define USB_PORT_STAT_CONNECTION 0x0001
35 #define USB_PORT_STAT_ENABLE 0x0002
36 #define USB_PORT_STAT_SUSPEND 0x0004
37 #define USB_PORT_STAT_OVERCURRENT 0x0008
38 #define USB_PORT_STAT_RESET 0x0010
39 #define USB_PORT_STAT_POWER 0x0100
40 #define USB_PORT_STAT_LOW_SPEED 0x0200
42 /* wPortChange bits */
43 #define USB_PORT_STAT_C_CONNECTION 0x0001
44 #define USB_PORT_STAT_C_ENABLE 0x0002
45 #define USB_PORT_STAT_C_SUSPEND 0x0004
46 #define USB_PORT_STAT_C_OVERCURRENT 0x0008
47 #define USB_PORT_STAT_C_RESET 0x0010
49 /* wHubCharacteristics (masks) */
50 #define HUB_CHAR_LPSM 0x0003
51 #define HUB_CHAR_COMPOUND 0x0004
52 #define HUB_CHAR_OCPM 0x0018
54 struct usb_hub_status
{
57 } __attribute__ ((packed
));
60 *Hub Status & Hub Change bit masks
62 #define HUB_STATUS_LOCAL_POWER 0x0001
63 #define HUB_STATUS_OVERCURRENT 0x0002
65 #define HUB_CHANGE_LOCAL_POWER 0x0001
66 #define HUB_CHANGE_OVERCURRENT 0x0002
69 struct usb_hub_descriptor
{
73 __u16 wHubCharacteristics
;
75 __u8 wHubCharacteristics
[2]; /* __u16 but not aligned! */
78 __u8 bHubContrCurrent
;
79 /* DeviceRemovable and PortPwrCtrlMask want to be variable-length
80 bitmaps that hold max 256 entries, but for now they're ignored */
84 } __attribute__ ((packed
));
89 USB_PORT_UNPOWERED
= 0, /* Default state */
90 USB_PORT_POWERED
, /* When we've put power to it */
91 USB_PORT_ENABLED
, /* When it's been enabled */
92 USB_PORT_DISABLED
, /* If it's been disabled */
93 USB_PORT_ADMINDISABLED
, /* Forced down */
97 usb_hub_port_state cstate
; /* Configuration state */
99 struct usb_device
*child
; /* Device attached to this port */
101 struct usb_hub
*parent
; /* Parent hub */
105 /* Device structure */
106 struct usb_device
*dev
;
108 /* Reference to the hub's polling IRQ and its associated pipe */
110 unsigned int irqpipe
;
113 struct list_head hub_list
;
115 /* Temporary event list */
116 struct list_head event_list
;
118 /* Number of ports on the hub */
121 struct usb_hub_port ports
[0]; /* Dynamically allocated */