]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: pcs: rtl838x: drop redundant reset writes 23746/head
authorJonas Jelonek <jelonek.jonas@gmail.com>
Thu, 11 Jun 2026 22:05:16 +0000 (22:05 +0000)
committerJonas Jelonek <jelonek.jonas@gmail.com>
Fri, 12 Jun 2026 07:42:31 +0000 (09:42 +0200)
Sometimes redundancy is so obvious that one likely misses it. Trying to
bring all SerDes setup into a unified shape, one thinks twice if
something is really needed or not.

For the RTL838x case, the single writes for take/release reset were still
an outlier. Looking closer at them one can see that the same bits are all
covered already in deactivate/activate. So before, they have been put
into the desired state but those outlier writes mess with them again.

[0, 3, 0x7146/0x7106] just deals with the SOFT_RST bit that is already
covered by rtpcs_838x_sds_reset.

[0, 0, 0xc00] touches multiple bits, amongst the EN_RX/EN_TX bits
already covered in deactivate/active. Moreover, it potentially forces
other bits into a state causing broken functionality, e.g.
INV_HSI/INV_HSO which deal with the polarity. This has no effect right
no right now but might be a latent issue in the future.

Also move the reset call down to the end of the function, doing a
soft/RX reset after every configuration is done. This is likely what the
SDK also intended, and mirrors the 839x behavior.

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

index a30cd68a35950d2196b2fb19ab7b41cea5a06662..aa49a85a5e2ca460fafd6b96ce193a1c164af532 100644 (file)
@@ -890,12 +890,7 @@ static int rtpcs_838x_setup_serdes(struct rtpcs_serdes *sds,
 
        rtpcs_838x_sds_deactivate(sds);
 
-       /* take reset */
-       rtpcs_sds_write(sds, 0x0, 0x0, 0xc00);
-       rtpcs_sds_write(sds, 0x0, 0x3, 0x7146);
-
        rtpcs_838x_sds_patch(sds, hw_mode);
-       rtpcs_838x_sds_reset(sds);
 
        ret = rtpcs_838x_sds_set_mode(sds, hw_mode);
        if (ret)
@@ -903,8 +898,7 @@ static int rtpcs_838x_setup_serdes(struct rtpcs_serdes *sds,
 
        sds->hw_mode = hw_mode;
 
-       /* release reset */
-       rtpcs_sds_write(sds, 0, 3, 0x7106);
+       rtpcs_838x_sds_reset(sds);
 
        rtpcs_838x_sds_activate(sds);