From: Bin Meng Date: Thu, 20 Jul 2017 07:12:28 +0800 Subject: [U-Boot] [PATCH v3 05/13] usb: Read device descriptor after device is addressed for xHCI In-Reply-To: <1500505956-31846-1-git-send-email-bmeng.cn@gmail.com> References: <1500505956-31846-1-git-send-email-bmeng.cn@gmail.com> Message-ID: <1500505956-31846-6-git-send-email-bmeng.cn@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 --- Changes in v3: None common/usb.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/common/usb.c b/common/usb.c index 2aaf932..e469534 100644 --- a/common/usb.c +++ b/common/usb.c @@ -1051,6 +1051,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; } -- 2.9.2