Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / drivers / usb / core / hub.h
index 9e81738..29d5f45 100644 (file)
@@ -60,8 +60,8 @@
  * See USB 2.0 spec Table 11-19 and Table 11-20
  */
 struct usb_port_status {
-       __u16 wPortStatus;
-       __u16 wPortChange;      
+       __le16 wPortStatus;
+       __le16 wPortChange;     
 } __attribute__ ((packed));
 
 /* 
@@ -103,8 +103,8 @@ struct usb_port_status {
 #define HUB_CHAR_PORTIND        0x0080 /* D7       */
 
 struct usb_hub_status {
-       __u16 wHubStatus;
-       __u16 wHubChange;
+       __le16 wHubStatus;
+       __le16 wHubChange;
 } __attribute__ ((packed));
 
 /*
@@ -131,7 +131,7 @@ struct usb_hub_descriptor {
        __u8  bDescLength;
        __u8  bDescriptorType;
        __u8  bNbrPorts;
-       __u16 wHubCharacteristics;
+       __le16 wHubCharacteristics;
        __u8  bPwrOn2PwrGood;
        __u8  bHubContrCurrent;
                /* add 1 bit for hub status change; round to bytes */
@@ -157,6 +157,12 @@ enum hub_led_mode {
 
 struct usb_device;
 
+/* Transaction Translator Think Times, in bits */
+#define HUB_TTTT_8_BITS                0x00
+#define HUB_TTTT_16_BITS       0x20
+#define HUB_TTTT_24_BITS       0x40
+#define HUB_TTTT_32_BITS       0x60
+
 /*
  * As of USB 2.0, full/low speed devices are segregated into trees.
  * One type grows from USB 1.1 host controllers (OHCI, UHCI etc).
@@ -170,6 +176,7 @@ struct usb_device;
 struct usb_tt {
        struct usb_device       *hub;   /* upstream highspeed hub */
        int                     multi;  /* true means one TT per port */
+       unsigned                think_time;     /* think time in ns */
 
        /* for control/bulk error recovery (CLEAR_TT_BUFFER) */
        spinlock_t              lock;
@@ -186,12 +193,12 @@ struct usb_tt_clear {
 extern void usb_hub_tt_clear_buffer (struct usb_device *dev, int pipe);
 
 struct usb_hub {
-       struct usb_interface    *intf;          /* the "real" device */
+       struct device           *intfdev;       /* the "interface" device */
        struct usb_device       *hdev;
        struct urb              *urb;           /* for interrupt polling pipe */
 
-       /* buffer for urb ... 1 bit each for hub and children, rounded up */
-       char                    (*buffer)[(USB_MAXCHILDREN + 1 + 7) / 8];
+       /* buffer for urb ... with extra space in case of babble */
+       char                    (*buffer)[8];
        dma_addr_t              buffer_dma;     /* DMA address for buffer */
        union {
                struct usb_hub_status   hub;
@@ -205,6 +212,7 @@ struct usb_hub {
        unsigned long           event_bits[1];  /* status change bitmask */
        unsigned long           change_bits[1]; /* ports with logical connect
                                                        status change */
+       unsigned long           busy_bits[1];   /* ports being reset */
 #if USB_MAXCHILDREN > 31 /* 8*sizeof(unsigned long) - 1 */
 #error event_bits[] is too short!
 #endif
@@ -212,22 +220,16 @@ struct usb_hub {
        struct usb_hub_descriptor *descriptor;  /* class descriptor */
        struct usb_tt           tt;             /* Transaction Translator */
 
-       u8                      power_budget;   /* in 2mA units; or zero */
+       unsigned                mA_per_port;    /* current for each child */
+
+       unsigned                limited_power:1;
+       unsigned                quiescing:1;
+       unsigned                activating:1;
+       unsigned                resume_root_hub:1;
 
        unsigned                has_indicators:1;
        enum hub_led_mode       indicator[USB_MAXCHILDREN];
        struct work_struct      leds;
 };
 
-/* use this for low-powered root hubs */
-static inline void
-hub_set_power_budget (struct usb_device *hubdev, unsigned mA)
-{
-       struct usb_hub  *hub;
-
-       hub = (struct usb_hub *)
-               usb_get_intfdata (hubdev->actconfig->interface[0]);
-       hub->power_budget = min(mA,(unsigned)500)/2;
-}
-
 #endif /* __LINUX_HUB_H */