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>
This commit is contained in:
Bin Meng 2017-09-18 06:40:43 -07:00 committed by Marek Vasut
parent c008faa773
commit 932bb668bb
1 changed files with 11 additions and 0 deletions

View File

@ -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;
}