]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: pcs: rtl930x: apply only needed patching
authorJonas Jelonek <jelonek.jonas@gmail.com>
Fri, 17 Jul 2026 08:45:41 +0000 (08:45 +0000)
committerJonas Jelonek <jelonek.jonas@gmail.com>
Mon, 20 Jul 2026 13:45:54 +0000 (15:45 +0200)
For 10GBase-R and 2500Base-X, the patching sequences for the slower
modes are also applied. This mirrors the SDK which uses some automatic
detection and only does a one-time initialization. However, Linux works
different. The PCS is configured to a specific mode on demand. Thus,
there is no need to apply the other patching when it isn't really
needed.

Those patching sequences seem to initialize AFE blocks within the
SerDes, thus a 1G AFE shouldn't be needed for 10GBase-R. Testing
confirms this so far, no difference in any link characteristics when
e.g. 1G and 2.5G sequences aren't applied for a 10GBase-R link.

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

index 0e4122f3d5b54797a22310595b7384db0ee20ce9..5b3643364ba5bf05d8466e34f76ff7a8c7026e42 100644 (file)
@@ -2920,21 +2920,6 @@ static int rtpcs_930x_sds_config_hw_mode(struct rtpcs_serdes *sds, enum rtpcs_sd
                rtpcs_sds_write(sds, PAGE_TGR_PRO_0, 0x0D, 0x0F00);
                rtpcs_sds_write(sds, PAGE_TGR_PRO_0, 0x00, 0x0000);
                rtpcs_sds_write(sds, PAGE_TGR_PRO_0, 0x01, 0xC800);
-               /*
-                * TODO: Do the 1G and 3G sequences need to be applied? The SDK usually
-                * uses a 10GR-1000BX automatic mode covering all speeds. But in Linux,
-                * we switch the mode on demand so might only need to apply one sequence
-                * at a time.
-                */
-               ret = rtpcs_sds_apply_config(sds, rtpcs_930x_sds_cfg_ana_1g,
-                                            ARRAY_SIZE(rtpcs_930x_sds_cfg_ana_1g));
-               if (ret < 0)
-                       return ret;
-
-               ret = rtpcs_sds_apply_config(sds, rtpcs_930x_sds_cfg_ana_3g,
-                                            ARRAY_SIZE(rtpcs_930x_sds_cfg_ana_3g));
-               if (ret < 0)
-                       return ret;
 
                ret = rtpcs_sds_apply_config(sds, rtpcs_930x_sds_cfg_ana_10g,
                                             ARRAY_SIZE(rtpcs_930x_sds_cfg_ana_10g));
@@ -2945,11 +2930,6 @@ static int rtpcs_930x_sds_config_hw_mode(struct rtpcs_serdes *sds, enum rtpcs_sd
                break;
 
        case RTPCS_SDS_MODE_2500BASEX:
-               ret = rtpcs_sds_apply_config(sds, rtpcs_930x_sds_cfg_ana_1g,
-                                            ARRAY_SIZE(rtpcs_930x_sds_cfg_ana_1g));
-               if (ret < 0)
-                       return ret;
-
                ret = rtpcs_sds_apply_config(sds, rtpcs_930x_sds_cfg_ana_3g,
                                             ARRAY_SIZE(rtpcs_930x_sds_cfg_ana_3g));
                if (ret < 0)