]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: pcs: rtl930x: reorder FGCAL code
authorJonas Jelonek <jelonek.jonas@gmail.com>
Wed, 18 Mar 2026 09:26:16 +0000 (10:26 +0100)
committerRobert Marko <robimarko@gmail.com>
Sat, 21 Mar 2026 22:06:10 +0000 (23:06 +0100)
The order within the FGCAL code is not optimal. Right now, there's
output printed even in successful cases (which doesn't really help) and
a value is read although it isn't used if the run succeeds. To fix both,
move that below the success loop exit so it's just printed in
non-success case where the information might be helpful.

Suggested-by: Bevan Weiss <bevan.weiss@gmail.com>
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 1e6c49e191c4137a56a46c744dc86f28181dc282..ccaed497f97d715e709fabfbf1ccc005cd39fe94 100644 (file)
@@ -2266,6 +2266,7 @@ static void rtpcs_930x_sds_do_rx_calibration_2_3(struct rtpcs_serdes *sds)
                rtpcs_sds_write(even_sds, 0x1f, 0x2, (sds == even_sds) ? 0x2f : 0x31);
                rtpcs_sds_write_bits(sds, 0x2e, 0x15, 9, 9, 0x1);       /* REG0_RX_EN_TEST */
                rtpcs_sds_write_bits(sds, 0x21, 0x06, 11, 6, 0x20);     /* REG0_RX_DEBUG_SEL */
+
                rtpcs_sds_write_bits(sds, 0x2f, 0x0c, 5, 0, 0xf);       /* REG0_COEF_SEL */
                /* ##FGCAL read gray */
                fgcal_gray = rtpcs_sds_read_bits(sds, 0x1f, 0x14, 5, 0);
@@ -2273,14 +2274,13 @@ static void rtpcs_930x_sds_do_rx_calibration_2_3(struct rtpcs_serdes *sds)
                /* ##FGCAL read binary */
                fgcal_binary = rtpcs_sds_read_bits(sds, 0x1f, 0x14, 5, 0);
 
-               pr_info("%s: fgcal_gray: %d, fgcal_binary %d\n",
-                       __func__, fgcal_gray, fgcal_binary);
-
-               offset_range = rtpcs_sds_read_bits(sds, 0x2e, 0x15, 15, 14);
-
                if (fgcal_binary <= 60 && fgcal_binary >= 3)
                        break;
 
+               pr_info("%s: fgcal_gray = %d, fgcal_binary = %d\n", __func__, fgcal_gray,
+                       fgcal_binary);
+
+               offset_range = rtpcs_sds_read_bits(sds, 0x2e, 0x15, 15, 14);
                if (offset_range == 3) {
                        pr_info("%s: Foreground Calibration result marginal!", __func__);
                        break;