]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: pcs: rtl930x: apply tx config before activation
authorJonas Jelonek <jelonek.jonas@gmail.com>
Thu, 11 Jun 2026 20:05:28 +0000 (20:05 +0000)
committerJonas Jelonek <jelonek.jonas@gmail.com>
Sun, 14 Jun 2026 13:11:45 +0000 (15:11 +0200)
In RTL930x setup, tx config was called at then end of the procedure
after configuration and calibration ran. This is still a leftover from
the old code located in DSA/PHY. However, applying TX configuration like
amplification factors, etc. doesn't make sense after calibration, it
should run before. Moreover the call was commented with "leave loopback
mode" which is just wrong and doesn't describe what the function does.
Fix this misery.

Testing on device with different interface modes shows no difference so
far, especially no negative effects.

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

index aa49a85a5e2ca460fafd6b96ce193a1c164af532..a24be40c4ff5c0e544f94843b3fd41b9e0aabc9a 100644 (file)
@@ -3070,6 +3070,8 @@ static int rtpcs_930x_setup_serdes(struct rtpcs_serdes *sds,
         */
        rtpcs_sds_write_bits(sds, 0x1f, 11, 1, 1, 1);
 
+       rtpcs_930x_sds_tx_config(sds, hw_mode);
+
        /* Enable SDS in desired mode */
        ret = rtpcs_930x_sds_set_mode(sds, hw_mode);
        if (ret < 0)
@@ -3080,7 +3082,7 @@ static int rtpcs_930x_setup_serdes(struct rtpcs_serdes *sds,
        rtpcs_930x_sds_activate(sds);
 
        if (hw_mode == RTPCS_SDS_MODE_QSGMII)
-               goto skip_cali;
+               return 0;
 
        /* Calibrate SerDes receiver in loopback mode */
        rtpcs_930x_sds_10g_idle(sds);
@@ -3092,10 +3094,6 @@ static int rtpcs_930x_setup_serdes(struct rtpcs_serdes *sds,
        if (calib_tries >= 3)
                pr_warn("%s: SerDes RX calibration failed\n", __func__);
 
-skip_cali:
-       /* Leave loopback mode */
-       rtpcs_930x_sds_tx_config(sds, hw_mode);
-
        return 0;
 }