mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rosen Penev <rosenp@gmail.com>
To: netdev@vger.kernel.org
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	linux-kernel@vger.kernel.org (open list)
Subject: [PATCH net] net: ibm: emac: fix fixed-link speed and duplex
Date: Tue, 10 Nov 2026 16:30:08 -0800	[thread overview]
Message-ID: <20261111003008.960305-1-rosenp@gmail.com> (raw)

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


                 reply	other threads:[~2026-11-11  0:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261111003008.960305-1-rosenp@gmail.com \
    --to=rosenp@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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

all inboxes | Powered by JetHome®