]> err.no Git - linux-2.6/commitdiff
USB: root hubs don't lie about their number of TTs
authorAlan Stern <stern@rowland.harvard.edu>
Thu, 3 Apr 2008 22:02:56 +0000 (18:02 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 25 Apr 2008 04:16:48 +0000 (21:16 -0700)
Currently EHCI root hubs enumerate with a bDeviceProtocol code
indicating that they possess a Transaction Translator.  However the
vast majority of controllers do not; they rely on a companion
controller to handle full- and low-speed communications.  This patch
(as1064) changes the root-hub device descriptor to match the actual
situation.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/core/hcd.c
drivers/usb/core/hcd.h
drivers/usb/host/ehci-pci.c

index f936de75f44e7fc015fd7afad26ddf43e15e9b17..e68fef5361d20d4f999b82b106ea13117e6119c8 100644 (file)
@@ -129,7 +129,7 @@ static const u8 usb2_rh_dev_descriptor [18] = {
 
        0x09,       /*  __u8  bDeviceClass; HUB_CLASSCODE */
        0x00,       /*  __u8  bDeviceSubClass; */
-       0x01,       /*  __u8  bDeviceProtocol; [ usb 2.0 single TT ]*/
+       0x00,       /*  __u8  bDeviceProtocol; [ usb 2.0 no TT ] */
        0x40,       /*  __u8  bMaxPacketSize0; 64 Bytes */
 
        0x6b, 0x1d, /*  __le16 idVendor; Linux Foundation */
@@ -354,9 +354,10 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb)
                __attribute__((aligned(4)));
        const u8        *bufp = tbuf;
        int             len = 0;
-       int             patch_wakeup = 0;
        int             status;
        int             n;
+       u8              patch_wakeup = 0;
+       u8              patch_protocol = 0;
 
        might_sleep();
 
@@ -433,6 +434,8 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb)
                        else
                                goto error;
                        len = 18;
+                       if (hcd->has_tt)
+                               patch_protocol = 1;
                        break;
                case USB_DT_CONFIG << 8:
                        if (hcd->driver->flags & HCD_USB2) {
@@ -527,6 +530,13 @@ error:
                                                bmAttributes))
                        ((struct usb_config_descriptor *)ubuf)->bmAttributes
                                |= USB_CONFIG_ATT_WAKEUP;
+
+               /* report whether RH hardware has an integrated TT */
+               if (patch_protocol &&
+                               len > offsetof(struct usb_device_descriptor,
+                                               bDeviceProtocol))
+                       ((struct usb_device_descriptor *) ubuf)->
+                                       bDeviceProtocol = 1;
        }
 
        /* any errors get returned through the urb completion */
index 2c086b8460b1ab61efb999364a3458627f2b2fe3..e0e99471c3fca6ba9483012380944c007bcae1e0 100644 (file)
@@ -99,6 +99,7 @@ struct usb_hcd {
        unsigned                poll_pending:1; /* status has changed? */
        unsigned                wireless:1;     /* Wireless USB HCD */
        unsigned                authorized_default:1;
+       unsigned                has_tt:1;       /* Integrated TT in root hub */
 
        int                     irq;            /* irq allocated */
        void __iomem            *regs;          /* device memory/io */
index 040bd8632eb3da4655ece58f8341aa49560cdca8..7c8a2ccf78f1df828b6ed72d3e21d369831394d1 100644 (file)
@@ -130,6 +130,7 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
        case PCI_VENDOR_ID_TDI:
                if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) {
                        ehci->is_tdi_rh_tt = 1;
+                       hcd->has_tt = 1;
                        tdi_reset(ehci);
                }
                break;