diff options
| author | Jonas Jelonek | 2025-12-19 10:11:06 +0000 |
|---|---|---|
| committer | Hauke Mehrtens | 2025-12-23 17:53:33 +0000 |
| commit | 0f176ef961585d28100ed98011eec9918aba3e51 (patch) | |
| tree | 6bc766d8f49ca138ebd6079be18375e9283749f3 | |
| parent | 1912f45b485d1dec0bc2781914f789bedd890c67 (diff) | |
| download | openwrt-0f176ef961585d28100ed98011eec9918aba3e51.tar.gz | |
realtek: pcs: add mapping for SerDes hardware mode
Add a generic mapper for mapping the PHY_INTERFACE_MODE_* modes to the
SerDes hardware modes RTPCS_SDS_MODE_*. This is to be used by all
subtargets step-by-step and avoids having subtarget-specific code for
that simple mapping.
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21184
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
| -rw-r--r-- | target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c | 37 |
1 files changed, 37 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 cdc18c0505..61f7339533 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 @@ -278,6 +278,43 @@ static struct rtpcs_link *rtpcs_phylink_pcs_to_link(struct phylink_pcs *pcs) return container_of(pcs, struct rtpcs_link, pcs); } +__maybe_unused +static int rtpcs_sds_determine_hw_mode(struct rtpcs_serdes *sds, + phy_interface_t if_mode, + enum rtpcs_sds_mode *hw_mode) +{ + switch (if_mode) { + case PHY_INTERFACE_MODE_NA: + *hw_mode = RTPCS_SDS_MODE_OFF; + break; + case PHY_INTERFACE_MODE_1000BASEX: + *hw_mode = RTPCS_SDS_MODE_1000BASEX; + break; + case PHY_INTERFACE_MODE_2500BASEX: + *hw_mode = RTPCS_SDS_MODE_2500BASEX; + break; + case PHY_INTERFACE_MODE_10GBASER: + *hw_mode = RTPCS_SDS_MODE_10GBASER; + break; + case PHY_INTERFACE_MODE_SGMII: + *hw_mode = RTPCS_SDS_MODE_SGMII; + break; + case PHY_INTERFACE_MODE_QSGMII: + *hw_mode = RTPCS_SDS_MODE_QSGMII; + break; + case PHY_INTERFACE_MODE_USXGMII: + /* TODO: set this depending on number of links on SerDes */ + *hw_mode = RTPCS_SDS_MODE_USXGMII_10GSXGMII; + break; + default: + return -ENOTSUPP; + } + + /* TODO: check if the particular SerDes supports the mode */ + + return 0; +} + /* Variant-specific functions */ /* RTL838X */ |