]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: pcs: collapse DAC media types
authorJonas Jelonek <jelonek.jonas@gmail.com>
Fri, 27 Mar 2026 22:32:34 +0000 (23:32 +0100)
committerRobert Marko <robimarko@gmail.com>
Sun, 5 Apr 2026 09:27:06 +0000 (11:27 +0200)
So far we had separate media types for different DAC cable lengths,
equal to how the SDK defines them. However, this seems overengineered.
The types '_50CM' and '_100CM' are always treated equally, same for
'_300CM' and '_500CM'. Not only in the RTL931x code, but also the
RTL930x code usually just makes a distinction between short and long.
Thus, make that a bit cleaner by reducing the DAC type set to '_SHORT'
and '_LONG' with DAC cables < 3m being considered short and those with
>= 3m being considered as long.

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

index ee84b99ed0f89f859259a985d00839e83ff405bb..d1c43709be1d06140dce4cb1f1b1a38fa7de1489 100644 (file)
@@ -140,10 +140,8 @@ enum rtpcs_sds_media {
        RTPCS_SDS_MEDIA_FIBER_1G,
        RTPCS_SDS_MEDIA_FIBER_2_5G,
        RTPCS_SDS_MEDIA_FIBER_10G,
-       RTPCS_SDS_MEDIA_DAC_50CM,
-       RTPCS_SDS_MEDIA_DAC_100CM,
-       RTPCS_SDS_MEDIA_DAC_300CM,
-       RTPCS_SDS_MEDIA_DAC_500CM,
+       RTPCS_SDS_MEDIA_DAC_SHORT,      /*  < 3m */
+       RTPCS_SDS_MEDIA_DAC_LONG,       /* >= 3m */
 };
 
 enum rtpcs_sds_pll_type {
@@ -3537,10 +3535,8 @@ static int rtpcs_931x_sds_set_media(struct rtpcs_serdes *sds, enum rtpcs_sds_med
        rtpcs_931x_sds_rx_reset(sds);
        rtpcs_931x_sds_reset_leq_dfe(sds);
 
-       is_dac = (sds_media == RTPCS_SDS_MEDIA_DAC_50CM ||
-                 sds_media == RTPCS_SDS_MEDIA_DAC_100CM ||
-                 sds_media == RTPCS_SDS_MEDIA_DAC_300CM ||
-                 sds_media == RTPCS_SDS_MEDIA_DAC_500CM);
+       is_dac = (sds_media == RTPCS_SDS_MEDIA_DAC_SHORT ||
+                 sds_media == RTPCS_SDS_MEDIA_DAC_LONG);
        is_10g = is_dac || sds_media == RTPCS_SDS_MEDIA_FIBER_10G;
 
        if (sds_media != RTPCS_SDS_MEDIA_FIBER_100M) {
@@ -3550,15 +3546,13 @@ static int rtpcs_931x_sds_set_media(struct rtpcs_serdes *sds, enum rtpcs_sds_med
        }
 
        switch (sds_media) {
-       case RTPCS_SDS_MEDIA_DAC_50CM:
-       case RTPCS_SDS_MEDIA_DAC_100CM:
+       case RTPCS_SDS_MEDIA_DAC_SHORT:
                rtpcs_sds_write_bits(sds, 0x2e, 0x1, 15, 0, 0x1340);
                rtpcs_sds_write(sds, 0x21, 0x19, 0xf0a5); /* from XS1930-10 SDK */
                rtpcs_sds_write(even_sds, 0x2e, 0x8, 0x02a0); /* [10:7] impedance */
                break;
 
-       case RTPCS_SDS_MEDIA_DAC_300CM:
-       case RTPCS_SDS_MEDIA_DAC_500CM:
+       case RTPCS_SDS_MEDIA_DAC_LONG:
                rtpcs_sds_write_bits(sds, 0x2e, 0x1, 15, 0, 0x5200);
                rtpcs_sds_write(sds, 0x21, 0x19, 0xf0a5); /* from XS1930-10 SDK */
                rtpcs_sds_write(even_sds, 0x2e, 0x8, 0x02a0); /* [10:7] impedance */