[openwrt/openwrt] realtek: pcs: cover number of links per SerDes for USXGMII
LEDE Commits
lede-commits at lists.infradead.org
Sat Jan 3 08:00:44 PST 2026
hauke pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/7cd3407fdef67e4922f73df327c97bb0a2c679e5
commit 7cd3407fdef67e4922f73df327c97bb0a2c679e5
Author: Jonas Jelonek <jelonek.jonas at gmail.com>
AuthorDate: Fri Jan 2 16:30:16 2026 +0000
realtek: pcs: cover number of links per SerDes for USXGMII
A SerDes may supply multiple ports and depending on that number,
different hardware modes need to be used. While there are corresponding
modes in the kernel in some cases (e.g. USXGMII with 4 2.5G ports aka
10G-QXGMII), this doesn't always map to Realtek hardware modes. Use the
previously added link number accounting for that.
An obvious example of this is the SerDes on XGS12xx-12 switches which
is connected to an octa-PHY. This runs Realtek proprietary XSGMII mode
(10G-pumped SGMII interface) for which there is no corresponding mode
in the kernel.
Signed-off-by: Jonas Jelonek <jelonek.jonas at gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21365
Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
.../linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c b/target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c
index da11b7bafe..bd19bd5fb2 100644
--- a/target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c
+++ b/target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c
@@ -285,6 +285,8 @@ static int rtpcs_sds_determine_hw_mode(struct rtpcs_serdes *sds,
phy_interface_t if_mode,
enum rtpcs_sds_mode *hw_mode)
{
+ u8 n_links = sds->num_of_links;
+
switch (if_mode) {
case PHY_INTERFACE_MODE_NA:
*hw_mode = RTPCS_SDS_MODE_OFF;
@@ -308,8 +310,15 @@ static int rtpcs_sds_determine_hw_mode(struct rtpcs_serdes *sds,
*hw_mode = RTPCS_SDS_MODE_QSGMII;
break;
case PHY_INTERFACE_MODE_USXGMII:
- /* TODO: set this depending on number of links on SerDes */
- *hw_mode = RTPCS_SDS_MODE_USXGMII_10GSXGMII;
+ if (n_links == 1)
+ *hw_mode = RTPCS_SDS_MODE_USXGMII_10GSXGMII;
+ else if (n_links == 2)
+ *hw_mode = RTPCS_SDS_MODE_USXGMII_10GDXGMII;
+ else if (n_links <= 4)
+ *hw_mode = RTPCS_SDS_MODE_USXGMII_10GQXGMII;
+ else if (n_links <= 8)
+ *hw_mode = RTPCS_SDS_MODE_XSGMII;
+
break;
case PHY_INTERFACE_MODE_10G_QXGMII:
*hw_mode = RTPCS_SDS_MODE_USXGMII_10GQXGMII;
More information about the lede-commits
mailing list