summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonas Jelonek2026-01-02 16:30:16 +0000
committerHauke Mehrtens2026-01-03 15:59:48 +0000
commit7cd3407fdef67e4922f73df327c97bb0a2c679e5 (patch)
tree7e313f3868d3dd9b48e98832fbfb9cbf44cabc48
parent76f392194b43178adaf9c322cf95a8008a42238c (diff)
downloadopenwrt-7cd3407fdef67e4922f73df327c97bb0a2c679e5.tar.gz
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@gmail.com> Link: https://github.com/openwrt/openwrt/pull/21365 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
-rw-r--r--target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c13
1 files 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;