From nobody Mon Sep 28 15:34:35 2026 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D4E146D2C9 for ; Thu, 20 Aug 2026 17:41:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787247711; cv=none; b=UcuFTIJVOst+v2/Krru+/MfqYpawqQnzmp6fBxh6sBf+GirtdEhm9bGbpVgNlR/40/W9bNRDv8k03TnXV04pLDDQAkqAc76FoAR33cV8GP39mBiQa5pbIxTOHsXoUH4KLLUNitizNvIWOgErEWP3JDF5z3PGOrX138erae9gJko= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787247711; c=relaxed/simple; bh=yVO4q/avhgZlEWYD9POUoJRZOo0EKu3RaMmUV42wuS8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=tyqy6nwMr9RvpohdR3bvm7wEchm1G8vbZ2Z6lFW3O3xqE45R55CFl7bWmUzjbJO92pyJhPYCguFydAOdPTlp1N10miZA1HPlT0AgF0D9xkkm72emw+8BR/+ihFKtcLulR7l2pVnVUwyZv3KM+0ovgi5JFLBfMgnTFzYZtVuYjoo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=BrUywSE+; arc=none smtp.client-ip=209.85.221.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BrUywSE+" Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-47fe2d179e2so153396f8f.1 for ; Thu, 20 Aug 2026 10:41:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787247708; x=1787852508; darn=vger.kernel.org; h=cc:to:message-id:content-transfer-encoding:content-type :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=YF36P/EOT2pH1IA18dV55UPJUnVbIvUsggLUy2LloAA=; b=BrUywSE+ArUNW+464cy13qv7v4oQBk/Khtx9CFNrLy9n82kCL/Ft1frXeF+HCV7B5+ 2OxUMilmVp11SG7RqGO8dtXLM0gDyO9xmWy3LW1UE9394gyji6rmo4i9gVsf1VHVQG7+ 8PwTfOk6BqHdowftHLWAKTJCx8OQjh9bbWEnM85a97pjfZQ0021XISVdX59AOjxwm06V KJG9zQpjhBzFl+5mXa0F5dDXqM84aDxZ3AHxdYPfNJFc9Xzf+XrxYAuo4+KUqHj/MKEN KmuizOrLGYmeLB9z4rpxs5V7kGhrmGikJkI69bFGvkuf60RdlyMQT79+hNEPD9OrXueq X0dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787247708; x=1787852508; h=cc:to:message-id:content-transfer-encoding:content-type :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=YF36P/EOT2pH1IA18dV55UPJUnVbIvUsggLUy2LloAA=; b=gcwH8+rtgHSCq1CWE4BUp7RnOhpXs8TheeDalTH2OPG5wexf8de95X6g8Drd69GAmY GPsSoZZu5kEzkwK8PdZum+xZkdLq/6vP8BACevqIV64iJAjxzxIH2dOISVOBVCV6COng M+kxmyONmaAg+Ii20wJAUlTsVLPK+d4xBX0U4t2zLPnycn+aS15pdhNuuyfV3WJx8V5q sMa4w54mYzOjX5jdCwZwVH/EIaAvDe/ySy3QbxbGpNbIHebUTuvP4ZoJrcK1aNF8mpdw xm8R2BWMFR9KvYSKBqR0y5IZsGys25jxys3wuUBUxhEkjkQyK8aXSXu6lKkT07bS/u0Z L8cA== X-Forwarded-Encrypted: i=1; AHgh+RrRcVC3m4NITkK66vsSBQq+7SLJ+Rf3QgEnyDqL7kxff0OeNq9X9nCjKhizqpIoP51Tb6MOpEzRKFbtYWk=@vger.kernel.org X-Gm-Message-State: AOJu0YxIGB1Ps7jNGpg1N/p4QGVzYu/Qf+ltLowkB+9tLdf6fbu86ygI gx+LjYcfu9kiemvGKZoTtDQzhOyQs3jsHeJW/4+I7TWLIpEJODebdazc X-Gm-Gg: AR+sD132edbcHfmavah0F3gzSw5H+0VJ4VT/urVsD7d8lY1GRr/h4fB7qwzuKvMnpAI wcyH62idbQYq2HqHRmJjo3XshVldZR2/HI1gbtvGpVNzzp6dIdBhCrOOlJD5lN/cqb7WbDz5mkY M6OXaXRc24I/rWgQI6EK8bXTUxd4XK9DCYBK3FGhwU3Pw7CGoUNaqQBiptrOnP8X+m0U1cNA/wB bq3PtlW+Fmp86LGspUrJvNPgStrraOCYYAXiGwUCu+2NDhPb/cdmGrZwIyakJr+ae6YBP1A6mkA jHE4LuWLOofazGOMIeTNBBIbZemv2ggFKFstHgUrTSZ2xefzbsu458r06lzzRcjvI4Wlrologvk UScNATNWM5ZUY/gCkQpTT4GMTN2Y+eMq1Cs1PTKLun6EEWvdVM8NjVBPmQSR4Lg3oWWtE4P9SjQ 8oeXdFRq/RPZsS8yigT/R+3ZygwvZt1igTAYFi5s5+R+imqdFTgpGOzNrS4fzC9lq1YPOqn3B0G LyL63SZznvmYktHl64aOaXBYEXEndlz8kxM+6NS2LVWMYfdCN2M9lMplR4zJJVGMKJLrRGY2HGI 6Nxfnpf5kpfR6WbiDyRFhXdEJ9dTjA== X-Received: by 2002:a05:600c:4e8b:b0:499:872b:abd4 with SMTP id 5b1f17b1804b1-499b829ef81mr10110875e9.6.1787247707429; Thu, 20 Aug 2026 10:41:47 -0700 (PDT) Received: from localhost (89-73-120-30.dynamic.play.pl. [89.73.120.30]) by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-499aa17fc80sm169674395e9.14.2026.08.20.10.41.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 20 Aug 2026 10:41:46 -0700 (PDT) From: Patryk Biel Date: Thu, 20 Aug 2026 19:41:40 +0200 Subject: [PATCH] net: pcs: enable autonegotiation for 10g-usxgmii Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260820-b4-fix-pcs-lynx-an-v1-1-62d66391eaff@gmail.com> X-B4-Tracking: v=1; b=H4sIAFQ8h2oC/x2MQQqAIBAAvyJ7bkGtpPpKdCjdaiFMFMKI/p50H JiZBxJFpgSDeCDSxYlPX0BVAuw++42QXWHQUhvZaYlLgytnDDbhcfuMs8d6dcq11DeWDJQwRCr KPx2n9/0AM3hLmmQAAAA= X-Change-ID: 20260820-b4-fix-pcs-lynx-an-3fd1d5e94ce6 To: Ioana Ciornei , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Vladimir Oltean , Patryk Biel X-Mailer: b4 0.14.2 The Lynx PCS USXGMII setup programs the replicator advertisement, but does not explicitly enable and restart in-band autonegotiation or program the replicator link timers. This leaves the PCS dependent on firmware or bootloader state. Systems which do not get the USXGMII replicator preconfigured before Linux may therefore fail to negotiate the link correctly. After programming the USXGMII device ability, configure the replicator BMCR with reset, autonegotiation enable and autonegotiation restart. Also program the replicator link timer registers with the values used by the ENETC/Felix setup. Signed-off-by: Patryk Biel --- This is a follow-up to the discussion started here: Link: https://lore.kernel.org/netdev/CA+DkFDaW_wJ5p9_P7pMpz-8iE6xeKkdF-MQcd= 2m2GcyVUE3S4Q@mail.gmail.com/ To summarize: on systems that don't rely on the U-Boot Felix switch driver to pre-configure 10G-QXGMII in-band autonegotiation, the Lynx PCS USXGMII code programs the replicator device ability but never actually enables/restarts autonegotiation nor sets up the replicator link timers. This leaves link establishment dependent on bootloader state that isn't guaranteed to exist. This series only addresses the PCS side of the problem: it configures the USXGMII replicator BMCR (reset/AN enable/AN restart) and the link timer registers whenever lynx_pcs_config_usxgmii() is called, so that in-band AN comes up correctly regardless of what the bootloader did. It intentionally does NOT yet remove the "only supports in-band AN for now" limitation, nor does it wire up neg_mode-based configuration to support the managed =3D "in-band-status" property being absent from the device tree. That part still needs more work/testing on my side (in particular the in-band-disable path isn't behaving as expected yet with the PHY I'm testing against), and I'd like to discuss the right approach for it separately before sending a follow-up series. Feedback welcome, especially on whether this is an acceptable incremental step or whether it should be bundled together with the neg_mode/in-band-disable work --- drivers/net/pcs/pcs-lynx.c | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/drivers/net/pcs/pcs-lynx.c b/drivers/net/pcs/pcs-lynx.c index a92081560e641ad2b297b7395cc72bf2f59ea16c..33655079fe51dba9dc96b0f7a79= c4303e9492463 100644 --- a/drivers/net/pcs/pcs-lynx.c +++ b/drivers/net/pcs/pcs-lynx.c @@ -20,6 +20,9 @@ #define IF_MODE_SPEED_MSK GENMASK(3, 2) #define IF_MODE_HALF_DUPLEX BIT(4) =20 +#define ENETC_PCS_REPL_LINK_TIMER_1_DEF 0x0003 +#define ENETC_PCS_REPL_LINK_TIMER_2_DEF 0x06a0 + struct lynx_pcs { struct phylink_pcs pcs; struct mdio_device *mdio; @@ -154,6 +157,7 @@ static int lynx_pcs_config_usxgmii(struct mdio_device *= pcs, const unsigned long *advertising, unsigned int neg_mode) { + int ret; struct mii_bus *bus =3D pcs->bus; int addr =3D pcs->addr; =20 @@ -164,10 +168,38 @@ static int lynx_pcs_config_usxgmii(struct mdio_device= *pcs, } =20 /* Configure device ability for the USXGMII Replicator */ - return mdiobus_c45_write(bus, addr, MDIO_MMD_VEND2, MII_ADVERTISE, - MDIO_USXGMII_10G | MDIO_USXGMII_LINK | - MDIO_USXGMII_FULL_DUPLEX | - ADVERTISE_SGMII | ADVERTISE_LPACK); + ret =3D mdiobus_c45_write(bus, addr, MDIO_MMD_VEND2, MII_ADVERTISE, + MDIO_USXGMII_10G | MDIO_USXGMII_LINK | + MDIO_USXGMII_FULL_DUPLEX | + ADVERTISE_SGMII | ADVERTISE_LPACK); + if (ret < 0) { + dev_err(&pcs->dev, "could not set USXGMII replicator config\n"); + return ret; + } + + /* Configure autonegotiation */ + ret =3D mdiobus_c45_write(bus, addr, MDIO_MMD_VEND2, MII_BMCR, + BMCR_RESET | BMCR_ANENABLE | BMCR_ANRESTART); + if (ret < 0) { + dev_err(&pcs->dev, "could not set USXGMII replicator control config\n"); + return ret; + } + + ret =3D mdiobus_c45_write(bus, addr, MDIO_MMD_VEND2, LINK_TIMER_LO, + ENETC_PCS_REPL_LINK_TIMER_1_DEF); + if (ret < 0) { + dev_err(&pcs->dev, "could not set USXGMII Link Timer 1\n"); + return ret; + } + + ret =3D mdiobus_c45_write(bus, addr, MDIO_MMD_VEND2, LINK_TIMER_HI, + ENETC_PCS_REPL_LINK_TIMER_2_DEF); + if (ret < 0) { + dev_err(&pcs->dev, "could not set USXGMII Link Timer 2\n"); + return ret; + } + + return ret; } =20 static int lynx_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode, --- base-commit: 91ec2035134982b98fab0609a9fd8480e8217dc1 change-id: 20260820-b4-fix-pcs-lynx-an-3fd1d5e94ce6 Best regards, --=20 Patryk Biel