From 6f4c43199027dfa07e0e8035c52f4ada0a13fd73 Mon Sep 17 00:00:00 2001 From: Jonas Jelonek Date: Wed, 18 Mar 2026 10:26:16 +0100 Subject: [PATCH] realtek: pcs: rtl930x: reorder FGCAL code 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 Signed-off-by: Jonas Jelonek Link: https://github.com/openwrt/openwrt/pull/22450 Signed-off-by: Robert Marko --- .../realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 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 1e6c49e191..ccaed497f9 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 @@ -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;