usb: dwc3: move core validation to be after clks enable
Subsystems (2)
PATCH 1/1 usb: dwc3: move core validation to be after clks enable
From: Jun Li <[email protected]>
Register access in core validation may hang before the bulk clks are enabled.
--- drivers/usb/dwc3/core.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/usb/dwc3/core.c +6 -6
@@ -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,11 @@ 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" ); + goto disable_clks; + } +platform_set_drvdata (pdev, dwc);dwc3_cache_hwparams (dwc);
@@ -1524,7 +1524,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);
Signature · 1 line
2.7.4
Hi Jun Li,
Quoted 28 lines · Jun Li
From: Jun Li <[email protected]>
Register access in core validation may hang before the bulk clks are enabled.
Fixes b873e2d0ea1e ("usb: dwc3: Do core validation early on probe")Signed-off-by Jun Li <[email protected]>--- drivers/usb/dwc3/core.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/usb/dwc3/core.c +0
-5@@ -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 );
drivers/usb/dwc3/core.c static int dwc3_probe(struct platform_device *pdev) · line 1459
Quoted 5 lines
drivers/usb/dwc3/core.c +2
-0@@ -1460,6 +1455,11 @@ 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" );
Please update "ret" here with -ENODEV, else the probe call will return success (ret is 0).
Quoted 7 lines
drivers/usb/dwc3/core.c +3
-0+ goto disable_clks; + } +platform_set_drvdata (pdev, dwc);dwc3_cache_hwparams (dwc);
drivers/usb/dwc3/core.c static int dwc3_probe(struct platform_device *pdev) · line 1530
Quoted 8 lines
drivers/usb/dwc3/core.c +1
-1@@ -1524,7 +1524,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);
Regards,
Sriharsha
Hi Sriharsha,
Quoted 43 lines
-----Original Message-----
From: Sriharsha Allenki <[email protected]>
Sent: 2019年5月8日 18:26
To: Jun Li <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; [email protected]; dl-linux-imx <[email protected]>
Subject: Re: [PATCH] usb: dwc3: move core validation to be after clks enableHi Jun Li,
Quoted 17 lines · Jun Li
From: Jun Li <[email protected]>
Register access in core validation may hang before the bulk clks are enabled.
Fixes b873e2d0ea1e ("usb: dwc3: Do core validation early on probe")Signed-off-by Jun Li <[email protected]>--- drivers/usb/dwc3/core.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/usb/dwc3/core.c index renamed from drivers/usb/dwc3/core.c +0
-04aff1d8..0e49ff3 100644
drivers/usb/dwc3/core.c +0
-0@@ -1423,11 +1423,6 @@ static int dwc3_probe(struct platform_device *pdev) dwc->regs = regs;drivers/usb/dwc3/core.c static int dwc3_probe(struct platform_device *pdev) · line 1428
Quoted 10 lines
drivers/usb/dwc3/core.c +0
-5dwc->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 );@@
Quoted 4 lines
-1460,6 +1455,11 @@ static int
dwc3_probe(struct platform_device *pdev)
if (ret)
gotounprepare_clks;
Quoted 5 lines
drivers/usb/dwc3/core.c static int dwc3_probe(struct platform_device *pdev) · line 1459
Quoted 2 lines
drivers/usb/dwc3/core.c +2
-0+if (!dwc3_core_is_valid (dwc)) { +dev_err (dwc->dev,"this is not a DesignWare USB3 DRD Core\n" );Please update "ret" here with
-ENODEV, else the probe call will return success (ret is 0).
Correct, I will update and send V2.
Thanks
Jun
Quoted 20 lines
Quoted 8 lines
drivers/usb/dwc3/core.c +3
-0+ goto disable_clks; + } +platform_set_drvdata (pdev, dwc);dwc3_cache_hwparams (dwc);drivers/usb/dwc3/core.c static int dwc3_probe(struct platform_device *pdev) · line 1530
Quoted 8 lines
drivers/usb/dwc3/core.c +1
-1@@ -1524,7 +1524,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);Regards,
Sriharsha