public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonas Karlsson <jonas.d.karlsson@gmail.com>
To: netdev@vger.kernel.org
Cc: jonas.d.karlsson@gmail.com
Subject: [PATCH net 1/1] net: cadence: macb: only register MDIO bus when an MDIO child node exists in DT
Date: Mon, 23 Jun 2025 17:52:13 +0200	[thread overview]
Message-ID: <aFl4LSaVfY7sz3Pr@burken> (raw)

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


             reply	other threads:[~2025-06-23 15:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-23 15:52 Jonas Karlsson [this message]
2025-06-23 22:41 ` [PATCH net 1/1] net: cadence: macb: only register MDIO bus when an MDIO child node exists in DT Andrew Lunn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aFl4LSaVfY7sz3Pr@burken \
    --to=jonas.d.karlsson@gmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox