From: Jonas Jelonek Date: Sat, 20 Dec 2025 20:40:12 +0000 (+0000) Subject: realtek: pcs: rtl931x: merge helper into mode setting X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f67d9ed9b44b1838dd2cabbc48b228be5a8ff434;p=thirdparty%2Fopenwrt.git realtek: pcs: rtl931x: merge helper into mode setting 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 Link: https://github.com/openwrt/openwrt/pull/20736 Signed-off-by: Robert Marko --- diff --git a/target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c b/target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c index 48b890114f9..2c49d905311 100644 --- a/target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c +++ b/target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c @@ -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: