Commit e09711aef4180002241c7f2eab37390ddf40d6a0
Committed by
Greg Kroah-Hartman
1 parent
090ffa9d0e
Exists in
master
and in
39 other branches
[PATCH] ehci: add think_time
This adds think_time to the usb_tt struct and sets it appropriately (measured in ns); this can help us implement better split transaction scheduling. Signed-off-by: Dan Streetman <ddstreet@ieee.org> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Showing 2 changed files with 30 additions and 9 deletions Side-by-side Diff
drivers/usb/core/hub.c
... | ... | @@ -627,19 +627,33 @@ |
627 | 627 | break; |
628 | 628 | } |
629 | 629 | |
630 | + /* Note 8 FS bit times == (8 bits / 12000000 bps) ~= 666ns */ | |
630 | 631 | switch (hub->descriptor->wHubCharacteristics & HUB_CHAR_TTTT) { |
631 | - case 0x00: | |
632 | - if (hdev->descriptor.bDeviceProtocol != 0) | |
633 | - dev_dbg(hub_dev, "TT requires at most 8 FS bit times\n"); | |
632 | + case HUB_TTTT_8_BITS: | |
633 | + if (hdev->descriptor.bDeviceProtocol != 0) { | |
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 | 639 | break; |
635 | - case 0x20: | |
636 | - dev_dbg(hub_dev, "TT requires at most 16 FS bit times\n"); | |
640 | + case HUB_TTTT_16_BITS: | |
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 | 645 | break; |
638 | - case 0x40: | |
639 | - dev_dbg(hub_dev, "TT requires at most 24 FS bit times\n"); | |
646 | + case HUB_TTTT_24_BITS: | |
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 | 651 | break; |
641 | - case 0x60: | |
642 | - dev_dbg(hub_dev, "TT requires at most 32 FS bit times\n"); | |
652 | + case HUB_TTTT_32_BITS: | |
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 | 657 | break; |
644 | 658 | } |
645 | 659 |
drivers/usb/core/hub.h
... | ... | @@ -157,6 +157,12 @@ |
157 | 157 | |
158 | 158 | struct 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 | 167 | * As of USB 2.0, full/low speed devices are segregated into trees. |
162 | 168 | * One type grows from USB 1.1 host controllers (OHCI, UHCI etc). |
... | ... | @@ -170,6 +176,7 @@ |
170 | 176 | struct usb_tt { |
171 | 177 | struct usb_device *hub; /* upstream highspeed hub */ |
172 | 178 | int multi; /* true means one TT per port */ |
179 | + unsigned think_time; /* think time in ns */ | |
173 | 180 | |
174 | 181 | /* for control/bulk error recovery (CLEAR_TT_BUFFER) */ |
175 | 182 | spinlock_t lock; |