LKML Archive on lore.kernel.org
 help / color / Atom feed
From: Richard Genoud <richard.genoud@gmail.com>
To: Felipe Balbi <balbi@kernel.org>, Huang Rui <ray.huang@amd.com>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [BISSECTED]: BUG: usb: dwc3: usb ports not working anymore on odroid-XU4
Date: Thu, 19 Jan 2017 10:39:21 +0100
Message-ID: <c1ba424f-4c5f-79e9-ab32-66f02b4f8d65@gmail.com> (raw)
In-Reply-To: <87fukfjx2x.fsf@linux.intel.com>

On 19/01/2017 09:03, Felipe Balbi wrote:
> 
> Hi,
> 
> Richard Genoud <richard.genoud@gmail.com> writes:
>> 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 ?
> 
> Thanks for bisecting. This could be caused by a similar case as
> described at [1]. Can you check if adding quirk
> "snps,dis_u3_susphy_quirk" helps ?
> 
> [1] https://marc.info/?i=2B3535C5ECE8B5419E3ECBE300772909021B3FD37E@US01WEMBX2.internal.synopsys.com
> 
Thanks for your quick answer !

yes, adding this patch:

diff --git a/arch/arm/boot/dts/exynos5422-odroidxu4.dts b/arch/arm/boot/dts/exynos5422-odroidxu4.dts
index 2faf88627a48..c76e76bc9ade 100644
--- a/arch/arm/boot/dts/exynos5422-odroidxu4.dts
+++ b/arch/arm/boot/dts/exynos5422-odroidxu4.dts
@@ -43,6 +43,9 @@
 	status = "okay";
 };
 
+&usbdrd_dwc3_0 {
+	snps,dis_u3_susphy_quirk;
+};
 &usbdrd_dwc3_1 {
 	dr_mode = "host";
 };

removes the error "Port resume took longer than 20000 msec, port status = 0xc400fe3"
and the USB devices are detected.

Richard.

  reply index

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-18 16:11 Richard Genoud
2017-01-19  8:03 ` Felipe Balbi
2017-01-19  9:39   ` Richard Genoud [this message]
2017-01-23 11:45     ` Felipe Balbi
2017-01-23 11:47       ` Richard Genoud

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=c1ba424f-4c5f-79e9-ab32-66f02b4f8d65@gmail.com \
    --to=richard.genoud@gmail.com \
    --cc=balbi@kernel.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=ray.huang@amd.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

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git
	git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git