mirror of
https://git.openwrt.org/openwrt/openwrt.git
synced 2026-01-28 03:37:17 +01:00
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>
This commit is contained in:
parent
1912f45b48
commit
0f176ef961
1 changed files with 37 additions and 0 deletions
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue