🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #27236

[PATCH net-next v2 3/4] net: phy: realtek: add Giga Lite support

#27236
From: Hee-Suk Kim
Date: Sat, 05 Dec 2026 04:00
138 lines
14865 bytes
Giga Lite is a Realtek proprietary mode which runs at 500 Mbps over two
pairs. Expose it as 500baseT2/Full on the generic FE-GE PHY when the MAC
driver sets RTL_PHY_F_GIGA_LITE, and report SPEED_500 for it.

The PHY enables Giga Lite when page 0xa42, reg 0x14, bit 9 is set, and
negotiates it on its own regardless of the C22 advertisement. With the
bit set, the link came up at Giga Lite even when only 10/100 was
advertised. So set the bit only when autonegotiating with
500baseT2/Full advertised, and clear it otherwise, so that the
advertisement set with ethtool is respected.

500baseT2/Full is advertised by default. It is added in config_init()
rather than get_features(), as dev_flags is not yet set when the PHY is
probed.

Signed-off-by: Hee-Suk Kim <hskim@dilluti0n.com>
---
 MAINTAINERS                            |  1 +
 drivers/net/phy/realtek/realtek_main.c | 52 ++++++++++++++++++++++++++++++++++
 include/linux/realtek_phy.h            | 10 +++++++
 3 files changed, 63 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index bfa5a7248973..07e4c8f80682 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10066,6 +10066,7 @@ F:	include/linux/phy_fixed.h
 F:	include/linux/phy_link_topology.h
 F:	include/linux/phylib_stubs.h
 F:	include/linux/platform_data/mdio-bcm-unimac.h
+F:	include/linux/realtek_phy.h
 F:	include/net/phy/
 F:	include/trace/events/mdio.h
 F:	include/uapi/linux/mdio.h
diff --git a/drivers/net/phy/realtek/realtek_main.c b/drivers/net/phy/realtek/realtek_main.c
index a39ad18382f2..bf62823252d9 100644
--- a/drivers/net/phy/realtek/realtek_main.c
+++ b/drivers/net/phy/realtek/realtek_main.c
@@ -14,6 +14,7 @@
 #include <linux/of.h>
 #include <linux/phy.h>
 #include <linux/pm_wakeirq.h>
+#include <linux/realtek_phy.h>
 #include <linux/netdevice.h>
 #include <linux/module.h>
 #include <linux/delay.h>
@@ -1708,6 +1709,9 @@ static void rtlgen_decode_physr(struct phy_device *phydev, int val)
 	case 0x0020:
 		phydev->speed = SPEED_1000;
 		break;
+	case 0x0030:	/* Giga Lite */
+		phydev->speed = SPEED_500;
+		break;
 	case 0x0200:
 		phydev->speed = SPEED_10000;
 		break;
@@ -1735,6 +1739,52 @@ static void rtlgen_decode_physr(struct phy_device *phydev, int val)
 	}
 }
 
+/* Giga Lite is a Realtek proprietary mode which runs at 500 Mbps over
+ * two pairs. It is negotiated on its own and does not depend on 1000baseT
+ * being advertised, so it is exposed as the 500baseT2/Full link mode.
+ *
+ * The PHY ID is shared by all PHYs integrated into the RTL8168 family, so
+ * the MAC driver tells us whether the chip supports it. dev_flags is not
+ * known before the MAC driver has attached, hence the link mode is added
+ * here instead of in get_features().
+ */
+static int rtlgen_config_init(struct phy_device *phydev)
+{
+	if (!(phydev->dev_flags & RTL_PHY_F_GIGA_LITE))
+		return 0;
+
+	/* Advertise it by default, but only the first time, so that the
+	 * user setting survives a later phy_init_hw().
+	 */
+	if (!linkmode_test_bit(ETHTOOL_LINK_MODE_500baseT2_Full_BIT,
+			       phydev->supported)) {
+		linkmode_set_bit(ETHTOOL_LINK_MODE_500baseT2_Full_BIT,
+				 phydev->supported);
+		linkmode_set_bit(ETHTOOL_LINK_MODE_500baseT2_Full_BIT,
+				 phydev->advertising);
+	}
+
+	return 0;
+}
+
+static int rtlgen_config_aneg(struct phy_device *phydev)
+{
+	int ret = 0;
+
+	if (phydev->dev_flags & RTL_PHY_F_GIGA_LITE) {
+		bool en = phydev->autoneg == AUTONEG_ENABLE &&
+			  linkmode_test_bit(ETHTOOL_LINK_MODE_500baseT2_Full_BIT,
+					    phydev->advertising);
+
+		ret = phy_modify_paged_changed(phydev, 0xa42, 0x14, BIT(9),
+					       en ? BIT(9) : 0);
+		if (ret < 0)
+			return ret;
+	}
+
+	return __genphy_config_aneg(phydev, ret > 0);
+}
+
 static int rtlgen_read_status(struct phy_device *phydev)
 {
 	int ret, val;
@@ -3286,6 +3336,8 @@ static struct phy_driver realtek_drvs[] = {
 	}, {
 		.name		= "Generic FE-GE Realtek PHY",
 		.match_phy_device = rtlgen_match_phy_device,
+		.config_init	= rtlgen_config_init,
+		.config_aneg	= rtlgen_config_aneg,
 		.read_status	= rtlgen_read_status,
 		.suspend	= genphy_suspend,
 		.resume		= rtlgen_resume,
diff --git a/include/linux/realtek_phy.h b/include/linux/realtek_phy.h
new file mode 100644
index 000000000000..7fcde616c070
--- /dev/null
+++ b/include/linux/realtek_phy.h
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _REALTEK_PHY_H
+#define _REALTEK_PHY_H
+
+#include <linux/bits.h>
+
+/* phy_device::dev_flags */
+#define RTL_PHY_F_GIGA_LITE	BIT(0)
+
+#endif /* _REALTEK_PHY_H */

-- 
2.56.1
Technical Details
Message-ID: <20261205-giga-lite-v2-3-5b84410edb9f@dilluti0n.com>
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377821-linux-kernel-netdev=dewy.ru
References: <20261205-giga-lite-v2-0-5b84410edb9f@dilluti0n.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377821-linux-kernel-netdev=dewy.ru
From: hskim@dilluti0n.com (Hee-Suk Kim)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v2 3/4] net: phy: realtek: add Giga Lite support
Date: Sat, 05 Dec 2026 13:00:38 +0900
Organization: Usenet Network
Message-ID: <20261205-giga-lite-v2-3-5b84410edb9f@dilluti0n.com>
References: <20261205-giga-lite-v2-0-5b84410edb9f@dilluti0n.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="2949113"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:geugI6YmgYZiNsyhACQjHjah5aE= sha256:dXvuy2Y4FZpp/Vlh4shN4TBSGncwH220QAVUTLSQRJA=
	sha1:eCbdUlpNi5/G106hEYIA1Of0KE0= sha256:RyhjVBAH1eEi5sAFt3axceAJHTip17e/ogJmLUPP2AU=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 6F029117D22; Sat,  5 Dec 2026 07:01:34 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.998
X-Spam-Status: No, score=-2.998 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_INVALID=0.1, DKIM_SIGNED=0.1,
	HEADER_FROM_DIFFERENT_DOMAINS=0.001, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
	URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=fail (2048-bit key)
	reason="fail (message has been altered)" header.d=dilluti0n.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id cej5NLwb87S2;
	Sat,  5 Dec 2026 07:01:32 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-377821-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=dilluti0n.com
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id DF992117D5F; Sat,  5 Dec 2026 07:01:23 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id ECBDC215CC; Sat,  5 Dec 2026 04:01:20 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796443274;
	b=zBpOB80ZSl5rHs/gFug1fiVX1N6931B1T68mvxC7a3kSh+mFiQOsVSY9Q6ujHWY/OPJE
	 gcHJLNQArsQh3TPgFRTw75k3sEXvnE1SFS2irKWpoPXNJmfKYtzO0w0DZH+ddAuKjLD67
	 ece2/kZJqzhqyApksg8qtGl7zVwjmbzkH7g6K+TBA8fnlKgIDwkS5LjhKzG7ELFlt5kre
	 6RMmUYpiQC7kKeQrHdtaqtHKWVnabXDIkjDLgXHF5kO4KaGhqblCiskodGzwS8t3vNTd4
	 r9JIXubLQLP7Mmay3P15GAkmxWkFqXCCQh8ot2+iVV7Jb1fq9Tg3rGTw4/VbZ+T2mHg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796443274;
	h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:Received:
	 From:Date:Subject:X-Mailing-List:List-Id:List-Post:List-Help:
	 List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Type:Content-Transfer-Encoding:Message-Id:References:
	 In-Reply-To:To:Cc:X-Mailer:X-Developer-Signature:X-Developer-Key:
	 X-Report-Abuse:Feedback-ID:X-smtpcorp-track;
	bh=b+ZH53UDBohQD6mkIJNy7FFRiebuEG25N+jG/kxWIxA=;
	b=T+BXqQRXaRZA3l/ycxnzWEeZL8clR+1Dhza2GdQMcfeyACzDD97mewlNbzBdUqm6Bx7v
	 53o9y++as0g4ZeGNyEGInKCwA16EAaStRXqyo/xR5TC6CKZptXLaRJyxyJi+XgdeCMCbT
	 QIC50fYO4pJoE3WE4wx/VmNlOfDDcK46pAOaaZPDfQkV6+N1MiQxk9MZshuidWn7L9WB8
	 6P2chqq1APow7IINkyLUAWaAEtsKXeTehLcaK5Oo+y/jARQfLxNw9rStAkGnH0HvFsIzd
	 SGdySI7/NpChbtlj2dWGwKP6zIvIWJEVP7MPAnIyj5GYf5aaHvr7nP4Q3hMmsEIZ/uA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=fail reason="signature verification failed" header.d=dilluti0n.com header.i=@dilluti0n.com header.a=rsa-sha256 header.s=s840244 header.b=b6Oyrz3Q;
	dmarc=pass header.from=dilluti0n.com;
	spf=pass smtp.mailfrom=em840244.dilluti0n.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 8352C606A6A5;
	Sat,  5 Dec 2026 04:01:14 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=fail reason="signature verification failed" (2048-bit key, unprotected) header.d=dilluti0n.com header.i=@dilluti0n.com header.a=rsa-sha256 header.s=s840244 header.b=b6Oyrz3Q
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=170.10.71.231
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796443273;
	b=pVj6Xv2R78FAixa9UY74kriYtgUqw2I6uw7wKUPCquYn+1G8XY2lAsEcL//+ELvHOA9C
	 PI0ztRP47Qp/FNhkcujZfMFmlNbeg+zOUYCirgJ0pUMURcX/orFRk9xo+C2i8U6z+zFJJ
	 Hd8C9yTocXG3BcrtVgrxi1bHvrBK3ZmWI1qzk0l5VQHDmP3zUXb79dTBQAg2bD/ipASaS
	 Jf5848BmA55IZRLfz7Wi2A3/lFAF+r4ddSS4+lDjfYFaZT4B5a+LWZ3W0SVU5eTmbLHNz
	 Kaxku/XaMEKEZvM//PwROMxHdoOoonHo9qDv8jscgaJbW/yH85DNOiceoJOdcxyCXqQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796443273;
	h=DMARC-Filter:DKIM-Signature:Received:Received:From:Date:Subject:
	 MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:
	 References:In-Reply-To:To:Cc:X-Mailer:X-Developer-Signature:
	 X-Developer-Key:X-Report-Abuse:Feedback-ID:X-smtpcorp-track;
	bh=b+ZH53UDBohQD6mkIJNy7FFRiebuEG25N+jG/kxWIxA=;
	b=lYwrH3X7XutG8VmSJCS3Mv28NBXgtIA7t/XZk8cXNJloeQGteA7mm1JYV1X2JyfHMcC1
	 0a2pMsoRJUTWAslS1p3Yrk4l9PEfNeyj4Z9jw2m350/SnVsia8xR/eI/hZ3U+RKxO2gya
	 4x9wpr3avRXiTp065FV+eerIubmmlefmjaVhnE7bmB1m3Fly1z2o2VdudCvmQ/ORCFJB7
	 l0yRNhZvF6ymZWSDGr128zbVom1z+wWRt1VSIGLsPZbuzjNO50l1JNVNEvXoWmfEah35K
	 E5XB5WLfFRIDIFEw5fqLAQ44PVa5fmyd/nfNAMNlpJBI5l2rviPkeSEqN47Bc2ikREw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=dilluti0n.com;
	spf=pass smtp.mailfrom=em840244.dilluti0n.com;
	dkim=pass header.d=dilluti0n.com header.i=@dilluti0n.com header.a=rsa-sha256 header.s=s840244 header.b=b6Oyrz3Q;
	arc=none smtp.remote-ip=170.10.71.231
X-Received: from a5i231.smtp2go.com (a5i231.smtp2go.com [170.10.71.231])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2E6EB606A691
	for <netdev@vger.kernel.org>; Sat,  5 Dec 2026 04:01:12 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2E6EB606A691
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=dilluti0n.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=em840244.dilluti0n.com
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dilluti0n.com;
 i=@dilluti0n.com; q=dns/txt; s=s840244; t=1796443272; h=from : subject
 : to : message-id : date : list-unsubscribe : list-unsubscribe-post;
 bh=b+ZH53UDBohQD6mkIJNy7FFRiebuEG25N+jG/kxWIxA=;
 b=b6Oyrz3QT4703HOWadtyC/3gwGJCp0hoNdNQdFFCEn++IdKtZ/dYmNrcHvJ+wN7YIisyk
 3gDG3jz2CT8tvRqSxJT8oJ9Mf4PZhKUllcOyhjKGRKfZPjxt8SS+j5te+zAyRP/v95yYPPs
 cTlZKkzIU435cUjlzEh0Lr5l1c2UbnRsvj0CBe588xS/ZGAWPZxe745KfmvUpTXI08cMDMl
 ecuYTQ67O9MjibVo2yT8n72AQMoA/OB6X/LGcppHktvHMI1V9rg6GeomEDo966E/tjM/063
 1Zbn2bMIcI995JBTqY/Ecq8WbeE2ITbLEcE3jwM9o4uwTPO7YkpVIPn//W/Q==
X-Received: from [10.40.244.132] (helo=dilluti0n.com)
	by smtpcorp.com with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256:X25519)
	(Exim 4.100.1)
	(envelope-from <hskim@dilluti0n.com>)
	id 1xZgxL-AIkwcC8mars-59DJ;
	Sat, 05 Dec 2026 04:01:03 +0000
