USB: Add hub descriptor update hook for xHCI
authorSarah Sharp <sarah.a.sharp@linux.intel.com>
Fri, 4 Sep 2009 17:53:24 +0000 (10:53 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 23 Sep 2009 13:46:40 +0000 (06:46 -0700)
Add a hook for updating xHCI internal structures after khubd fetches the
hub descriptor and sets up the hub's TT information.  The xHCI driver must
update the internal structures before devices under the hub can be
enumerated.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/core/hcd.h
drivers/usb/core/hub.c
drivers/usb/host/xhci-pci.c

index ec5c67ea07b745a95b92e8db88349abadc1bbca1..79782a1c43f6098d98ac008bb5591b8607911ca1 100644 (file)
@@ -267,6 +267,11 @@ struct hc_driver {
        void    (*reset_bandwidth)(struct usb_hcd *, struct usb_device *);
                /* Returns the hardware-chosen device address */
        int     (*address_device)(struct usb_hcd *, struct usb_device *udev);
+               /* Notifies the HCD after a hub descriptor is fetched.
+                * Will block.
+                */
+       int     (*update_hub_device)(struct usb_hcd *, struct usb_device *hdev,
+                       struct usb_tt *tt, gfp_t mem_flags);
 };
 
 extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb);
index a880516020f32f43b7f975415897b572e812e787..5ce839137ad6a8350b4a6053f5076582ce076487 100644 (file)
@@ -860,6 +860,7 @@ static int hub_post_reset(struct usb_interface *intf)
 static int hub_configure(struct usb_hub *hub,
        struct usb_endpoint_descriptor *endpoint)
 {
+       struct usb_hcd *hcd;
        struct usb_device *hdev = hub->hdev;
        struct device *hub_dev = hub->intfdev;
        u16 hubstatus, hubchange;
@@ -1061,6 +1062,19 @@ static int hub_configure(struct usb_hub *hub,
                dev_dbg(hub_dev, "%umA bus power budget for each child\n",
                                hub->mA_per_port);
 
+       /* Update the HCD's internal representation of this hub before khubd
+        * starts getting port status changes for devices under the hub.
+        */
+       hcd = bus_to_hcd(hdev->bus);
+       if (hcd->driver->update_hub_device) {
+               ret = hcd->driver->update_hub_device(hcd, hdev,
+                               &hub->tt, GFP_KERNEL);
+               if (ret < 0) {
+                       message = "can't update HCD hub info";
+                       goto fail;
+               }
+       }
+
        ret = hub_hub_status(hub, &hubstatus, &hubchange);
        if (ret < 0) {
                message = "can't get hub status";
index b7712f22a9fb9f5f80ae76010299e615f75f7a0f..06595ec27bb71af11cd4524c316070c61da1f2d0 100644 (file)
@@ -136,6 +136,7 @@ static const struct hc_driver xhci_pci_hc_driver = {
        .check_bandwidth =      xhci_check_bandwidth,
        .reset_bandwidth =      xhci_reset_bandwidth,
        .address_device =       xhci_address_device,
+       .update_hub_device =    xhci_update_hub_device,
 
        /*
         * scheduling support