realtek: pcs: rtl931x: merge helper into mode setting
authorJonas Jelonek <jelonek.jonas@gmail.com>
Sat, 20 Dec 2025 20:40:12 +0000 (20:40 +0000)
committerRobert Marko <robimarko@gmail.com>
Mon, 29 Dec 2025 16:06:19 +0000 (17:06 +0100)
Merge the 'rtpcs_931x_sds_disable' helper into the MII mode setting and
use that instead. The helper was essentially doing same just with a
value for OFF state.

Moreover, the name of the helper was confusing. It implied it disables
the whole SerDes. However, this is used in Fiber mode setting and thus,
cannot completely disable the SerDes.

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

index 48b890114f9439109744e8fe7b36ce1eacb64b60..2c49d9053115e67d583317d5d87678160124e54b 100644 (file)
@@ -2384,6 +2384,9 @@ static void rtpcs_931x_sds_mii_mode_set(struct rtpcs_serdes *sds,
        int shift = ((sds->id & 0x3) << 3);
 
        switch (mode) {
+       case PHY_INTERFACE_MODE_NA:
+               val = 0x1f;
+               break;
        case PHY_INTERFACE_MODE_QSGMII:
                val = 0x6;
                break;
@@ -2407,12 +2410,6 @@ static void rtpcs_931x_sds_mii_mode_set(struct rtpcs_serdes *sds,
                          0xff << shift, val << shift);
 }
 
-static void rtpcs_931x_sds_disable(struct rtpcs_serdes *sds)
-{
-       regmap_write(sds->ctrl->map,
-                    RTL931X_SERDES_MODE_CTRL + (sds->id >> 2) * 4, 0x9f);
-}
-
 static void rtpcs_931x_sds_fiber_mode_set(struct rtpcs_serdes *sds,
                                          phy_interface_t mode)
 {
@@ -2420,8 +2417,7 @@ static void rtpcs_931x_sds_fiber_mode_set(struct rtpcs_serdes *sds,
 
        /* clear symbol error count before changing mode */
        rtpcs_931x_sds_clear_symerr(sds, mode);
-
-       rtpcs_931x_sds_disable(sds);
+       rtpcs_931x_sds_mii_mode_set(sds, PHY_INTERFACE_MODE_NA);
 
        switch (mode) {
        case PHY_INTERFACE_MODE_SGMII: