]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: pcs: introduce per-variant SerDes activate helpers
authorJonas Jelonek <jelonek.jonas@gmail.com>
Wed, 22 Apr 2026 13:44:06 +0000 (13:44 +0000)
committerJonas Jelonek <jelonek.jonas@gmail.com>
Tue, 26 May 2026 06:37:59 +0000 (08:37 +0200)
Mirror of the previous sds_deactivate commit: add rtpcs_{838x,931x}_sds_activate()
helpers that each wrap the variant-specific "bring the SerDes back to operational"
block-power call at the end of setup_serdes, and replace the inline call.

 - 838x: wraps rtpcs_838x_sds_power(sds, true)
 - 931x: wraps rtpcs_931x_sds_power(sds, true)

RTL839x and RTL930x are intentionally not given an activate helper in this
commit:

 - RTL839x calls rtpcs_839x_sds_reset() at the end of setup_serdes. That is
   a reset pulse whose internals (per-type 10G/5G analog sequences, internal
   REG3 0x7146 -> 0x7106 dance) are not yet fully characterized. Aliasing
   it as _activate would misrepresent the function.
 - RTL930x has no separate activation step: rtpcs_930x_sds_set_mode(sds,
   hw_mode) is what commits the new mode and is intended to be surfaced
   as its own "set mode" phase in a later commit rather than hidden inside
   a variant-specific _activate wrapper.

Both variants will be revisited when their respective phases are clarified.
This commit is a pure refactor, no behavioural change.

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

index d1850001a67db3177da752106f73819c28280edd..b19be93d2ace8bbb19dd9a280c6a4becdaa57a48 100644 (file)
@@ -826,6 +826,11 @@ static int rtpcs_838x_sds_deactivate(struct rtpcs_serdes *sds)
        return rtpcs_838x_sds_power(sds, false);
 }
 
+static int rtpcs_838x_sds_activate(struct rtpcs_serdes *sds)
+{
+       return rtpcs_838x_sds_power(sds, true);
+}
+
 /*
  * RTL838X wrapper: after setting the MAC mode, SerDes 4-5 also need the
  * companion INT_MODE_CTRL field written.
@@ -953,7 +958,7 @@ static int rtpcs_838x_setup_serdes(struct rtpcs_serdes *sds,
        /* release reset */
        rtpcs_sds_write(sds, 0, 3, 0x7106);
 
-       rtpcs_838x_sds_power(sds, true);
+       rtpcs_838x_sds_activate(sds);
 
        /*
         * Run a switch queue reset after the first start of a SerDes. This recovers ports that
@@ -3258,6 +3263,11 @@ static int rtpcs_931x_sds_deactivate(struct rtpcs_serdes *sds)
        return rtpcs_931x_sds_set_mode(sds, RTPCS_SDS_MODE_OFF);
 }
 
+static int rtpcs_931x_sds_activate(struct rtpcs_serdes *sds)
+{
+       return rtpcs_931x_sds_power(sds, true);
+}
+
 static void rtpcs_931x_sds_reset(struct rtpcs_serdes *sds)
 {
        u32 o_mode, f_bit;
@@ -3832,7 +3842,7 @@ static int rtpcs_931x_setup_serdes(struct rtpcs_serdes *sds,
                return ret;
        }
 
-       rtpcs_931x_sds_power(sds, true);
+       rtpcs_931x_sds_activate(sds);
 
        ret = rtpcs_931x_sds_set_mode(sds, hw_mode);
        if (ret < 0)