]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: pcs: rtl93xx: handle XSGMII autoneg
authorJonas Jelonek <jelonek.jonas@gmail.com>
Mon, 26 Jan 2026 23:20:26 +0000 (23:20 +0000)
committerHauke Mehrtens <hauke@hauke-m.de>
Wed, 4 Feb 2026 00:08:25 +0000 (01:08 +0100)
The XSGMII mode is special in several regards. The inband
autonegotiation for this mode is called 'XSG N-way'. It is controlled
using different bits and location, and using XSG operations.

Add support for this by enhancing the set_autoneg implementation shared
by RTL930x and RTL931x. This can stay shared since it works the same for
both variants.

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

index 234e324c3eeb851fdb1b10c5ca40c760030b5e0f..a9c84b46879f90f657bfd4eb407dc900a251a7fa 100644 (file)
@@ -948,9 +948,18 @@ static int rtpcs_839x_setup_serdes(struct rtpcs_serdes *sds,
 
 static int rtpcs_93xx_sds_set_autoneg(struct rtpcs_serdes *sds, unsigned int neg_mode)
 {
-       u16 bmcr = neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED ? BMCR_ANENABLE : 0;
+       u16 bmcr, en_val;
 
-       return rtpcs_sds_modify(sds, 2, MII_BMCR, BMCR_ANENABLE, bmcr);
+       switch (sds->hw_mode) {
+       case RTPCS_SDS_MODE_XSGMII: /* XSG N-way state */
+               en_val = neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED ? 0x0 : 0x1;
+
+               return rtpcs_sds_xsg_write_bits(sds, 0x0, 0x2, 9, 8, en_val);
+       default:
+               bmcr = neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED ? BMCR_ANENABLE : 0;
+
+               return rtpcs_sds_modify(sds, 0x2, MII_BMCR, BMCR_ANENABLE, bmcr);
+       }
 }
 
 /* RTL930X */