From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753664AbdARQL3 (ORCPT ); Wed, 18 Jan 2017 11:11:29 -0500 Received: from mail-lf0-f67.google.com ([209.85.215.67]:33274 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751281AbdARQL1 (ORCPT ); Wed, 18 Jan 2017 11:11:27 -0500 To: Felipe Balbi , Huang Rui , Heikki Krogerus Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org From: Richard Genoud Subject: [BISSECTED]: BUG: usb: dwc3: usb ports not working anymore on odroid-XU4 Message-ID: <1f6ae153-1033-b3cb-614f-489b2e3d6b34@gmail.com> Date: Wed, 18 Jan 2017 17:11:23 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.6.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Since commit c499ff71ff2a2 ("usb: dwc3: core: re-factor init and exit paths") (merged in 4.8), the usb ports on odroid-XU4 don't work anymore. [ Actually, it's commit 2164a476205ccc ("usb: dwc3: set SUSPHY bit for all cores"), cf below ] Inserting an usb key (USB2.0) on the USB3.0 port result in: [ 64.488264] xhci-hcd xhci-hcd.2.auto: Port resume took longer than 20000 msec, port status = 0xc400fe3 [ 74.568156] xhci-hcd xhci-hcd.2.auto: xHCI host not responding to stop endpoint command. [ 74.574806] xhci-hcd xhci-hcd.2.auto: Assuming host is dying, halting host. [ 74.601970] xhci-hcd xhci-hcd.2.auto: HC died; cleaning up [ 74.606276] usb 3-1: USB disconnect, device number 2 [ 74.613565] usb 4-1: USB disconnect, device number 2 [ 74.621208] usb usb3-port1: couldn't allocate usb_device NB: it's not related to USB2.0 devices, I get the same result with an USB3.0 device (SATA to USB3 for instance). NB2: it doesn't happen on an odriod-XU3 board, that doesn't have the realtek RTL8153 chip. I instrumented what was read/written in the registers before and after this patch, and I found that the culprit is: if (dwc->revision > DWC3_REVISION_194A) reg |= DWC3_GUSB3PIPECTL_SUSPHY; Before commit c499ff71ff2a2 ("usb: dwc3: core: re-factor init and exit paths"), dwc3_phy_setup() was done early in dwc3_probe() and thus, dwc->revision wasn't set yet (==0) After this commit, dwc3_phy_setup() is done in dwc3_core_init(), after setting dwc->revision (it's done in dwc3_core_is_valid()). (The dwc3->revision on odroid-XU4 is 5533200a.) If I comment out the 2 lines: if (dwc->revision > DWC3_REVISION_194A) reg |= DWC3_GUSB3PIPECTL_SUSPHY; The usb key is recognized right away: [ 38.008158] usb 3-1.2: new high-speed USB device number 3 using xhci-hcd [ 38.138924] usb 3-1.2: New USB device found, idVendor=abcd, idProduct=1234 [ 38.144399] usb 3-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 I took a look at the history behind those 2 lines, and they've been introduced by: commit 2164a476205ccc ("usb: dwc3: set SUSPHY bit for all cores") in 3.19. In 3.19, the dwc->revision dwc3_phy_setup() was set in dwc3_core_init(). And, booting a 3.19 kernel on XU4 gives the same error (whereas booting a 3.18 kernel is ok) [ So, I should have started this email with: Since commit 2164a476205ccc ("usb: dwc3: set SUSPHY bit for all cores"), the usb ports on odroid-XU4 don't work anymore. ] The funny thing is that commit 45bb7de213d8("usb: dwc3: setup phys earlier") (merged in 4.2) moved dwc3_phy_setup() in dwc3_probe(), way before dwc->revision was set, acting like a revert on commit 2164a476205c("usb: dwc3: set SUSPHY bit for all cores") That's why on 4.2, inserting an USB key on odroid-XU4 worked again, So, to make a resume: xxx-> 3.18: usb ok 3.19->4.1: usb error (due to commit 2164a476205ccc ("usb: dwc3: set SUSPHY bit for all cores")) 4.2->4.7: usb ok (due to commit 45bb7de213d8("usb: dwc3: setup phys earlier")) 4.8->now: usb error (due to commit c499ff71ff2a2 ("usb: dwc3: core: re-factor init and exit paths")) any idea on this ? regards, Richard