summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBin Meng <bmeng.cn@gmail.com>2017-09-18 06:40:43 -0700
committerPhilipp Tomsich <philipp.tomsich@theobroma-systems.com>2017-10-02 11:20:56 +0200
commitd44eb288090a7db8decfe72807fe84cc91fc969a (patch)
tree93a25a2cb47a5abb7607f7b8c2b0df4479868218
parentec0d95703330d7ada59e0ae14e1281254828c54f (diff)
usb: Read device descriptor after device is addressed for xHCI
For xHCI it is not possible to read a device descriptor before it has been assigned an address. That's why usb_setup_descriptor() was called with 'do_read' being false. But we really need try to read the device descriptor before starting any real communication with the default control endpoint. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Stefan Roese <sr@denx.de> Tested-by: Stefan Roese <sr@denx.de>
-rw-r--r--common/usb.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/common/usb.c b/common/usb.c
index 88cee810fa..8d27bc7060 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -1052,6 +1052,17 @@ static int usb_prepare_device(struct usb_device *dev, int addr, bool do_read,
mdelay(10); /* Let the SET_ADDRESS settle */
+ /*
+ * If we haven't read device descriptor before, read it here
+ * after device is assigned an address. This is only applicable
+ * to xHCI so far.
+ */
+ if (!do_read) {
+ err = usb_setup_descriptor(dev, true);
+ if (err)
+ return err;
+ }
+
return 0;
}