]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: pcs: select OFF mode with no links on SerDes
authorJonas Jelonek <jelonek.jonas@gmail.com>
Fri, 2 Jan 2026 18:50:10 +0000 (18:50 +0000)
committerHauke Mehrtens <hauke@hauke-m.de>
Sat, 3 Jan 2026 15:59:48 +0000 (16:59 +0100)
Because the PCS driver keeps track of the number of registered links for
each SerDes now, we now know when there is no link on a SerDes. In this
case, determine to turn off the SerDes in the mode mapper.

Though the phylink subsystem shouldn't attempt to config something
different when no link/port references a Serdes, be on the safe side.

Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21365
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c

index bd19bd5fb23f7c5c899f1b308b8cab77273d85e5..06647938d26e1721c409d50940038898969bfa3e 100644 (file)
@@ -287,6 +287,12 @@ static int rtpcs_sds_determine_hw_mode(struct rtpcs_serdes *sds,
 {
        u8 n_links = sds->num_of_links;
 
+       /* turn off SerDes when there are no links */
+       if (!n_links) {
+               *hw_mode = RTPCS_SDS_MODE_OFF;
+               return 0;
+       }
+
        switch (if_mode) {
        case PHY_INTERFACE_MODE_NA:
                *hw_mode = RTPCS_SDS_MODE_OFF;