summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonas Jelonek2025-12-11 19:17:26 +0000
committerRobert Marko2025-12-16 12:38:13 +0000
commitd8b1a54c78f39ff7314d0237e2a463b3cf2b4b8c (patch)
treed889c042a4c27bc8d6dc3e27c798ee16d831f4b5
parent96c86b2ff12fabc018bda459db636d605ecd7aa7 (diff)
downloadopenwrt-d8b1a54c78f39ff7314d0237e2a463b3cf2b4b8c.tar.gz
realtek: pcs: add dedicated enum for SerDes modes
The Realtek SerDes mode capabilities do not map 1:1 to the PHY_INTERFACE_MODE_* modes used in the kernel and passed to the PCS. For example, some PHY chips use the proprietary XSGMII mode for which there isn't an equivalent in the kernel, or HSGMII. In the past, this led to problems and confusion using kernel's XGMII to handle the XSGMII mode, and needed a downstream patch for HSGMII. They have been solved/worked around for now, but XSGMII is currently not implemented at all. And who knows what might come in the future. To make our life easier, introduce a dedicated internal representation of SerDes modes which differs from kernel's PHY_INTERFACE_MODE_*. This allows us to map "external" modes to different internal modes as needed instead of carrying the PHY_INTERFACE_MODE_* through the whole SerDes configuration code. The PCS driver needs to map PHY_INTERFACE_MODE_* to RTPCS_SDS_MODE_* in pcs_config, and the latter should be used as the only one. Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com> Link: https://github.com/openwrt/openwrt/pull/21146 Signed-off-by: Robert Marko <robimarko@gmail.com> (cherry picked from commit a4d6e10bf2561a39d9bb3c9e622531e8d5c9caf3)
-rw-r--r--target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c23
1 files changed, 23 insertions, 0 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 def6b445d4..1a87d0d112 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
@@ -102,6 +102,29 @@
#define RTL931X_PS_SERDES_OFF_MODE_CTRL_ADDR (0x13F4)
#define RTL931X_MAC_SERDES_MODE_CTRL(sds) (0x136C + (((sds) << 2)))
+enum rtpcs_sds_mode {
+ RTPCS_SDS_MODE_OFF = 0,
+
+ /* fiber modes */
+ RTPCS_SDS_MODE_1000BASEX,
+ RTPCS_SDS_MODE_2500BASEX,
+ RTPCS_SDS_MODE_10GBASER,
+
+ /* mii modes */
+ RTPCS_SDS_MODE_SGMII,
+ RTPCS_SDS_MODE_HISGMII,
+ RTPCS_SDS_MODE_QSGMII,
+ RTPCS_SDS_MODE_QHSGMII,
+ RTPCS_SDS_MODE_XSGMII,
+
+ RTPCS_SDS_MODE_USXGMII_10GSXGMII,
+ RTPCS_SDS_MODE_USXGMII_10GDXGMII,
+ RTPCS_SDS_MODE_USXGMII_10GQXGMII,
+ RTPCS_SDS_MODE_USXGMII_5GSXGMII,
+ RTPCS_SDS_MODE_USXGMII_5GDXGMII,
+ RTPCS_SDS_MODE_USXGMII_2_5GSXGMII,
+};
+
struct rtpcs_ctrl {
struct device *dev;
struct regmap *map;