X-Received: from localhost (<unknown> [10.42.0.2])
	by dilluti0n.com (OpenSMTPD) with ESMTP id fb293030;
	Sat, 5 Dec 2026 04:00:49 +0000 (UTC)
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <20261205-giga-lite-v2-0-5b84410edb9f@dilluti0n.com>
X-Cc: Andrew Lunn <andrew@lunn.ch>, Heiner Kallweit <hkallweit1@gmail.com>, 
 Russell King <linux@armlinux.org.uk>, 
 "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, 
 Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, 
 Willem de Bruijn <willemb@google.com>, Simon Horman <horms@kernel.org>, 
 Maxime Chevallier <maxime.chevallier@bootlin.com>, 
 Daniel Golle <daniel@makrotopia.org>, nic_swsd@realtek.com, 
 Andrew Lunn <andrew+netdev@lunn.ch>, linux-kernel@vger.kernel.org, 
 javen <javen_xu@realsil.com.cn>, 
 Björn Töpel <bjorn@kernel.org>, 
 Hee-Suk Kim <hskim@dilluti0n.com>
X-Mailer: b4 0.15.2
X-Developer-Signature: v=1; a=openpgp-sha256; l=4668; i=hskim@dilluti0n.com;
 h=from:subject:message-id; bh=1PYQcajNv+CbBLu9Mm+LucsNq814swKnIgLb46aiUQ0=;
 b=owGbwMvMwCncbZ4x63W37CbG02pJDNnCPfml+3POTlsU/uWSZpGN5vNl8+2yfHTVXzDMvzKzW
 uLqosMiHRtZGIQ5GSzFFFlu+s/+n67ufW5q9gwnmDmsTCBDpEUaGICAhYEvNzGv1EjHSM9U21DP
 EMjQMWLg4hSAqV5uxthww0JJr29xTVfIuYnbMzzm9R5/5pwud8wtkyHL94zMU4Mti/+19ihaPdc
 2zEtQ6JFdwcTYcP1X1nOd9cuy9/xu/RiQ5S2l7qFUo7s+11e30Y370EP/fYnt0gzs2T6/zVuK/a
 p9zKoA
X-Developer-Key: i=hskim@dilluti0n.com; a=openpgp;
 fpr=3D4686CAC75A49A69E49692099A8DC6DA49AB13C
X-Report-Abuse: Please forward a copy of this message, including all headers, to <abuse-report@smtp2go.com>
X-Feedback-ID: 840244m:840244atORciv:840244sYa62LPwhl
X-smtpcorp-track: pArEs3r2E_8u.Abeu-VEWPweO.-2E2Fwr3utP