Hi Chintan!

On Wed, 2025-02-19 at 16:18 +0530, Chintan Vankar wrote:
> CPSW driver is defined as UCLASS_MISC driver which needs to be probed
> explicitly. Define bind method for CPSW driver to scan and bind
> ethernet-ports with UCLASS_ETH driver which will eventually probe CPSW
> driver and avoids probing CPSW driver explicitly.
> 
> Signed-off-by: Chintan Vankar <[email protected]>
> ---
> 
> This patch is new in this series.
> 
>  drivers/net/ti/am65-cpsw-nuss.c | 129 +++++++++++++++++++-------------
>  1 file changed, 75 insertions(+), 54 deletions(-)
> 
> diff --git a/drivers/net/ti/am65-cpsw-nuss.c b/drivers/net/ti/am65-cpsw-nuss.c
> index c70b42f6bcc..12c66095cce 100644
> --- a/drivers/net/ti/am65-cpsw-nuss.c
> +++ b/drivers/net/ti/am65-cpsw-nuss.c
> @@ -132,6 +132,7 @@ struct am65_cpsw_priv {
>       struct am65_cpsw_common *cpsw_common;
>       u32                     port_id;
>       struct phy_device       *phydev;
> +     bool                    probe_done;
>  };
>  
>  #ifdef PKTSIZE_ALIGN

[...]

> @@ -675,6 +729,13 @@ static int am65_cpsw_port_probe(struct udevice *dev)
>       char portname[32];
>       int ret;
>  
> +     if (!priv->probe_done) {
> +             ret = am65_cpsw_probe_nuss(dev->parent);
> +             if (ret < 0)
> +                     return ret;
> +             priv->probe_done = true;
> +     }
> +

So this particular port will probe the parent device only once... But what 
about the
next port? Will it probe the same parent once again?

Is it actually necessary if device_probe() actually ensures, that all parents 
are
being probed first?

The probe_done you invent is probably much better served with
"dev_get_flags(dev) & DM_FLAG_ACTIVATED"?

>       priv->dev = dev;
>  
>       cpsw_common = dev_get_priv(dev->parent);

-- 
Alexander Sverdlin
Siemens AG
www.siemens.com

Reply via email to