usb: Store bus type in usb_hcd, not in driver flags.
authorSarah Sharp <sarah.a.sharp@linux.intel.com>
Thu, 2 Dec 2010 22:45:18 +0000 (14:45 -0800)
committerSarah Sharp <sarah.a.sharp@linux.intel.com>
Mon, 14 Mar 2011 01:07:15 +0000 (18:07 -0700)
The xHCI driver essentially has both a USB 2.0 and a USB 3.0 roothub.  So
setting the HCD_USB3 bits in the hcd->driver->flags is a bit misleading.
Add a new field to usb_hcd, bcdUSB.  Store the result of
hcd->driver->flags & HCD_MASK in it.  Later, when we have the xHCI driver
register the two roothubs, we'll set the usb_hcd->bcdUSB field to HCD_USB2
for the USB 2.0 roothub, and HCD_USB3 for the USB 3.0 roothub.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
drivers/usb/core/hcd.c
include/linux/usb/hcd.h

index 3ba27118adc5db845f4ba18fc1a422b97cec0471..a0adcac3da080357648429dc0f2c760ad678063d 100644 (file)
@@ -507,7 +507,7 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb)
        case DeviceRequest | USB_REQ_GET_DESCRIPTOR:
                switch (wValue & 0xff00) {
                case USB_DT_DEVICE << 8:
-                       switch (hcd->driver->flags & HCD_MASK) {
+                       switch (hcd->speed) {
                        case HCD_USB3:
                                bufp = usb3_rh_dev_descriptor;
                                break;
@@ -525,7 +525,7 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb)
                                patch_protocol = 1;
                        break;
                case USB_DT_CONFIG << 8:
-                       switch (hcd->driver->flags & HCD_MASK) {
+                       switch (hcd->speed) {
                        case HCD_USB3:
                                bufp = ss_rh_config_descriptor;
                                len = sizeof ss_rh_config_descriptor;
@@ -2216,6 +2216,7 @@ struct usb_hcd *usb_create_hcd (const struct hc_driver *driver,
 #endif
 
        hcd->driver = driver;
+       hcd->speed = driver->flags & HCD_MASK;
        hcd->product_desc = (driver->product_desc) ? driver->product_desc :
                        "USB Host Controller";
        return hcd;
@@ -2325,7 +2326,7 @@ int usb_add_hcd(struct usb_hcd *hcd,
        }
        hcd->self.root_hub = rhdev;
 
-       switch (hcd->driver->flags & HCD_MASK) {
+       switch (hcd->speed) {
        case HCD_USB11:
                rhdev->speed = USB_SPEED_FULL;
                break;
index 836aaa91ee15ebdc2fd2b1928e6f56e2e5593b4c..b8bb6934f30b99786f86b33c11501d952bceeee9 100644 (file)
@@ -76,6 +76,10 @@ struct usb_hcd {
        struct kref             kref;           /* reference counter */
 
        const char              *product_desc;  /* product/vendor string */
+       int                     speed;          /* Speed for this roothub.
+                                                * May be different from
+                                                * hcd->driver->flags & HCD_MASK
+                                                */
        char                    irq_descr[24];  /* driver + bus # */
 
        struct timer_list       rh_timer;       /* drives root-hub polling */