Commit 83de4b2b90887b5b317d8313864fe4cc5db35280

Authored by Sarah Sharp
1 parent d673bfcbff

usb: Store bus type in usb_hcd, not in driver flags.

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>

Showing 2 changed files with 8 additions and 3 deletions Side-by-side Diff

drivers/usb/core/hcd.c
... ... @@ -507,7 +507,7 @@
507 507 case DeviceRequest | USB_REQ_GET_DESCRIPTOR:
508 508 switch (wValue & 0xff00) {
509 509 case USB_DT_DEVICE << 8:
510   - switch (hcd->driver->flags & HCD_MASK) {
  510 + switch (hcd->speed) {
511 511 case HCD_USB3:
512 512 bufp = usb3_rh_dev_descriptor;
513 513 break;
... ... @@ -525,7 +525,7 @@
525 525 patch_protocol = 1;
526 526 break;
527 527 case USB_DT_CONFIG << 8:
528   - switch (hcd->driver->flags & HCD_MASK) {
  528 + switch (hcd->speed) {
529 529 case HCD_USB3:
530 530 bufp = ss_rh_config_descriptor;
531 531 len = sizeof ss_rh_config_descriptor;
... ... @@ -2216,6 +2216,7 @@
2216 2216 #endif
2217 2217  
2218 2218 hcd->driver = driver;
  2219 + hcd->speed = driver->flags & HCD_MASK;
2219 2220 hcd->product_desc = (driver->product_desc) ? driver->product_desc :
2220 2221 "USB Host Controller";
2221 2222 return hcd;
... ... @@ -2325,7 +2326,7 @@
2325 2326 }
2326 2327 hcd->self.root_hub = rhdev;
2327 2328  
2328   - switch (hcd->driver->flags & HCD_MASK) {
  2329 + switch (hcd->speed) {
2329 2330 case HCD_USB11:
2330 2331 rhdev->speed = USB_SPEED_FULL;
2331 2332 break;
include/linux/usb/hcd.h
... ... @@ -76,6 +76,10 @@
76 76 struct kref kref; /* reference counter */
77 77  
78 78 const char *product_desc; /* product/vendor string */
  79 + int speed; /* Speed for this roothub.
  80 + * May be different from
  81 + * hcd->driver->flags & HCD_MASK
  82 + */
79 83 char irq_descr[24]; /* driver + bus # */
80 84  
81 85 struct timer_list rh_timer; /* drives root-hub polling */