
On 23 June 2017 at 03:54, Bin Meng bmeng.cn@gmail.com wrote:
USB 3.0 hub uses a hub depth value multiplied by four as an offset into the 'route string' to locate the bits it uses to determine the downstream port number. We shall set the hub depth value of a USB 3.0 hub after it is configured.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
common/usb_hub.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ include/usb.h | 1 + include/usb_defs.h | 3 +++ 3 files changed, 56 insertions(+)
Reviewed-by: Simon Glass sjg@chromium.org
nit below
diff --git a/common/usb_hub.c b/common/usb_hub.c index 835fac9..63358cd 100644 --- a/common/usb_hub.c +++ b/common/usb_hub.c @@ -82,6 +82,16 @@ bool usb_hub_is_root_hub(struct udevice *hub)
return false;
}
+static int usb_set_hub_depth(struct usb_device *dev, int depth) +{
if (depth < 0 || depth > 4)
return -EINVAL;
return usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
USB_REQ_SET_HUB_DEPTH, USB_DIR_OUT | USB_RT_HUB,
depth, 0, NULL, 0, USB_CNTL_TIMEOUT);
+} #endif
static int usb_get_hub_descriptor(struct usb_device *dev, void *data, int size) @@ -719,6 +729,48 @@ static int usb_hub_configure(struct usb_device *dev) debug("%sover-current condition exists\n", (le16_to_cpu(hubsts->wHubStatus) & HUB_STATUS_OVERCURRENT) ? \ "" : "no ");
+#ifdef CONFIG_DM_USB
/*
* A maximum of seven tiers are allowed in a USB topology, and the
* root hub occupies the first tier. The last tier ends with a normal
* USB device. USB 3.0 hubs use a 20-bit field called 'route string'
* to route packet to the designated downstream port. The hub uses a
should this be 'packets'?
[..]