@@ -564,6 +564,25 @@ static bool mtk_check_gmac23_idle(struct mtk_mac *mac)
564564 return false;
565565}
566566
567+ static struct phylink_pcs * mtk_mac_select_pcs (struct phylink_config * config ,
568+ phy_interface_t interface )
569+ {
570+ struct mtk_mac * mac = container_of (config , struct mtk_mac ,
571+ phylink_config );
572+ struct mtk_eth * eth = mac -> hw ;
573+ unsigned int sid ;
574+
575+ if (interface == PHY_INTERFACE_MODE_SGMII ||
576+ phy_interface_mode_is_8023z (interface )) {
577+ sid = (MTK_HAS_CAPS (eth -> soc -> caps , MTK_SHARED_SGMII )) ?
578+ 0 : mac -> id ;
579+
580+ return eth -> sgmii_pcs [sid ];
581+ }
582+
583+ return NULL ;
584+ }
585+
567586static int mtk_mac_prepare (struct phylink_config * config , unsigned int mode ,
568587 phy_interface_t iface )
569588{
@@ -1058,6 +1077,7 @@ static int mtk_mac_enable_tx_lpi(struct phylink_config *config, u32 timer,
10581077
10591078static const struct phylink_mac_ops mtk_phylink_ops = {
10601079 .mac_prepare = mtk_mac_prepare ,
1080+ .mac_select_pcs = mtk_mac_select_pcs ,
10611081 .mac_config = mtk_mac_config ,
10621082 .mac_finish = mtk_mac_finish ,
10631083 .mac_link_down = mtk_mac_link_down ,
@@ -5742,11 +5762,11 @@ static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np)
57425762 mac -> phylink_config .available_pcs = mac -> available_pcs ;
57435763 mac -> phylink_config .num_available_pcs = count ;
57445764 } else {
5745- sid = (MTK_HAS_CAPS (eth -> soc -> caps , MTK_SHARED_SGMII )) ?
5765+ /* sid = (MTK_HAS_CAPS(eth->soc->caps, MTK_SHARED_SGMII)) ?
57465766 0 : id;
57475767
57485768 mac->phylink_config.available_pcs = ð->sgmii_pcs[sid];
5749- mac -> phylink_config .num_available_pcs = 1 ;
5769+ mac->phylink_config.num_available_pcs = 1;*/
57505770 }
57515771
57525772 phy_interface_or (mac -> phylink_config .supported_interfaces ,
0 commit comments