[openwrt/openwrt] realtek: pcs: rtl931x: fix SerDes link status reading

LEDE Commits lede-commits at lists.infradead.org
Sat Feb 14 11:42:13 PST 2026


hauke pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/8904ac2673947d4f5cc81e6de392d0dea7ff5bd3

commit 8904ac2673947d4f5cc81e6de392d0dea7ff5bd3
Author: Jonas Jelonek <jelonek.jonas at gmail.com>
AuthorDate: Tue Feb 10 13:56:27 2026 +0000

    realtek: pcs: rtl931x: fix SerDes link status reading
    
    Fix the function for reading the SerDes link status to work correctly
    based on the code the SDK uses. This is mostly for the sake of
    documentation and quick access to the information. The function isn't
    used currently but may be in the future, thus no functional change here.
    
    Signed-off-by: Jonas Jelonek <jelonek.jonas at gmail.com>
    Link: https://github.com/openwrt/openwrt/pull/22014
    Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 .../realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c      | 14 ++++++++++++--
 1 file changed, 12 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 d72477ab0b..a13b591af8 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
@@ -3386,12 +3386,22 @@ static int rtpcs_931x_sds_link_sts_get(struct rtpcs_serdes *sds)
 {
 	u32 sts, sts1, latch_sts, latch_sts1;
 
-	if (0) {
+	switch (sds->hw_mode) {
+	case RTPCS_SDS_MODE_XSGMII:
 		sts = rtpcs_sds_read_bits(sds, 0x41, 29, 8, 0);
 		sts1 = rtpcs_sds_read_bits(sds, 0x81, 29, 8, 0);
 		latch_sts = rtpcs_sds_read_bits(sds, 0x41, 30, 8, 0);
 		latch_sts1 = rtpcs_sds_read_bits(sds, 0x81, 30, 8, 0);
-	} else {
+		break;
+
+	case RTPCS_SDS_MODE_SGMII:
+	case RTPCS_SDS_MODE_HISGMII:
+	case RTPCS_SDS_MODE_2500BASEX:
+		sts = rtpcs_sds_read_bits(sds, 0x41, 29, 8, 0);
+		latch_sts = rtpcs_sds_read_bits(sds, 0x41, 30, 8, 0);
+		break;
+
+	default:
 		sts = rtpcs_sds_read_bits(sds, 0x5, 0, 12, 12);
 		latch_sts = rtpcs_sds_read_bits(sds, 0x4, 1, 2, 2);
 		latch_sts1 = rtpcs_sds_read_bits(sds, 0x42, 1, 2, 2);




More information about the lede-commits mailing list