On Mon, Sep 15, 2025 at 06:02:19PM +0800, Xiangxu Yin wrote:
>
> On 9/12/2025 8:08 PM, Dmitry Baryshkov wrote:
> > On Fri, Sep 12, 2025 at 08:00:14PM +0800, Xiangxu Yin wrote:
> >> On 9/12/2025 6:19 PM, Dmitry Baryshkov wrote:
> >>> On Thu, Sep 11, 2025 at 10:55:05PM +0800, Xiangxu Yin wrote:
> >>>> Add USB/DP switchable PHY clock registration and DT parsing for DP
> >>>> offsets.
> >>>> Extend qmp_usbc_register_clocks and clock provider logic to support both
> >>>> USB and DP instances.
> >>>>
> >>>> Signed-off-by: Xiangxu Yin <[email protected]>
> >>>> ---
> >>>> drivers/phy/qualcomm/phy-qcom-qmp-usbc.c | 208
> >>>> +++++++++++++++++++++++++++++--
> >>>> 1 file changed, 195 insertions(+), 13 deletions(-)
> >>>> + default:
> >>>> + return 0;
> >>>> + }
> >>>> +}
> >>>> +
> >>>> +static int qmp_usbc_register_clocks(struct qmp_usbc *qmp, struct
> >>>> device_node *np)
> >>>> +{
> >>>> + int ret;
> >>>>
> >>>> - ret = of_clk_add_hw_provider(np, of_clk_hw_simple_get,
> >>>> &fixed->hw);
> >>>> + ret = phy_pipe_clk_register(qmp, np);
> >>>> if (ret)
> >>>> return ret;
> >>>>
> >>>> - /*
> >>>> - * Roll a devm action because the clock provider is the child
> >>>> node, but
> >>>> - * the child node is not actually a device.
> >>>> - */
> >>>> - return devm_add_action_or_reset(qmp->dev,
> >>>> phy_clk_release_provider, np);
> >>>> + if (qmp->dp_serdes != 0) {
> >>>> + ret = phy_dp_clks_register(qmp, np);
> >>>> + if (ret)
> >>>> + return ret;
> >>>> + }
> >>>> +
> >>>> + return devm_of_clk_add_hw_provider(qmp->dev,
> >>>> qmp_usbc_clks_hw_get, qmp);
> >>> Do you understand what did the comment (that you've removed) say? And
> >>> why?
> >
> > And this was ignored :-(
>
> Sorry for missing this part.
>
> For USB-C PHY, the legacy implementation only supports USB with a single
> device node. The new driver for USB and DP also uses a single device node.
There is no 'new driver'. It's about DT.
> The function devm_of_clk_add_hw_provider internally handles both
> of_clk_add_hw_provider and devres_add, and supports automatic resource
> release.
>
> So I think using devm_of_clk_add_hw_provider allows us to remove
> of_clk_add_hw_provider and devm_add_action_or_reset.
Which node is passed to of_clk_add_hw_provider() in the legacy DT case?
Which node is passed to of_clk_add_hw_provider() by
devm_of_clk_add_hw_provider()?
> For combo PHY, the legacy implementation uses two device nodes: dp_np and
> usb_np. To maintain forward compatibility, we need to keep support for
> both nodes and retain the related logic.
--
With best wishes
Dmitry