Re: [PATCH v3 phy 13/17] phy: lynx-28g: probe on per-SoC and per-instance compatible strings

From: Vladimir Oltean
Date: Thu Oct 02 2025 - 07:11:21 EST


On Thu, Oct 02, 2025 at 10:50:46AM +0000, Josua Mayer wrote:
> FYI as an example please see below how I handled this previously.
> The xlate function below can translate both phandles with 0 and 1 arguments:
>
> static struct phy *lynx_28g_xlate(struct device *dev,
>                   struct of_phandle_args *args)
> {
>     struct lynx_28g_priv *priv;
>     struct phy *phy;
>     int idx;
>
>     if (args->args_count == 0) {
>         /* direct look-up */
>         phy = of_phy_simple_xlate(dev, args);
>     } else if (args->args_count == 1) {
>         /* look-up from parent by index */
>         idx = args->args[0];
>         if (WARN_ON(idx >= LYNX_28G_NUM_LANE))
>             return ERR_PTR(-EINVAL);
>
>         priv = dev_get_drvdata(dev);
>         phy = priv->lane[idx].phy;
>         if (!phy)
>             phy = ERR_PTR(-ENODEV);
>     } else {
>         phy = ERR_PTR(-EINVAL);
>     }
>
>     return phy;
> }
>
> While in probe only one phy_provider is registered.

So what is the practical difference, in the #phy-cells = <0> case,
between registering a single phy provider and a custom xlate function
that redirects to of_phy_simple_xlate(), vs registering a phy provider
per lane and passing the of_phy_simple_xlate() function directly?