[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <379d10d5-468c-4d88-984e-df9ddc52f28e@lunn.ch>
Date: Sat, 12 Oct 2024 20:14:43 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Oleksij Rempel <o.rempel@...gutronix.de>
Cc: Nicolas Ferre <nicolas.ferre@...rochip.com>,
Claudiu Beznea <claudiu.beznea@...rochip.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
stable@...r.kernel.org, kernel@...gutronix.de,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
Codrin Ciubotariu <codrin.ciubotariu@...rochip.com>
Subject: Re: [PATCH net v1 1] net: macb: Avoid 20s boot delay by skipping
MDIO bus registration for fixed-link PHY
> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> index f06babec04a0b..e4ee55bc53ba7 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -930,9 +930,6 @@ static int macb_mdiobus_register(struct macb *bp)
> return ret;
> }
>
> - if (of_phy_is_fixed_link(np))
> - return mdiobus_register(bp->mii_bus);
> -
> /* Only create the PHY from the device tree if at least one PHY is
> * described. Otherwise scan the entire MDIO bus. We do this to support
> * old device tree that did not follow the best practices and did not
> @@ -953,8 +950,19 @@ static int macb_mdiobus_register(struct macb *bp)
>
> static int macb_mii_init(struct macb *bp)
> {
> + struct device_node *child, *np = bp->pdev->dev.of_node;
> int err = -ENXIO;
>
> + /* With fixed-link, we don't need to register the MDIO bus,
> + * except if we have a child named "mdio" in the device tree.
> + * In that case, some PHYs may be attached to the MACB's MDIO bus.
nitpick. It could be a switch on the MDIO bus, so "some devices may
be"
> + */
> + child = of_get_child_by_name(np, "mdio");
> + if (child)
> + of_node_put(child);
The code now gets this node twice. You could add an optimisation patch
which passed child to macb_mdiobus_register().
Reviewed-by: Andrew Lunn <andrew@...n.ch>
Andrew
Powered by blists - more mailing lists