Skip to content

Commit 7329e21

Browse files
AlanSterngregkh
authored andcommitted
USB: root hubs don't lie about their number of TTs
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 <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 6fc88f5 commit 7329e21

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

drivers/usb/core/hcd.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ static const u8 usb2_rh_dev_descriptor [18] = {
129129

130130
0x09, /* __u8 bDeviceClass; HUB_CLASSCODE */
131131
0x00, /* __u8 bDeviceSubClass; */
132-
0x01, /* __u8 bDeviceProtocol; [ usb 2.0 single TT ]*/
132+
0x00, /* __u8 bDeviceProtocol; [ usb 2.0 no TT ] */
133133
0x40, /* __u8 bMaxPacketSize0; 64 Bytes */
134134

135135
0x6b, 0x1d, /* __le16 idVendor; Linux Foundation */
@@ -354,9 +354,10 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb)
354354
__attribute__((aligned(4)));
355355
const u8 *bufp = tbuf;
356356
int len = 0;
357-
int patch_wakeup = 0;
358357
int status;
359358
int n;
359+
u8 patch_wakeup = 0;
360+
u8 patch_protocol = 0;
360361

361362
might_sleep();
362363

@@ -433,6 +434,8 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb)
433434
else
434435
goto error;
435436
len = 18;
437+
if (hcd->has_tt)
438+
patch_protocol = 1;
436439
break;
437440
case USB_DT_CONFIG << 8:
438441
if (hcd->driver->flags & HCD_USB2) {
@@ -527,6 +530,13 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb)
527530
bmAttributes))
528531
((struct usb_config_descriptor *)ubuf)->bmAttributes
529532
|= USB_CONFIG_ATT_WAKEUP;
533+
534+
/* report whether RH hardware has an integrated TT */
535+
if (patch_protocol &&
536+
len > offsetof(struct usb_device_descriptor,
537+
bDeviceProtocol))
538+
((struct usb_device_descriptor *) ubuf)->
539+
bDeviceProtocol = 1;
530540
}
531541

532542
/* any errors get returned through the urb completion */

drivers/usb/core/hcd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ struct usb_hcd {
9999
unsigned poll_pending:1; /* status has changed? */
100100
unsigned wireless:1; /* Wireless USB HCD */
101101
unsigned authorized_default:1;
102+
unsigned has_tt:1; /* Integrated TT in root hub */
102103

103104
int irq; /* irq allocated */
104105
void __iomem *regs; /* device memory/io */

drivers/usb/host/ehci-pci.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
130130
case PCI_VENDOR_ID_TDI:
131131
if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) {
132132
ehci->is_tdi_rh_tt = 1;
133+
hcd->has_tt = 1;
133134
tdi_reset(ehci);
134135
}
135136
break;

0 commit comments

Comments
 (0)