Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753637AbdGXJx6 (ORCPT ); Mon, 24 Jul 2017 05:53:58 -0400 Received: from mga04.intel.com ([192.55.52.120]:23219 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752679AbdGXJxu (ORCPT ); Mon, 24 Jul 2017 05:53:50 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,406,1496127600"; d="asc'?scan'208";a="111256360" From: Felipe Balbi To: gustavo panizzo , Baolin Wang Cc: Greg KH , USB , LKML , stable@vger.kernel.org, Brian Kim Subject: Re: [PATCH] usb: dwc3: Fix the USB 3.0 hub detection bug after warm boot In-Reply-To: <20170721140544.j4obgspw7mcyikw5@zumbi.com.ar> References: <20170712035238.27554-1-gfa@zumbi.com.ar> <20170712232026.77hznul754yiovfm@zumbi.com.ar> <20170721140544.j4obgspw7mcyikw5@zumbi.com.ar> Date: Mon, 24 Jul 2017 12:53:27 +0300 Message-ID: <87h8y240vc.fsf@linux.intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4454 Lines: 129 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, gustavo panizzo writes: >>> On Wed, Jul 12, 2017 at 02:08:04PM +0800, Baolin Wang wrote: >>>> >>>> Hi, >>>> >>>> On 12 July 2017 at 11:52, gustavo panizzo wrote: >>>>> >>>>> The dwc3 could not release resources when the module is built-in >>>>> because this module does not have shutdown method. This causes the USB >>>>> 3.0 hub is not able to detect after warm boot. >>>>> >>>>> Original patch by Brian Kim, updated and submitted upstream by gustavo >>>>> panizzo. >>>>> >>>>> Also see https://bugs.debian.org/843448 >>>>> >>>>> Signed-off-by: Brian Kim >>>>> Signed-off-by: gustavo panizzo >>>>> --- >>>>> drivers/usb/dwc3/core.c | 33 +++++++++++++++++++++++++++++++++ >>>>> 1 file changed, 33 insertions(+) >>>>> >>>>> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c >>>>> index 326b302fc440..f92dfe213d89 100644 >>>>> --- a/drivers/usb/dwc3/core.c >>>>> +++ b/drivers/usb/dwc3/core.c >>>>> @@ -1259,6 +1259,38 @@ static int dwc3_probe(struct platform_device >>>>> *pdev) >>>>> return ret; >>>>> } >>>>> >>>>> +static void dwc3_shutdown(struct platform_device *pdev) >>>>> +{ >>>>> + struct dwc3 *dwc =3D platform_get_drvdata(pdev); >>>>> + struct resource *res =3D platform_get_resource(pdev, >>>>> IORESOURCE_MEM, 0); >>>>> + >>>>> + pm_runtime_get_sync(&pdev->dev); >>>>> + /* >>>>> + * restore res->start back to its original value so that, in = case >>>>> the >>>>> + * probe is deferred, we don't end up getting error in request >>>>> the >>>>> + * memory region the next time probe is called. >>>>> + */ >>>>> + res->start -=3D DWC3_GLOBALS_REGS_START; >>>>> + >>>>> + dwc3_debugfs_exit(dwc); >>>>> + dwc3_core_exit_mode(dwc); >>>>> + dwc3_event_buffers_cleanup(dwc); >>> >>> >>> What about dwc3_event_buffers_cleanup? should I remove it from >>> dwc3_shutdown()? >>> It is already in dwc3_core_exit() >> >>I think so. We should avoid duplicate code. >> >>>>> + dwc3_free_event_buffers(dwc); >>>>> + >>>>> + usb_phy_set_suspend(dwc->usb2_phy, 1); >>>>> + usb_phy_set_suspend(dwc->usb3_phy, 1); >>>>> + >>>>> + phy_power_off(dwc->usb2_generic_phy); >>>>> + phy_power_off(dwc->usb3_generic_phy); >>>> >>>> >>>> We've done these in dwc3_core_exit(). > > This is the patch after testing on a Odroid XU4, on top of linux-next=20 > 964bcc1b4f57028d56dace7d9bc5924f2eb43f36 which translates to 4.13.0-rc1-n= ext-20170717+ > I tested this patch for a week without problems with heavy USB and NIC us= age. > Please consider merging it > > > Author: gustavo panizzo > Date: Wed Jul 12 11:26:55 2017 +0800 > > usb: dwc3: Fix the USB 3.0 hub detection bug after warm boot >=20=20=20=20=20 > The dwc3 could not release resources when the module is built-in > because this module does not have shutdown method. This causes the USB > 3.0 hub is not able to detect after warm boot. >=20=20=20=20=20 > Original patch by Brian Kim, updated and submitted upstream by gustavo > panizzo. if the original patch is from Brian, then 'Author' should be Brian. Please fix it. I also don't get why all of a sudden we need to implement =2D>shutdown(). Why is it that we never needed it before and we need it now? Care to bisect to find the first commit which started causing this problem? =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEElLzh7wn96CXwjh2IzL64meEamQYFAll1w5cACgkQzL64meEa mQblnA//a0XFJQ8QxPjhbHtXGiYr3GE1HfjP9HNnjp6UGrROhsYkrSSQr9oS1aLD 8nOJxdmFfyrt8F2uIThraCtl9jg7NLKUsf0bWm7a5iigv5NGyXTxO2jy6wACu+BF 2BCmmcvVWC57LiE5cw3JW7UvXbDMav0EbkocMQeyVqXQVIiQ7OUkR8Sfd1e9p9qj V8O56Wsr3kHLB5zvhPeiCbC1qvwAuLkHDthl0q+4t8+VszrSZd3hT/pTtrbnd0X0 7O4lNNsuG5jvRy4TSm0/5/qlhrP6b9CTprDhXOaDumcvaSEheZK3tbkmPDbJ1ZCo J1Oc0GzH6OzAKG8dv+1Q+nIKsF6SXkhnS/JHrQekISUs/dnFP6oQDlQGAFVlK2W9 IsHdfJEGjTSH4oIQvbHmC9D5PPec0zSQmLLaQSp7abTeqZYWxhsrLb03lSCFFAZq 2IgjmiMubmEvHJk3/Ao/NVOff/DIwXvZ3YOB8/m8mkvyblFD/4If3YLdsVyxEKuA yCnxfWTjwmd5jOKxLJSDh5cojDokCjwrUsNkj8UBsspaIzQVAx6Q8YNV/MeDp6yS 8HrWWiMI9ORIHCp9eOh1FNtdG5PXxB9Qg09VuaRzO+1SPZ6pUiQlNvOzYehUe7HH KlrdsDviNJ+vePk4NdCaqRlVnd7dr0haa+xOZiC7SOGUu1fODVE= =bs/L -----END PGP SIGNATURE----- --=-=-=--