]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: pcs: rtl931x: match function name with content
authorJonas Jelonek <jelonek.jonas@gmail.com>
Mon, 2 Feb 2026 12:06:49 +0000 (12:06 +0000)
committerHauke Mehrtens <hauke@hauke-m.de>
Sat, 7 Feb 2026 23:35:19 +0000 (00:35 +0100)
The function 'rtpcs_931x_sds_init_leq_dfe' was taken over mostly as-is
from the SDK. After looking at what it actually does (by seeing which
register are written and how they are used elsewhere), it becomes clear
that 'init' isn't the correct term to describe what it does. It sets the
LEQ and DFE parameters to baseline values (mostly 0) and turns off auto
mode, switching to manual LEQ/DFE and forcing those baseline values.
This is rather a reset to a known state instead of an initialization.
Name the function accordingly.

Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21858
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c

index dfa86af2d3d5a49ed6f3f9d13ea473c73c3f8b87..6f6e740e51bb81ef98382bad606e714e1e6c18c4 100644 (file)
@@ -3018,7 +3018,21 @@ static void rtpcs_931x_sds_clear_symerr(struct rtpcs_serdes *sds,
        }
 }
 
-static int rtpcs_931x_sds_init_leq_dfe(struct rtpcs_serdes *sds)
+/**
+ * rtpcs_931x_sds_reset_leq_dfe() - Reset LEQ + DFE to a baseline.
+ *
+ * @sds: Reference to SerDes instance
+ *
+ * Reset both LEQ and DFE in the RX path to baseline configuration. I.e.
+ * sets LEQ and DFE to manual mode and sets certain values (mostly 0) for
+ * LEQ and DFE coefficients/parameters.
+ *
+ * LEQ and DFE can run in two modes:
+ * * manual: specific values are set and used
+ * * auto: both adapt their parameters automatically
+ *
+ */
+static int rtpcs_931x_sds_reset_leq_dfe(struct rtpcs_serdes *sds)
 {
        rtpcs_sds_write_bits(sds, 0x2e, 0xd, 6, 0, 0x0);        /* [6:2] LEQ gain */
        rtpcs_sds_write_bits(sds, 0x2e, 0xd, 7, 7, 0x1);        /* LEQ manual 1=true,0=false */
@@ -3421,7 +3435,7 @@ static int rtpcs_931x_sds_set_port_media(struct rtpcs_serdes *sds,
        /* from _phy_rtl9310_sds_init, DMS1250 SDK */
        rtpcs_sds_write_bits(sds, 0x2e, 0xe, 13, 11, 0x0);
        rtpcs_931x_sds_rx_reset(sds);
-       rtpcs_931x_sds_init_leq_dfe(sds);
+       rtpcs_931x_sds_reset_leq_dfe(sds);
 
        is_dac = (port_media == RTPCS_PORT_MEDIA_DAC_50CM ||
                  port_media == RTPCS_PORT_MEDIA_DAC_100CM ||
@@ -3549,7 +3563,7 @@ static int rtpcs_931x_sds_config_hw_mode(struct rtpcs_serdes *sds,
        case RTPCS_SDS_MODE_USXGMII_2_5GSXGMII:
                u32 op_code = 0x6003;
 
-               rtpcs_931x_sds_init_leq_dfe(sds);
+               rtpcs_931x_sds_reset_leq_dfe(sds);
                rtpcs_931x_sds_rx_reset(sds);
 
                rtpcs_sds_write(sds, 0x7, 0x10, op_code);