netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 1/1] net: cadence: macb: only register MDIO bus when an MDIO child node exists in DT
@ 2025-06-23 15:52 Jonas Karlsson
  2025-06-23 22:41 ` Andrew Lunn
  0 siblings, 1 reply; 2+ messages in thread
From: Jonas Karlsson @ 2025-06-23 15:52 UTC (permalink / raw)
  To: netdev; +Cc: jonas.d.karlsson

Prior to this patch, the MDIO peripheral was enabled for every GEM
instance, even if no MDIO child node was defined in the device tree.
In a setup where gem1 shares the MDIO bus with gem0 but has no MDIO
subnode, gem1 would still scan the bus (both Clause 22 and Clause 45),
adding unnecessary delay to the boot sequence.

This patch changes the driver so that each GEM instance only registers
its MDIO bus if it has an explicit MDIO child node in DT, e.g.:

    &gem0 {
        phy-handle = <&ethernet_phy0>;
        mdio: mdio {
            #address-cells = <1>;
            #size-cells    = <0>;

            ethernet_phy0: ethernet-phy@7 {
                #phy-cells  = <1>;
                compatible  = "ethernet-phy-id0022.1640",
                              "ethernet-phy-ieee802.3-c22";
                reg         = <7>;
            };

            ethernet_phy1: ethernet-phy@3 {
                #phy-cells  = <1>;
                compatible  = "ethernet-phy-id0022.1640",
                              "ethernet-phy-ieee802.3-c22";
                reg         = <3>;
            };
        };
    };

    &gem1 {
        phy-handle = <&ethernet_phy1>;
        /* no MDIO subnode here, so MDIO bus won’t be registered */
    };

Signed-off-by: Jonas Karlsson <jonas.d.karlsson@gmail.com>
---
 drivers/net/ethernet/cadence/macb_main.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 68ca6713a09a..e2b1f93f97e1 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -1024,12 +1024,11 @@ static int macb_mii_init(struct macb *bp)
 	struct device_node *mdio_np, *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 devices may be attached to the MACB's MDIO bus.
+	/* Only register MDIO bus if there is a child named "mdio" in
+	 * the device tree
 	 */
 	mdio_np = of_get_child_by_name(np, "mdio");
-	if (!mdio_np && of_phy_is_fixed_link(np))
+	if (!mdio_np)
 		return macb_mii_probe(bp->dev);
 
 	/* Enable management port */
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net 1/1] net: cadence: macb: only register MDIO bus when an MDIO child node exists in DT
  2025-06-23 15:52 [PATCH net 1/1] net: cadence: macb: only register MDIO bus when an MDIO child node exists in DT Jonas Karlsson
@ 2025-06-23 22:41 ` Andrew Lunn
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Lunn @ 2025-06-23 22:41 UTC (permalink / raw)
  To: Jonas Karlsson; +Cc: netdev

On Mon, Jun 23, 2025 at 05:52:13PM +0200, Jonas Karlsson wrote:
> Prior to this patch, the MDIO peripheral was enabled for every GEM
> instance, even if no MDIO child node was defined in the device tree.
> In a setup where gem1 shares the MDIO bus with gem0 but has no MDIO
> subnode, gem1 would still scan the bus (both Clause 22 and Clause 45),
> adding unnecessary delay to the boot sequence.
> 
> This patch changes the driver so that each GEM instance only registers
> its MDIO bus if it has an explicit MDIO child node in DT, e.g.:

What is missing is a paragraph starting something like:

This is safe and won't cause any regressions because ....

When writing this paragraph, please take into account:

https://elixir.bootlin.com/linux/v6.15.3/source/drivers/net/ethernet/cadence/macb_main.c#L818


    Andrew

---
pw-bot: cr

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-06-23 22:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-23 15:52 [PATCH net 1/1] net: cadence: macb: only register MDIO bus when an MDIO child node exists in DT Jonas Karlsson
2025-06-23 22:41 ` Andrew Lunn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).