[openwrt/openwrt] realtek: pcs: rtl931x: merge helper into mode setting

LEDE Commits lede-commits at lists.infradead.org
Mon Dec 29 08:06:27 PST 2025


robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/f67d9ed9b44b1838dd2cabbc48b228be5a8ff434

commit f67d9ed9b44b1838dd2cabbc48b228be5a8ff434
Author: Jonas Jelonek <jelonek.jonas at gmail.com>
AuthorDate: Sat Dec 20 20:40:12 2025 +0000

    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 <jelonek.jonas at gmail.com>
    Link: https://github.com/openwrt/openwrt/pull/20736
    Signed-off-by: Robert Marko <robimarko at gmail.com>
---
 .../linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c  | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

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 48b890114f..2c49d90531 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:




More information about the lede-commits mailing list