From: Yasushi Asano <yazzep@gmail.com>
To: stern@rowland.harvard.edu, gregkh@linuxfoundation.org
Cc: linux-usb@vger.kernel.org, erosca@de.adit-jv.com,
andrew_gabbasov@mentor.com, jim_baxter@mentor.com,
wnatsume@jp.adit-jv.com, nnishiguchi@jp.adit-jv.com,
yasano@jp.adit-jv.com, kernel test robot <rong.a.chen@intel.com>
Subject: [PATCH v3] USB: hub.c: decrease the number of attempts of enumeration scheme
Date: Tue, 8 Sep 2020 00:50:52 +0900 [thread overview]
Message-ID: <20200907155052.2450-2-yazzep@gmail.com> (raw)
In-Reply-To: <20200907155052.2450-1-yazzep@gmail.com>
From: Yasushi Asano <yasano@jp.adit-jv.com>
According to 6.7.22 A-UUT "Device No Response" for connection timeout
of USB OTG and EH automated compliance plan v1.2, the enumeration
failure has to be detected within 30 seconds. However, the old and new
enumeration schemes made a total of 16 attempts, and each attempt can
take 5 seconds to timeout, so it failed with PET test. Modify it to
reduce the number of attempts to 5 and pass PET test.
in case of old_schene_first=N and use_both_schemes=Y
attempt 3 * new scheme, then 2 * old scheme
in case of old_schene_first=Y and use_both_schemes=Y
attempt 2 * old scheme, then 3 * new scheme
Before applying the patch. please see [2]-[1].
The PETtest fails during device enumeration procedure[3] because the device
enumeration failure[4] can not be detected within 30 seconds of starting
the test.
[ 99.864751] *** Ready OK Test Start***
[ 102.806542] usb 1-1.1: new full-speed USB device number 7 using ehci-platform ...[1]
[ 118.608538] usb 1-1.1: device descriptor read/64, error -110
[ 134.480542] usb 1-1.1: device descriptor read/64, error -110
[ 134.669542] usb 1-1.1: new full-speed USB device number 8 using ehci-platform
[ 150.352537] usb 1-1.1: device descriptor read/64, error -110 ...[2]
[ 152.071247] *** End of Test *** ...[3]
[ 154.290867] usb 1-1-port1: unable to enumerate USB device ...[4]
After applying this patch. please see [6]-[5].
device enumeration failure[6] is detected within 30 seconds after
starting the PETtest. The test passed.
[ 134.632165] *** Ready OK Test Start***
[ 137.880705] usb 1-1.1: new full-speed USB device number 11 using ehci-platform ..[5]
[ 143.184698] usb 1-1.1: device descriptor read/64, error -110
[ 148.815699] usb 1-1.1: device descriptor read/64, error -110
[ 149.005691] usb 1-1.1: new full-speed USB device number 12 using ehci-platform
[ 154.448695] usb 1-1.1: device descriptor read/64, error -110
[ 154.561696] usb 1-1.1: Invalid ep0 maxpacket: 0
[ 154.567354] usb 1-1-port1: attempt power cycle
[ 156.445704] usb 1-1.1: new full-speed USB device number 13 using ehci-platform
[ 161.745697] usb 1-1.1: device not accepting address 13, error -110
[ 161.827694] usb 1-1.1: new full-speed USB device number 14 using ehci-platform
[ 167.377693] usb 1-1.1: device not accepting address 14, error -110
[ 167.395415] usb 1-1-port1: unable to enumerate USB device ..[6]
[ 176.678418] *** End of Test ***
------
[7] https://www.usb.org/sites/default/files/otgeh_compliance_plan_1_2.pdf
6.7.22 A-UUT "Device No Response" for connection timeout
6.7.22.2 Test Procedure for A-UUT which does not support sessions
1. Start with cable still attached, PET applying 10 micro F capacitance and
10K Ohm pull-down resistance between VBUS and ground, data lines not
pulled up.
2. Wait 1s.
3. PET connects using D+.
4. Display Message "Click OK when 'Device No Response' indication
displayed on UUT".
5. If operator clicks OK before 30s elapses since VBUS went on, then
UUT passes test.
6. If 30s elapses first, then UUT fails test.
7. PET leaves 10 micro F capacitance and 10K Ohm pull-down resistance
across VBUS.
8. PET disconnects D+.
9. Wait 2s. to allow disconnection to be recognized.
Reported-by: kernel test robot <rong.a.chen@intel.com>
Signed-off-by: Yasushi Asano <yasano@jp.adit-jv.com>
---
drivers/usb/core/hub.c | 23 ++++-------------------
1 file changed, 4 insertions(+), 19 deletions(-)
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 052d5ac..725e5b6 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -2706,7 +2706,6 @@ static unsigned hub_is_wusb(struct usb_hub *hub)
#define PORT_RESET_TRIES 5
-#define SET_ADDRESS_TRIES 2
#define GET_DESCRIPTOR_TRIES 2
#define SET_CONFIG_TRIES (2 * (use_both_schemes + 1))
#define USE_NEW_SCHEME(i, scheme) ((i) / 2 == (int)(scheme))
@@ -4539,7 +4538,7 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
struct usb_device *hdev = hub->hdev;
struct usb_hcd *hcd = bus_to_hcd(hdev->bus);
struct usb_port *port_dev = hub->ports[port1 - 1];
- int retries, operations, retval, i;
+ int retries, retval, i;
unsigned delay = HUB_SHORT_RESET_TIME;
enum usb_device_speed oldspeed = udev->speed;
const char *speed;
@@ -4684,7 +4683,7 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
* 255 is for WUSB devices, we actually need to use
* 512 (WUSB1.0[4.8.1]).
*/
- for (operations = 0; operations < 3; ++operations) {
+ if (!((retry_counter % 2 != 0) && (retries != 0))) {
buf->bMaxPacketSize0 = 0;
r = usb_control_msg(udev, usb_rcvaddr0pipe(),
USB_REQ_GET_DESCRIPTOR, USB_DIR_IN,
@@ -4704,16 +4703,6 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
r = -EPROTO;
break;
}
- /*
- * Some devices time out if they are powered on
- * when already connected. They need a second
- * reset. But only on the first attempt,
- * lest we get into a time out/reset loop
- */
- if (r == 0 || (r == -ETIMEDOUT &&
- retries == 0 &&
- udev->speed > USB_SPEED_FULL))
- break;
}
udev->descriptor.bMaxPacketSize0 =
buf->bMaxPacketSize0;
@@ -4744,12 +4733,8 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
* authorization will assign the final address.
*/
if (udev->wusb == 0) {
- for (operations = 0; operations < SET_ADDRESS_TRIES; ++operations) {
- retval = hub_set_address(udev, devnum);
- if (retval >= 0)
- break;
- msleep(200);
- }
+ retval = hub_set_address(udev, devnum);
+ msleep(200);
if (retval < 0) {
if (retval != -ENODEV)
dev_err(&udev->dev, "device not accepting address %d, error %d\n",
--
2.7.4
next prev parent reply other threads:[~2020-09-07 15:51 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAEt1RjrQsb6=reKUKV9uJTG4JoJXErhJFj=2TdVx=N1_Ad1GVg@mail.gmail.com>
2020-08-08 6:40 ` [PATCH] [RFC] USB: hub.c: decrease the number of attempts of enumeration scheme Yasushi Asano
2020-08-08 15:16 ` Alan Stern
2020-08-10 0:19 ` [PATCH v2] [RFC] USB: hub.c: decrease the number of attempts of enumeration Yasushi Asano
2020-08-10 0:19 ` [PATCH v2] [RFC] USB: hub.c: decrease the number of attempts of enumeration scheme Yasushi Asano
2020-08-10 7:46 ` Greg KH
2020-08-11 15:20 ` yasushi asano
2020-09-07 15:50 ` [PATCH v3] " Yasushi Asano
2020-09-07 15:50 ` Yasushi Asano [this message]
2020-09-08 19:04 ` Alan Stern
2020-09-10 4:49 ` yasushi asano
2020-09-11 8:33 ` yasushi asano
2020-09-11 15:12 ` Alan Stern
2020-09-15 9:45 ` Eugeniu Rosca
2020-09-15 11:01 ` Greg KH
2020-09-15 14:52 ` Alan Stern
2020-09-16 10:16 ` yasushi asano
2020-09-18 15:00 ` yasushi asano
2020-09-20 19:21 ` Alan Stern
2020-09-21 14:03 ` [PATCH] " Yasushi Asano
2020-09-21 14:48 ` Alan Stern
[not found] ` <CAEt1Rjq-DOwN0+_7F0m-kqUHTzm5YPUaXqUOpTszCsqrfLRt5w@mail.gmail.com>
2020-09-21 15:06 ` Alan Stern
2020-09-25 1:05 ` yasushi asano
2020-09-25 17:21 ` yasushi asano
2020-09-25 18:41 ` Alan Stern
2020-09-27 15:43 ` yasushi asano
2020-09-28 15:20 ` [Patch 1/2]: USB: hub: Clean up use of port initialization schemes and retries Alan Stern
2020-09-28 15:22 ` [Patch 2/2]: USB: hub: Add Kconfig option to reduce number of port initialization retries Alan Stern
2020-09-15 14:48 ` [PATCH v3] USB: hub.c: decrease the number of attempts of enumeration scheme Alan Stern
2020-08-12 17:09 ` [PATCH v2] " Yasushi Asano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200907155052.2450-2-yazzep@gmail.com \
--to=yazzep@gmail.com \
--cc=andrew_gabbasov@mentor.com \
--cc=erosca@de.adit-jv.com \
--cc=gregkh@linuxfoundation.org \
--cc=jim_baxter@mentor.com \
--cc=linux-usb@vger.kernel.org \
--cc=nnishiguchi@jp.adit-jv.com \
--cc=rong.a.chen@intel.com \
--cc=stern@rowland.harvard.edu \
--cc=wnatsume@jp.adit-jv.com \
--cc=yasano@jp.adit-jv.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).