Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1685505 > unrolled thread

[PATCH] usb: dwc3: Fix the USB 3.0 hub detection bug after warm boot

Started bygustavo panizzo <gfa@zumbi.com.ar>
First post2017-07-12 06:10 +0200
Last post2017-07-13 08:00 +0200
Articles 4 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] usb: dwc3: Fix the USB 3.0 hub detection bug after warm boot gustavo panizzo <gfa@zumbi.com.ar> - 2017-07-12 06:10 +0200
    Re: [PATCH] usb: dwc3: Fix the USB 3.0 hub detection bug after warm boot Baolin Wang <baolin.wang@linaro.org> - 2017-07-12 08:10 +0200
      Re: [PATCH] usb: dwc3: Fix the USB 3.0 hub detection bug after warm  boot gustavo panizzo <gfa@zumbi.com.ar> - 2017-07-13 01:30 +0200
        Re: [PATCH] usb: dwc3: Fix the USB 3.0 hub detection bug after warm boot Baolin Wang <baolin.wang@linaro.org> - 2017-07-13 08:00 +0200

#1685505 — [PATCH] usb: dwc3: Fix the USB 3.0 hub detection bug after warm boot

Fromgustavo panizzo <gfa@zumbi.com.ar>
Date2017-07-12 06:10 +0200
Subject[PATCH] usb: dwc3: Fix the USB 3.0 hub detection bug after warm boot
Message-ID<u2h8m-39O-17@gated-at.bofh.it>
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 <brian.kim@hardkernel.com>
Signed-off-by: gustavo panizzo <gfa@zumbi.com.ar>
---
 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 = platform_get_drvdata(pdev);
+	struct resource *res = 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 -= DWC3_GLOBALS_REGS_START;
+
+	dwc3_debugfs_exit(dwc);
+	dwc3_core_exit_mode(dwc);
+	dwc3_event_buffers_cleanup(dwc);
+	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);
+
+	dwc3_core_exit(dwc);
+	dwc3_ulpi_exit(dwc);
+
+	pm_runtime_put_sync(&pdev->dev);
+	pm_runtime_allow(&pdev->dev);
+	pm_runtime_disable(&pdev->dev);
+}
+
 static int dwc3_remove(struct platform_device *pdev)
 {
 	struct dwc3	*dwc = platform_get_drvdata(pdev);
@@ -1488,6 +1520,7 @@ MODULE_DEVICE_TABLE(acpi, dwc3_acpi_match);
 static struct platform_driver dwc3_driver = {
 	.probe		= dwc3_probe,
 	.remove		= dwc3_remove,
+	.shutdown	= dwc3_shutdown,
 	.driver		= {
 		.name	= "dwc3",
 		.of_match_table	= of_match_ptr(of_dwc3_match),
-- 
2.11.0

[toc] | [next] | [standalone]


#1685532

FromBaolin Wang <baolin.wang@linaro.org>
Date2017-07-12 08:10 +0200
Message-ID<u2j0t-4rp-3@gated-at.bofh.it>
In reply to#1685505
Hi,

On 12 July 2017 at 11:52, gustavo panizzo <gfa@zumbi.com.ar> 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 <brian.kim@hardkernel.com>
> Signed-off-by: gustavo panizzo <gfa@zumbi.com.ar>
> ---
>  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 = platform_get_drvdata(pdev);
> +       struct resource *res = 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 -= DWC3_GLOBALS_REGS_START;
> +
> +       dwc3_debugfs_exit(dwc);
> +       dwc3_core_exit_mode(dwc);
> +       dwc3_event_buffers_cleanup(dwc);
> +       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().

> +
> +       dwc3_core_exit(dwc);
> +       dwc3_ulpi_exit(dwc);
> +
> +       pm_runtime_put_sync(&pdev->dev);
> +       pm_runtime_allow(&pdev->dev);
> +       pm_runtime_disable(&pdev->dev);
> +}
> +
>  static int dwc3_remove(struct platform_device *pdev)
>  {
>         struct dwc3     *dwc = platform_get_drvdata(pdev);
> @@ -1488,6 +1520,7 @@ MODULE_DEVICE_TABLE(acpi, dwc3_acpi_match);
>  static struct platform_driver dwc3_driver = {
>         .probe          = dwc3_probe,
>         .remove         = dwc3_remove,
> +       .shutdown       = dwc3_shutdown,
>         .driver         = {
>                 .name   = "dwc3",
>                 .of_match_table = of_match_ptr(of_dwc3_match),
> --
> 2.11.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Baolin.wang
Best Regards

[toc] | [prev] | [next] | [standalone]


#1686121 — Re: [PATCH] usb: dwc3: Fix the USB 3.0 hub detection bug after warm boot

Fromgustavo panizzo <gfa@zumbi.com.ar>
Date2017-07-13 01:30 +0200
SubjectRe: [PATCH] usb: dwc3: Fix the USB 3.0 hub detection bug after warm boot
Message-ID<u2zeW-6fP-19@gated-at.bofh.it>
In reply to#1685532
Hello Wang

thanks for your response

On Wed, Jul 12, 2017 at 02:08:04PM +0800, Baolin Wang wrote:
>Hi,
>
>On 12 July 2017 at 11:52, gustavo panizzo <gfa@zumbi.com.ar> 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 <brian.kim@hardkernel.com>
>> Signed-off-by: gustavo panizzo <gfa@zumbi.com.ar>
>> ---
>>  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 = platform_get_drvdata(pdev);
>> +       struct resource *res = 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 -= 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()


>> +       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().
>
>> +
>> +       dwc3_core_exit(dwc);
>> +       dwc3_ulpi_exit(dwc);
>> +
>> +       pm_runtime_put_sync(&pdev->dev);
>> +       pm_runtime_allow(&pdev->dev);
>> +       pm_runtime_disable(&pdev->dev);
>> +}
>> +
>>  static int dwc3_remove(struct platform_device *pdev)
>>  {
>>         struct dwc3     *dwc = platform_get_drvdata(pdev);
>> @@ -1488,6 +1520,7 @@ MODULE_DEVICE_TABLE(acpi, dwc3_acpi_match);
>>  static struct platform_driver dwc3_driver = {
>>         .probe          = dwc3_probe,
>>         .remove         = dwc3_remove,
>> +       .shutdown       = dwc3_shutdown,
>>         .driver         = {
>>                 .name   = "dwc3",
>>                 .of_match_table = of_match_ptr(of_dwc3_match),
>> --
>> 2.11.0
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>
>
>-- 
>Baolin.wang
>Best Regards

-- 
IRC: gfa
GPG: 0X44BB1BA79F6C6333

[toc] | [prev] | [next] | [standalone]


#1686269

FromBaolin Wang <baolin.wang@linaro.org>
Date2017-07-13 08:00 +0200
Message-ID<u2Fkn-1AK-13@gated-at.bofh.it>
In reply to#1686121
Hi,

On 13 July 2017 at 07:20, gustavo panizzo <gfa@zumbi.com.ar> wrote:
> Hello Wang
>
> thanks for your response
>
>
> On Wed, Jul 12, 2017 at 02:08:04PM +0800, Baolin Wang wrote:
>>
>> Hi,
>>
>> On 12 July 2017 at 11:52, gustavo panizzo <gfa@zumbi.com.ar> 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 <brian.kim@hardkernel.com>
>>> Signed-off-by: gustavo panizzo <gfa@zumbi.com.ar>
>>> ---
>>>  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 = platform_get_drvdata(pdev);
>>> +       struct resource *res = 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 -= 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().
>>
>>> +
>>> +       dwc3_core_exit(dwc);
>>> +       dwc3_ulpi_exit(dwc);
>>> +
>>> +       pm_runtime_put_sync(&pdev->dev);
>>> +       pm_runtime_allow(&pdev->dev);
>>> +       pm_runtime_disable(&pdev->dev);
>>> +}
>>> +
>>>  static int dwc3_remove(struct platform_device *pdev)
>>>  {
>>>         struct dwc3     *dwc = platform_get_drvdata(pdev);
>>> @@ -1488,6 +1520,7 @@ MODULE_DEVICE_TABLE(acpi, dwc3_acpi_match);
>>>  static struct platform_driver dwc3_driver = {
>>>         .probe          = dwc3_probe,
>>>         .remove         = dwc3_remove,
>>> +       .shutdown       = dwc3_shutdown,
>>>         .driver         = {
>>>                 .name   = "dwc3",
>>>                 .of_match_table = of_match_ptr(of_dwc3_match),
>>> --
>>> 2.11.0
>>>
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>>
>>
>>
>> --
>> Baolin.wang
>> Best Regards
>
>
> --
> IRC: gfa
> GPG: 0X44BB1BA79F6C6333
>



-- 
Baolin.wang
Best Regards

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web