]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
USB: Remove bogus USB_PORT_STAT_SUPER_SPEED symbol.
authorSarah Sharp <sarah.a.sharp@linux.intel.com>
Tue, 7 Dec 2010 05:00:19 +0000 (21:00 -0800)
committerSarah Sharp <sarah.a.sharp@linux.intel.com>
Mon, 14 Mar 2011 01:23:50 +0000 (18:23 -0700)
USB_PORT_STAT_SUPER_SPEED is a made up symbol that the USB core used to
track whether USB ports had a SuperSpeed device attached.  This is a
linux-internal symbol that was used when SuperSpeed and non-SuperSpeed
devices would show up under the same xHCI roothub.  This particular
port status is never returned by external USB 3.0 hubs.  (Instead they
have a USB_PORT_STAT_SPEED_5GBPS that uses a completely different speed
mask.)

Now that the xHCI driver registers two roothubs, USB 3.0 devices will only
show up under USB 3.0 hubs.  Rip out USB_PORT_STAT_SUPER_SPEED and replace
it with calls to hub_is_superspeed().

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

index 825d803720b304636a2ce2208cfd8ae9a8977711..13aafd1b45e57cfdab2cb61d4542e961268894c8 100644 (file)
@@ -155,14 +155,14 @@ EXPORT_SYMBOL_GPL(ehci_cf_port_reset_rwsem);
 
 static int usb_reset_and_verify_device(struct usb_device *udev);
 
-static inline char *portspeed(int portstatus)
+static inline char *portspeed(struct usb_hub *hub, int portstatus)
 {
+       if (hub_is_superspeed(hub->hdev))
+               return "5.0 Gb/s";
        if (portstatus & USB_PORT_STAT_HIGH_SPEED)
                return "480 Mb/s";
        else if (portstatus & USB_PORT_STAT_LOW_SPEED)
                return "1.5 Mb/s";
-       else if (portstatus & USB_PORT_STAT_SUPER_SPEED)
-               return "5.0 Gb/s";
        else
                return "12 Mb/s";
 }
@@ -385,9 +385,6 @@ static int hub_port_status(struct usb_hub *hub, int port1,
                        u16 tmp = *status & USB_SS_PORT_STAT_MASK;
                        if (*status & USB_SS_PORT_STAT_POWER)
                                tmp |= USB_PORT_STAT_POWER;
-                       if ((*status & USB_SS_PORT_STAT_SPEED) ==
-                                       USB_PORT_STAT_SPEED_5GBPS)
-                               tmp |= USB_PORT_STAT_SUPER_SPEED;
                        *status = tmp;
                }
 
@@ -795,12 +792,8 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
                         * USB3 protocol ports will automatically transition
                         * to Enabled state when detect an USB3.0 device attach.
                         * Do not disable USB3 protocol ports.
-                        * FIXME: USB3 root hub and external hubs are treated
-                        * differently here.
                         */
-                       if (hdev->descriptor.bDeviceProtocol != 3 ||
-                           (!hdev->parent &&
-                            !(portstatus & USB_PORT_STAT_SUPER_SPEED))) {
+                       if (!hub_is_superspeed(hdev)) {
                                clear_port_feature(hdev, port1,
                                                   USB_PORT_FEAT_ENABLE);
                                portstatus &= ~USB_PORT_STAT_ENABLE;
@@ -2067,14 +2060,12 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1,
                    (portstatus & USB_PORT_STAT_ENABLE)) {
                        if (hub_is_wusb(hub))
                                udev->speed = USB_SPEED_WIRELESS;
-                       else if (portstatus & USB_PORT_STAT_SUPER_SPEED)
+                       else if (hub_is_superspeed(hub->hdev))
                                udev->speed = USB_SPEED_SUPER;
                        else if (portstatus & USB_PORT_STAT_HIGH_SPEED)
                                udev->speed = USB_SPEED_HIGH;
                        else if (portstatus & USB_PORT_STAT_LOW_SPEED)
                                udev->speed = USB_SPEED_LOW;
-                       else if (portstatus & USB_PORT_STAT_SUPER_SPEED)
-                               udev->speed = USB_SPEED_SUPER;
                        else
                                udev->speed = USB_SPEED_FULL;
                        return 0;
@@ -3067,7 +3058,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
 
        dev_dbg (hub_dev,
                "port %d, status %04x, change %04x, %s\n",
-               port1, portstatus, portchange, portspeed (portstatus));
+               port1, portstatus, portchange, portspeed(hub, portstatus));
 
        if (hub->has_indicators) {
                set_port_led(hub, port1, HUB_LED_AUTO);
@@ -3168,19 +3159,8 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
                udev->level = hdev->level + 1;
                udev->wusb = hub_is_wusb(hub);
 
-               /*
-                * USB 3.0 devices are reset automatically before the connect
-                * port status change appears, and the root hub port status
-                * shows the correct speed.  We also get port change
-                * notifications for USB 3.0 devices from the USB 3.0 portion of
-                * an external USB 3.0 hub, but this isn't handled correctly yet
-                * FIXME.
-                */
-
-               if (!(hcd->driver->flags & HCD_USB3))
-                       udev->speed = USB_SPEED_UNKNOWN;
-               else if ((hdev->parent == NULL) &&
-                               (portstatus & USB_PORT_STAT_SUPER_SPEED))
+               /* Only USB 3.0 devices are connected to SuperSpeed hubs. */
+               if (hub_is_superspeed(hub->hdev))
                        udev->speed = USB_SPEED_SUPER;
                else
                        udev->speed = USB_SPEED_UNKNOWN;
index 770f84cb7327635e447450a5212acc1e7e4376af..a78f2ebd11b785aabf235bf6dd4e76a529506319 100644 (file)
@@ -155,8 +155,6 @@ static unsigned int xhci_port_speed(unsigned int port_status)
                return USB_PORT_STAT_LOW_SPEED;
        if (DEV_HIGHSPEED(port_status))
                return USB_PORT_STAT_HIGH_SPEED;
-       if (DEV_SUPERSPEED(port_status))
-               return USB_PORT_STAT_SUPER_SPEED;
        /*
         * FIXME: Yes, we should check for full speed, but the core uses that as
         * a default in portspeed() in usb/core/hub.c (which is the only place
index 22afcd37bc3f5d1b69072f5f3359b41ce9d56ca6..4ebaf0824179909bbff03ab5bae516c6f7e05b33 100644 (file)
@@ -109,7 +109,6 @@ struct usb_port_status {
 #define USB_PORT_STAT_TEST              0x0800
 #define USB_PORT_STAT_INDICATOR         0x1000
 /* bits 13 to 15 are reserved */
-#define USB_PORT_STAT_SUPER_SPEED      0x8000  /* Linux-internal */
 
 /*
  * Additions to wPortStatus bit field from USB 3.0