🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
2 messages
2 total messages Started by Rosen Penev Wed, 11 Nov 2026 00:30
[PATCH net] net: ibm: emac: fix fixed-link speed and duplex
#14337
Author: Rosen Penev
Date: Wed, 11 Nov 2026 00:30
80 lines
13605 bytes
Since commit d99b408ed8e5 ("net: phy: fixed_phy: remove not needed
initialization of phy_device members"), fixed_phy_register() no longer
copies the fixed-link state into the new phy_device, phylib fills it in
once the PHY state machine runs.

EMAC never attaches or starts the fixed PHY. emac_init_phy() copies
phydev->speed and phydev->duplex right after registering it, so it now
gets SPEED_UNKNOWN and DUPLEX_UNKNOWN and emac_configure() programs the
MAC and RGMII bridge for 10 Mbps half duplex.

On the Meraki MX60, whose EMAC has a 1000 Mbps RGMII fixed-link to a
QCA8327 switch, every transmitted frame reports carrier loss, the
switch CPU port counts FCS errors and nothing is received.

Take the fixed-link parameters from the device tree, in both the
"fixed-link" subnode and the legacy property form.

Fixes: d99b408ed8e5 ("net: phy: fixed_phy: remove not needed initialization of phy_device members")
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/net/ethernet/ibm/emac/core.c | 36 +++++++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c
index 9fa18ad99f4d..f097b6e49eeb 100644
--- a/drivers/net/ethernet/ibm/emac/core.c
+++ b/drivers/net/ethernet/ibm/emac/core.c
@@ -2696,6 +2696,40 @@ static int emac_dt_phy_probe(struct emac_instance *dev)
 	return res;
 }
 
+/* The fixed PHY is never started, so phylib never fills in its link state.
+ * Take the link parameters straight from the device tree.
+ */
+static void emac_fixed_link_state(struct emac_instance *dev,
+				  struct device_node *np)
+{
+	struct device_node *fixed_link;
+	u32 prop[5];
+
+	dev->phy.autoneg = AUTONEG_DISABLE;
+	dev->phy.advertising = 0;
+
+	fixed_link = of_get_child_by_name(np, "fixed-link");
+	if (fixed_link) {
+		u32 speed = SPEED_UNKNOWN;
+
+		of_property_read_u32(fixed_link, "speed", &speed);
+		dev->phy.speed = speed;
+		dev->phy.duplex = of_property_read_bool(fixed_link, "full-duplex") ?
+				  DUPLEX_FULL : DUPLEX_HALF;
+		dev->phy.pause = of_property_read_bool(fixed_link, "pause");
+		dev->phy.asym_pause = of_property_read_bool(fixed_link,
+							    "asym-pause");
+		of_node_put(fixed_link);
+	} else if (!of_property_read_u32_array(np, "fixed-link", prop,
+					       ARRAY_SIZE(prop))) {
+		/* legacy <phy_id duplex speed pause asym_pause> */
+		dev->phy.duplex = prop[1] ? DUPLEX_FULL : DUPLEX_HALF;
+		dev->phy.speed = prop[2];
+		dev->phy.pause = prop[3];
+		dev->phy.asym_pause = prop[4];
+	}
+}
+
 static int emac_init_phy(struct emac_instance *dev)
 {
 	struct device_node *np = dev->ofdev->dev.of_node;
@@ -2730,7 +2764,7 @@ static int emac_init_phy(struct emac_instance *dev)
 			ndev->phydev = of_phy_find_device(np);
 			if (res || !ndev->phydev)
 				return res ? res : -EINVAL;
-			emac_adjust_link(dev->ndev);
+			emac_fixed_link_state(dev, np);
 			put_device(&ndev->phydev->mdio.dev);
 		}
 		return 0;
-- 
2.56.0
Re: [PATCH net] net: ibm: emac: fix fixed-link speed and duplex
#14563
Author: Andrew Lunn
Date: Wed, 11 Nov 2026 13:50
10 lines
8470 bytes
> EMAC never attaches or starts the fixed PHY.

Maybe this is the real problem?

A fixed-link is meant to look like a PHY, attach it to the MAC and
start it like a real PHY. That makes the MAC code simpler, no special
cases for a fixed-link.

	Andrew
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads