1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-01 08:42:12 +02:00

usb: hub: Parse and save TT details from device descriptor

A high speed hub has a special responsibility to handle full speed/
low speed devices connected on downstream ports. In this case, the
hub must isolate the high speed signaling environment from the full
speed/low speed signaling environment with the help of Transaction
Translator (TT). TT details are provided by hub descriptors and we
parse and save it to hub uclass_priv for later use.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Bin Meng
2017-07-19 21:51:16 +08:00
committed by Marek Vasut
parent 493b8dd070
commit 5624dfd5aa
3 changed files with 78 additions and 0 deletions

View File

@@ -700,6 +700,56 @@ static int usb_hub_configure(struct usb_device *dev)
break;
}
switch (dev->descriptor.bDeviceProtocol) {
case USB_HUB_PR_FS:
break;
case USB_HUB_PR_HS_SINGLE_TT:
debug("Single TT\n");
break;
case USB_HUB_PR_HS_MULTI_TT:
ret = usb_set_interface(dev, 0, 1);
if (ret == 0) {
debug("TT per port\n");
hub->tt.multi = true;
} else {
debug("Using single TT (err %d)\n", ret);
}
break;
case USB_HUB_PR_SS:
/* USB 3.0 hubs don't have a TT */
break;
default:
debug("Unrecognized hub protocol %d\n",
dev->descriptor.bDeviceProtocol);
break;
}
/* Note 8 FS bit times == (8 bits / 12000000 bps) ~= 666ns */
switch (hubCharacteristics & HUB_CHAR_TTTT) {
case HUB_TTTT_8_BITS:
if (dev->descriptor.bDeviceProtocol != 0) {
hub->tt.think_time = 666;
debug("TT requires at most %d FS bit times (%d ns)\n",
8, hub->tt.think_time);
}
break;
case HUB_TTTT_16_BITS:
hub->tt.think_time = 666 * 2;
debug("TT requires at most %d FS bit times (%d ns)\n",
16, hub->tt.think_time);
break;
case HUB_TTTT_24_BITS:
hub->tt.think_time = 666 * 3;
debug("TT requires at most %d FS bit times (%d ns)\n",
24, hub->tt.think_time);
break;
case HUB_TTTT_32_BITS:
hub->tt.think_time = 666 * 4;
debug("TT requires at most %d FS bit times (%d ns)\n",
32, hub->tt.think_time);
break;
}
debug("power on to power good time: %dms\n",
descriptor->bPwrOn2PwrGood * 2);
debug("hub controller current requirement: %dmA\n",