Received: by 10.223.164.202 with SMTP id h10csp425479wrb; Thu, 9 Nov 2017 08:25:33 -0800 (PST) X-Google-Smtp-Source: ABhQp+TXdM1x+wmpWBmTpJN2eKt1KtJMolkUB3sBQa/SwNt3qVsMhTeRFDXUYkc6Nb23T/IKPEOG X-Received: by 10.159.214.140 with SMTP id n12mr962502plp.4.1510244733141; Thu, 09 Nov 2017 08:25:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510244733; cv=none; d=google.com; s=arc-20160816; b=hoW8TwYJQDCmm+7OgADUtNy7KaBugbCtfJvNrTfC/cO80AIPkvWaHVzxhEVTQInn6i KCAG3uy6UMBWerf8ry50DR2jw/ZzjHZbByKmc2cr79ENRW9d1A+1+xp5vIdNhZBUjjCj 5FgxxYfvAHwCbg5uv46I4+xjQ+Hj/fkOKSCJZijzSo7gjcYxZYPdidkIQipb/1A+fuX4 qTFkdWc2h22GtWWE0Nh+joGIRaiZN5sZxhqN7sN+Sf7U/U46VtTk2gPyfFJ0u018xA66 Kd/ddMJ+zO6YjRcarhnqcU5JjM5stz6JEV6PmaQ1lJQPWAcqcNvFSyukVpgYy3urc2xI dNOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:in-reply-to :subject:cc:to:from:date:arc-authentication-results; bh=+/AGD2Up08/YkNTO8m17T48K8d6QfWiOVacgDOdv/3A=; b=aehSIoK+JlwBY/lHZQc4DvVrPZgTTDPQ7nHBO+qs4pYbrFG/NeYLEIdjmDSEkL95s0 e+qRrD33n3cdsDByYptKAHuVCibazWDPkJJbyrWb5XPkQ/Wsz4haW4rQLUfdwiV8IezJ hVrUVWQGHTz1Hhlb9o1DSKRyL8lhiyHeXsekKybkwVAuA5v3p/RDE6BV6JD/cSi8Lgjt z6UxgSqIX0ukeLwTugznDEhx0Znap7eGBH5kQSh5NrHyZcI4YrzfrbcJmvdkb2uotK2P UT+27IsbPujsB51q/SzzFYIftccREnqkYoN7PGV/Wrvei5whwijuhd+W7ON/5KpODSLB Nw/Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=harvard.edu Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y22si6821247pgc.508.2017.11.09.08.25.21; Thu, 09 Nov 2017 08:25:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=harvard.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753437AbdKIQXK (ORCPT + 81 others); Thu, 9 Nov 2017 11:23:10 -0500 Received: from iolanthe.rowland.org ([192.131.102.54]:56120 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751201AbdKIQXJ (ORCPT ); Thu, 9 Nov 2017 11:23:09 -0500 Received: (qmail 10296 invoked by uid 2102); 9 Nov 2017 11:23:07 -0500 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 9 Nov 2017 11:23:07 -0500 Date: Thu, 9 Nov 2017 11:23:07 -0500 (EST) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Mike Looijmans cc: linux-usb@vger.kernel.org, , , Subject: Re: [PATCH v2] usb: hub: Cycle HUB power when initialization fails In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 9 Nov 2017, Mike Looijmans wrote: > Sometimes the USB device gets confused about the state of the initialization and > the connection fails. In particular, the device thinks that it's already set up > and running while the host thinks the device still needs to be configured. To > work around this issue, power-cycle the hub's output to issue a sort of "reset" > to the device. This makes the device restart its state machine and then the > initialization succeeds. > > This fixes problems where the kernel reports a list of errors like this: > > usb 1-1.3: device not accepting address 19, error -71 > > The end result is a non-functioning device. After this patch, the sequence > becomes like this: > > usb 1-1.3: new high-speed USB device number 18 using ci_hdrc > usb 1-1.3: device not accepting address 18, error -71 > usb 1-1.3: new high-speed USB device number 19 using ci_hdrc > usb 1-1.3: device not accepting address 19, error -71 > usb 1-1-port3: attempt power cycle > usb 1-1.3: new high-speed USB device number 21 using ci_hdrc > usb-storage 1-1.3:1.2: USB Mass Storage device detected > > Signed-off-by: Mike Looijmans > --- > v2: On feedback from Alan Stern: > No blank line changes > Don't further increase the retry count > Delay 2x the power-up delay (100ms minimum) instead of magic "800" > > drivers/usb/core/hub.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c > index e9ce6bb..8f7d942 100644 > --- a/drivers/usb/core/hub.c > +++ b/drivers/usb/core/hub.c > @@ -4935,6 +4935,15 @@ static void hub_port_connect(struct usb_hub *hub, int port1, u16 portstatus, > usb_put_dev(udev); > if ((status == -ENOTCONN) || (status == -ENOTSUPP)) > break; > + > + /* When halfway through our retry count, power-cycle the port */ > + if (i == (SET_CONFIG_TRIES / 2) - 1) { > + dev_info(&port_dev->dev, "attempt power cycle\n"); > + usb_hub_set_port_power(hdev, hub, port1, false); > + msleep(2 * hub_power_on_good_delay(hub)); > + usb_hub_set_port_power(hdev, hub, port1, true); > + msleep(hub_power_on_good_delay(hub)); > + } > } > if (hub->hdev->parent || > !hcd->driver->port_handed_over || Acked-by: Alan Stern From 1583590789478687806@xxx Thu Nov 09 12:17:43 +0000 2017 X-GM-THRID: 1583043494183965801 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread