Re: PROBLEM: DWC3 USB 3.0 not working on Odroid-XU4 with Exynos 5422
From: Michael Niewöhner
Date: Sun Oct 16 2016 - 10:21:14 EST
Hi Felipe,
On Fri, 2016-10-07 at 22:26 +0200, Michael NiewÃhner wrote:
> Hi Felipe,
>
> On Fr, 2016-10-07 at 10:42 +0300, Felipe Balbi wrote:
> > Hi,
> >
> > Michael NiewÃhner <linux@xxxxxxxxxxxxxx> writes:
> > >
> > > >
> > > > The clocks are same across working/non-working.
> > > > Is it possible to bisect the commit that's causing hang for 4.8x ?
> > >
> > >
> > > [c499ff71ff2a281366c6ec7a904c547d806cbcd1] usb: dwc3: core: re-factor init and exit paths
> > > This patch causes both the hang on reboot and the lsusb hang.
> >
> > How to reproduce? Why don't we see this on x86 and TI boards? I'm
> > guessing this is failed bisection, as I can't see anything in that
> > commit that would cause reboot hang. Also, that code path is *NOT*
> > executed when you run lsusb.
> >
>
> I've tested this procedure multiple times to be sure:
>
> - checkoutÂc499ff71, compile, boot the odroid
> - run lsusb -v => lsusb hangs, can't terminate with ctrl-c
> - hard reset, after boot run poweroff or reboot => board does not completely power off / reboot (see log below)
> - revert c499ff71, mrproper, compile, boot the odroid
> - run lsusb -v => shows full output, not hanging
> - run reboot or poweroff => board powers off / reboots just fine
>
>
> dmesg poweroff not working:
> ...
> [ÂÂ120.733519] systemd-journald[144]: systemd-journald stopped as pid 144ÂÂÂÂÂÂÂ
> [ÂÂ120.742663] systemd-shutdown[1]: Sending SIGKILL to remaining processes...ÂÂÂ
> [ÂÂ120.769212] systemd-shutdown[1]: Unmounting file systems.ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ
> [ÂÂ120.773713] systemd-shutdown[1]: Unmounting /sys/kernel/debug.ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ
> [ÂÂ120.827211] systemd-shutdown[1]: Unmounting /dev/mqueue.ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ
> [ÂÂ121.081672] EXT4-fs (mmcblk1p2): re-mounted. Opts: (null)ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ
> [ÂÂ121.091687] EXT4-fs (mmcblk1p2): re-mounted. Opts: (null)ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ
> [ÂÂ121.095608] EXT4-fs (mmcblk1p2): re-mounted. Opts: (null)ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ
> [ÂÂ121.101014] systemd-shutdown[1]: All filesystems unmounted.ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ
> [ÂÂ121.106523] systemd-shutdown[1]: Deactivating swaps.ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ
> [ÂÂ121.111585] systemd-shutdown[1]: All swaps deactivated.ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ
> [ÂÂ121.116661] systemd-shutdown[1]: Detaching loop devices.ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ
> [ÂÂ121.126395] systemd-shutdown[1]: All loop devices detached.ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ
> [ÂÂ121.130525] systemd-shutdown[1]: Detaching DM devices.ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ
> [ÂÂ121.135824] systemd-shutdown[1]: All DM devices detached.ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ
> [ÂÂ121.166327] systemd-shutdown[1]: /lib/systemd/system-shutdown succeeded.ÂÂÂÂÂ
> [ÂÂ121.171739] systemd-shutdown[1]: Powering off.
>
> => at this point removing the sd card would show a messageÂ
> "removed mmc0" (not sure what the real message was...) so the board is not completely off.
>
>
> dmesg poweroff working:
> ...
> [ÂÂ120.733519] systemd-journald[144]: systemd-journald stopped as pid 144ÂÂÂÂÂÂÂ
> [ÂÂ120.742663] systemd-shutdown[1]: Sending SIGKILL to remaining processes...ÂÂÂ
> [ÂÂ120.769212] systemd-shutdown[1]: Unmounting file systems.ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ
> [ÂÂ120.773713] systemd-shutdown[1]: Unmounting /sys/kernel/debug.ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ
> [ÂÂ120.827211] systemd-shutdown[1]: Unmounting /dev/mqueue.ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ
> [ÂÂ121.081672] EXT4-fs (mmcblk1p2): re-mounted. Opts: (null)ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ
> [ÂÂ121.091687] EXT4-fs (mmcblk1p2): re-mounted. Opts: (null)ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ
> [ÂÂ121.095608] EXT4-fs (mmcblk1p2): re-mounted. Opts: (null)ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ
> [ÂÂ121.101014] systemd-shutdown[1]: All filesystems unmounted.ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ
> [ÂÂ121.106523] systemd-shutdown[1]: Deactivating swaps.ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ
> [ÂÂ121.111585] systemd-shutdown[1]: All swaps deactivated.ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ
> [ÂÂ121.116661] systemd-shutdown[1]: Detaching loop devices.ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ
> [ÂÂ121.126395] systemd-shutdown[1]: All loop devices detached.ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ
> [ÂÂ121.130525] systemd-shutdown[1]: Detaching DM devices.ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ
> [ÂÂ121.135824] systemd-shutdown[1]: All DM devices detached.ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ
> [ÂÂ121.166327] systemd-shutdown[1]: /lib/systemd/system-shutdown succeeded.ÂÂÂÂÂ
> [ÂÂ121.171739] systemd-shutdown[1]: Powering off.
> [ÂÂ121.182331] reboï
>
>
>
> Best regards
> Michael NiewÃhner
I did some more tests with next-20161016. Reverting / commenting out
one part of your patch "solves" the lsusb hang, the reboot problem
and also the "debounce failed" message. [1]
Another "solution" is to call phy_power_off before phy_power_on. [2]
Disclaimer: I have no idea what I was doing ;-) These were just some
simple trial-and-error attempts that maybe help to find the real
cause of the problems.
[1]
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 7287a76..5ef589d 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -724,6 +724,7 @@ static int dwc3_core_init(struct dwc3 *dwc)
 /* Adjust Frame Length */
 dwc3_frame_length_adjustment(dwc);
Â
+/*
 usb_phy_set_suspend(dwc->usb2_phy, 0);
 usb_phy_set_suspend(dwc->usb3_phy, 0);
 ret = phy_power_on(dwc->usb2_generic_phy);
@@ -733,6 +734,7 @@ static int dwc3_core_init(struct dwc3 *dwc)
 ret = phy_power_on(dwc->usb3_generic_phy);
 if (ret < 0)
 goto err3;
+*/
Â
 ret = dwc3_event_buffers_setup(dwc);
 if (ret) {
[2]
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 7287a76..f6c8e13 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -726,6 +726,8 @@ static int dwc3_core_init(struct dwc3 *dwc)
Â
ÂÂÂÂÂÂÂÂusb_phy_set_suspend(dwc->usb2_phy, 0);
ÂÂÂÂÂÂÂÂusb_phy_set_suspend(dwc->usb3_phy, 0);
+ÂÂÂÂÂÂÂphy_power_off(dwc->usb2_generic_phy);
+ÂÂÂÂÂÂÂphy_power_off(dwc->usb3_generic_phy);
ÂÂÂÂÂÂÂÂret = phy_power_on(dwc->usb2_generic_phy);
ÂÂÂÂÂÂÂÂif (ret < 0)
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂgoto err2;
Best regards
Michael