[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <aFl4LSaVfY7sz3Pr@burken>
Date: Mon, 23 Jun 2025 17:52:13 +0200
From: Jonas Karlsson <jonas.d.karlsson@...il.com>
To: netdev@...r.kernel.org
Cc: jonas.d.karlsson@...il.com
Subject: [PATCH net 1/1] net: cadence: macb: only register MDIO bus when an
MDIO child node exists in DT
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 = <ðernet_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 = <ðernet_phy1>;
/* no MDIO subnode here, so MDIO bus won’t be registered */
};
Signed-off-by: Jonas Karlsson <jonas.d.karlsson@...il.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
Powered by blists - more mailing lists