* [PATCH] usb: dwc3: move core validatation after clock enable and reset deassert
@ 2019-05-20 9:28 Masahiro Yamada
2019-05-21 9:13 ` Jun Li
0 siblings, 1 reply; 3+ messages in thread
From: Masahiro Yamada @ 2019-05-20 9:28 UTC (permalink / raw)
To: Felipe Balbi
Cc: linux-usb, Thinh Nguyen, Masahiro Yamada, Greg Kroah-Hartman,
Felipe Balbi, linux-kernel
Since commit b873e2d0ea1e ("usb: dwc3: Do core validation early on
probe"), the DWC3 USB3 does not work for Socionext UniPhier platform.
It moved dwc3_core_is_valid() really early, where no clock is enabled,
no reset is deasserted. Any attempt to register access causes the
system stall on my platform.
Move it after clk_bulk_enable(), and still before dwc3_get_dr_mode().
Fixes: b873e2d0ea1e ("usb: dwc3: Do core validation early on probe")
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---
drivers/usb/dwc3/core.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 4aff1d8dbc4f..93b96e6abddb 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -1423,11 +1423,6 @@ static int dwc3_probe(struct platform_device *pdev)
dwc->regs = regs;
dwc->regs_size = resource_size(&dwc_res);
- if (!dwc3_core_is_valid(dwc)) {
- dev_err(dwc->dev, "this is not a DesignWare USB3 DRD Core\n");
- return -ENODEV;
- }
-
dwc3_get_properties(dwc);
dwc->reset = devm_reset_control_get_optional_shared(dev, NULL);
@@ -1460,6 +1455,12 @@ static int dwc3_probe(struct platform_device *pdev)
if (ret)
goto unprepare_clks;
+ if (!dwc3_core_is_valid(dwc)) {
+ dev_err(dwc->dev, "this is not a DesignWare USB3 DRD Core\n");
+ ret = -ENODEV;
+ goto disable_clks;
+ }
+
platform_set_drvdata(pdev, dwc);
dwc3_cache_hwparams(dwc);
@@ -1524,7 +1525,7 @@ static int dwc3_probe(struct platform_device *pdev)
err1:
pm_runtime_put_sync(&pdev->dev);
pm_runtime_disable(&pdev->dev);
-
+disable_clks:
clk_bulk_disable(dwc->num_clks, dwc->clks);
unprepare_clks:
clk_bulk_unprepare(dwc->num_clks, dwc->clks);
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] usb: dwc3: move core validatation after clock enable and reset deassert
2019-05-20 9:28 [PATCH] usb: dwc3: move core validatation after clock enable and reset deassert Masahiro Yamada
@ 2019-05-21 9:13 ` Jun Li
2019-05-21 10:24 ` Masahiro Yamada
0 siblings, 1 reply; 3+ messages in thread
From: Jun Li @ 2019-05-21 9:13 UTC (permalink / raw)
To: Masahiro Yamada
Cc: Felipe Balbi, linux-usb, Thinh Nguyen, Greg Kroah-Hartman,
Felipe Balbi, linux-kernel
There is already one identical patch for this:
https://patchwork.kernel.org/patch/10934937/
either one is okay.
Li Jun
Masahiro Yamada <yamada.masahiro@socionext.com> 于2019年5月20日周一 下午6:45写道:
>
> Since commit b873e2d0ea1e ("usb: dwc3: Do core validation early on
> probe"), the DWC3 USB3 does not work for Socionext UniPhier platform.
>
> It moved dwc3_core_is_valid() really early, where no clock is enabled,
> no reset is deasserted. Any attempt to register access causes the
> system stall on my platform.
>
> Move it after clk_bulk_enable(), and still before dwc3_get_dr_mode().
>
> Fixes: b873e2d0ea1e ("usb: dwc3: Do core validation early on probe")
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
> drivers/usb/dwc3/core.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index 4aff1d8dbc4f..93b96e6abddb 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -1423,11 +1423,6 @@ static int dwc3_probe(struct platform_device *pdev)
> dwc->regs = regs;
> dwc->regs_size = resource_size(&dwc_res);
>
> - if (!dwc3_core_is_valid(dwc)) {
> - dev_err(dwc->dev, "this is not a DesignWare USB3 DRD Core\n");
> - return -ENODEV;
> - }
> -
> dwc3_get_properties(dwc);
>
> dwc->reset = devm_reset_control_get_optional_shared(dev, NULL);
> @@ -1460,6 +1455,12 @@ static int dwc3_probe(struct platform_device *pdev)
> if (ret)
> goto unprepare_clks;
>
> + if (!dwc3_core_is_valid(dwc)) {
> + dev_err(dwc->dev, "this is not a DesignWare USB3 DRD Core\n");
> + ret = -ENODEV;
> + goto disable_clks;
> + }
> +
> platform_set_drvdata(pdev, dwc);
> dwc3_cache_hwparams(dwc);
>
> @@ -1524,7 +1525,7 @@ static int dwc3_probe(struct platform_device *pdev)
> err1:
> pm_runtime_put_sync(&pdev->dev);
> pm_runtime_disable(&pdev->dev);
> -
> +disable_clks:
> clk_bulk_disable(dwc->num_clks, dwc->clks);
> unprepare_clks:
> clk_bulk_unprepare(dwc->num_clks, dwc->clks);
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] usb: dwc3: move core validatation after clock enable and reset deassert
2019-05-21 9:13 ` Jun Li
@ 2019-05-21 10:24 ` Masahiro Yamada
0 siblings, 0 replies; 3+ messages in thread
From: Masahiro Yamada @ 2019-05-21 10:24 UTC (permalink / raw)
To: Jun Li
Cc: Felipe Balbi, linux-usb, Thinh Nguyen, Greg Kroah-Hartman,
Felipe Balbi, Linux Kernel Mailing List
On Tue, May 21, 2019 at 6:14 PM Jun Li <lijun.kernel@gmail.com> wrote:
>
> There is already one identical patch for this:
> https://patchwork.kernel.org/patch/10934937/
> either one is okay.
I did not notice this.
Please go ahead with yours
since your are the first submitter.
Thanks.
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-05-21 10:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-20 9:28 [PATCH] usb: dwc3: move core validatation after clock enable and reset deassert Masahiro Yamada
2019-05-21 9:13 ` Jun Li
2019-05-21 10:24 ` Masahiro Yamada
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).