aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/core/hub.c32
-rw-r--r--drivers/usb/core/hub.h7
2 files changed, 30 insertions, 9 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 9f54e8330f78..758c7f0ed159 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -627,19 +627,33 @@ static int hub_configure(struct usb_hub *hub,
627 break; 627 break;
628 } 628 }
629 629
630 /* Note 8 FS bit times == (8 bits / 12000000 bps) ~= 666ns */
630 switch (hub->descriptor->wHubCharacteristics & HUB_CHAR_TTTT) { 631 switch (hub->descriptor->wHubCharacteristics & HUB_CHAR_TTTT) {
631 case 0x00: 632 case HUB_TTTT_8_BITS:
632 if (hdev->descriptor.bDeviceProtocol != 0) 633 if (hdev->descriptor.bDeviceProtocol != 0) {
633 dev_dbg(hub_dev, "TT requires at most 8 FS bit times\n"); 634 hub->tt.think_time = 666;
635 dev_dbg(hub_dev, "TT requires at most %d "
636 "FS bit times (%d ns)\n",
637 8, hub->tt.think_time);
638 }
634 break; 639 break;
635 case 0x20: 640 case HUB_TTTT_16_BITS:
636 dev_dbg(hub_dev, "TT requires at most 16 FS bit times\n"); 641 hub->tt.think_time = 666 * 2;
642 dev_dbg(hub_dev, "TT requires at most %d "
643 "FS bit times (%d ns)\n",
644 16, hub->tt.think_time);
637 break; 645 break;
638 case 0x40: 646 case HUB_TTTT_24_BITS:
639 dev_dbg(hub_dev, "TT requires at most 24 FS bit times\n"); 647 hub->tt.think_time = 666 * 3;
648 dev_dbg(hub_dev, "TT requires at most %d "
649 "FS bit times (%d ns)\n",
650 24, hub->tt.think_time);
640 break; 651 break;
641 case 0x60: 652 case HUB_TTTT_32_BITS:
642 dev_dbg(hub_dev, "TT requires at most 32 FS bit times\n"); 653 hub->tt.think_time = 666 * 4;
654 dev_dbg(hub_dev, "TT requires at most %d "
655 "FS bit times (%d ns)\n",
656 32, hub->tt.think_time);
643 break; 657 break;
644 } 658 }
645 659
diff --git a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h
index 53bf5649621e..e7fa9b5a521e 100644
--- a/drivers/usb/core/hub.h
+++ b/drivers/usb/core/hub.h
@@ -157,6 +157,12 @@ enum hub_led_mode {
157 157
158struct usb_device; 158struct usb_device;
159 159
160/* Transaction Translator Think Times, in bits */
161#define HUB_TTTT_8_BITS 0x00
162#define HUB_TTTT_16_BITS 0x20
163#define HUB_TTTT_24_BITS 0x40
164#define HUB_TTTT_32_BITS 0x60
165
160/* 166/*
161 * As of USB 2.0, full/low speed devices are segregated into trees. 167 * As of USB 2.0, full/low speed devices are segregated into trees.
162 * One type grows from USB 1.1 host controllers (OHCI, UHCI etc). 168 * One type grows from USB 1.1 host controllers (OHCI, UHCI etc).
@@ -170,6 +176,7 @@ struct usb_device;
170struct usb_tt { 176struct usb_tt {
171 struct usb_device *hub; /* upstream highspeed hub */ 177 struct usb_device *hub; /* upstream highspeed hub */
172 int multi; /* true means one TT per port */ 178 int multi; /* true means one TT per port */
179 unsigned think_time; /* think time in ns */
173 180
174 /* for control/bulk error recovery (CLEAR_TT_BUFFER) */ 181 /* for control/bulk error recovery (CLEAR_TT_BUFFER) */
175 spinlock_t lock; 182 spinlock_t lock;