From: Jonas Jelonek Date: Fri, 2 Jan 2026 16:30:16 +0000 (+0000) Subject: realtek: pcs: cover number of links per SerDes for USXGMII X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7cd3407fdef67e4922f73df327c97bb0a2c679e5;p=thirdparty%2Fopenwrt.git 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 Link: https://github.com/openwrt/openwrt/pull/21365 Signed-off-by: Hauke Mehrtens --- 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 da11b7bafe3..bd19bd5fb23 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;