]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: pcs: rtl930x: fix calibration check
authorJonas Jelonek <jelonek.jonas@gmail.com>
Mon, 16 Mar 2026 15:22:55 +0000 (15:22 +0000)
committerRobert Marko <robimarko@gmail.com>
Sat, 21 Mar 2026 22:06:10 +0000 (23:06 +0100)
Comparing our calibration check with the one in the SDK ([1]), one can
see some discrepancies for which there are no apparent reasons. SGMII
and 1000Base-X are handled equal to XSGMII although they aren't in the
SDK and have different symbol error registers. USXGMII and 10GBase-R are
fine, but other modes are explicitly handled with failure then.

Restructure this by keeping XSGMII alone with its dedicated check (as
the SDK does) and handle all other modes differently. Though the SDK
just skips symbol error check for modes like SGMII, 1000Base-X,
2500Base-X, it was found to be ok to perform a simple check for them
too. Since we have also a default case in the symbol error read
implementation now, we can cover all other modes with default case here
too. As a side-effect, this removes the confusing and probably wrong
failure stating calibration has failed although just the checks were
insufficient.

Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22450
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c

index 98a09eaa1c208795cc37e91fc18ae5d047501c24..ee0d685a6c13ece5e30b28bbc05285198762b821 100644 (file)
@@ -2610,8 +2610,6 @@ static int rtpcs_930x_sds_check_calibration(struct rtpcs_serdes *sds,
        errors2 = rtpcs_930x_sds_sym_err_get(sds, hw_mode);
 
        switch (hw_mode) {
-       case RTPCS_SDS_MODE_1000BASEX:
-       case RTPCS_SDS_MODE_SGMII:
        case RTPCS_SDS_MODE_XSGMII:
                if ((errors2 - errors1 > 100) ||
                    (errors1 >= 0xffff00) || (errors2 >= 0xffff00)) {
@@ -2619,16 +2617,12 @@ static int rtpcs_930x_sds_check_calibration(struct rtpcs_serdes *sds,
                        return 1;
                }
                break;
-       case RTPCS_SDS_MODE_10GBASER:
-       case RTPCS_SDS_MODE_USXGMII_10GSXGMII:
-       case RTPCS_SDS_MODE_USXGMII_10GQXGMII:
+       default:
                if (errors2 > 0) {
-                       pr_info("%s: 10G error rate too high\n", __func__);
+                       pr_info("%s: symbol error rate too high\n", __func__);
                        return 1;
                }
                break;
-       default:
-               return 1;
        }
 
        return 0;