RE: [PATCH v2 3/3] usb: renesas_usbhs: Reorder clock handling and power management in probe
From: Yoshihiro Shimoda
Date: Tue Apr 08 2025 - 08:48:17 EST
Hello Prabhakar-san,
> From: Yoshihiro Shimoda, Sent: Tuesday, April 8, 2025 7:40 PM
<snip>
> > @@ -721,7 +736,7 @@ static int usbhs_probe(struct platform_device *pdev)
> > if (ret) {
> > dev_warn(dev, "USB function not selected (GPIO)\n");
> > ret = -ENOTSUPP;
> > - goto probe_end_mod_exit;
> > + goto probe_assert_rest;
nit:
I think that the label name " probe_assert_reset" or " probe_assert_rst" is better.
Anyway, I think that this patch seems good to me. So,
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@xxxxxxxxxxx>
Also, I tested this patch on my environment (R-Car H3) and it doesn't have any regression.
So,
Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@xxxxxxxxxxx>
Best regards,
Yoshihiro Shimoda
> > }
> > }
> >
> > @@ -735,14 +750,19 @@ static int usbhs_probe(struct platform_device *pdev)
> > ret = usbhs_platform_call(priv, hardware_init, pdev);
> > if (ret < 0) {
> > dev_err(dev, "platform init failed.\n");
> > - goto probe_end_mod_exit;
> > + goto probe_assert_rest;
> > }
> >
> > /* reset phy for connection */
> > usbhs_platform_call(priv, phy_reset, pdev);
> >
> > - /* power control */
> > - pm_runtime_enable(dev);
> > + /*
> > + * Disable the clocks that were enabled earlier in the probe path,
> > + * and let the driver handle the clocks beyond this point.
> > + */
> > + usbhsc_clk_disable_unprepare(priv);
> > + pm_runtime_put(dev);
> > +
> > if (!usbhs_get_dparam(priv, runtime_pwctrl)) {
> > usbhsc_power_ctrl(priv, 1);
> > usbhs_mod_autonomy_mode(priv);
> > @@ -759,9 +779,7 @@ static int usbhs_probe(struct platform_device *pdev)
> >
> > return ret;
> >
> > -probe_end_mod_exit:
> > - usbhsc_clk_put(priv);
> > -probe_fail_clks:
> > +probe_assert_rest:
> > reset_control_assert(priv->rsts);
> > probe_fail_rst:
> > usbhs_mod_remove(priv);
> > @@ -769,6 +787,14 @@ static int usbhs_probe(struct platform_device *pdev)
> > usbhs_fifo_remove(priv);
> > probe_end_pipe_exit:
> > usbhs_pipe_remove(priv);
> > +probe_clk_dis_unprepare:
> > + usbhsc_clk_disable_unprepare(priv);
> > +probe_pm_put:
> > + pm_runtime_put(dev);
> > +probe_clk_put:
> > + usbhsc_clk_put(priv);
> > +probe_pm_disable:
> > + pm_runtime_disable(dev);
> >
> > dev_info(dev, "probe failed (%d)\n", ret);
> >
> > --
> > 2.49.0