]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: pcs: add macro for USXGMII AN opcode
authorJonas Jelonek <jelonek.jonas@gmail.com>
Fri, 19 Jun 2026 21:36:32 +0000 (21:36 +0000)
committerJonas Jelonek <jelonek.jonas@gmail.com>
Mon, 22 Jun 2026 11:02:06 +0000 (13:02 +0200)
Instead of hardcoding the USXGMII AN opcode values and potentially
losing track of what they actually mean, add a define for them. Actually
only one is used, however the other one gets a macro too for
documentation purpose.

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

index 2e5193069ee8ab3f895a0b2e21a0474d114bab8f..188028687329724c24ec4fdf79ec99b559c79459 100644 (file)
 #define RTPCS_SPEED_2500                       5
 #define RTPCS_SPEED_5000                       6
 
+/* USXGMII-AN opcodes. RTK variant unused but kept for documentation */
+#define RTPCS_USXGMII_AN_OPC_STD               0x03
+#define RTPCS_USXGMII_AN_OPC_RTK               0xaa
+
 #define RTPCS_838X_CPU_PORT                    28
 #define RTPCS_838X_SERDES_CNT                  6
 #define RTPCS_838X_MAC_LINK_DUP_STS            0xa19c
@@ -3015,8 +3019,8 @@ static int rtpcs_930x_sds_config_hw_mode(struct rtpcs_serdes *sds, enum rtpcs_sd
                        return ret;
 
                if (!is_xsgmii)
-                       /* opcode 0x03: standard/generic USXGMII mode */
-                       rtpcs_93xx_sds_usxgmii_config(sds, 0x03, 0xa4, 0, 1, 0x1);
+                       rtpcs_93xx_sds_usxgmii_config(sds, RTPCS_USXGMII_AN_OPC_STD,
+                                                     0xa4, 0, 1, 0x1);
                break;
 
        default:
@@ -3826,7 +3830,7 @@ static int rtpcs_931x_sds_config_hw_mode(struct rtpcs_serdes *sds,
                rtpcs_931x_sds_reset_leq_dfe(sds);
                rtpcs_931x_sds_rx_reset(sds);
 
-               rtpcs_93xx_sds_usxgmii_config(sds, 0x03, 0xa4, 0, 1, 0x1);
+               rtpcs_93xx_sds_usxgmii_config(sds, RTPCS_USXGMII_AN_OPC_STD, 0xa4, 0, 1, 0x1);
                break;
 
        case RTPCS_SDS_MODE_QSGMII: