@@ -2850,28 +2850,34 @@ mt7531_mac_config(struct dsa_switch *ds, int port, unsigned int mode,
2850
2850
}
2851
2851
2852
2852
static struct phylink_pcs *
2853
- mt753x_phylink_mac_select_pcs (struct dsa_switch * ds , int port ,
2853
+ mt753x_phylink_mac_select_pcs (struct phylink_config * config ,
2854
2854
phy_interface_t interface )
2855
2855
{
2856
- struct mt7530_priv * priv = ds -> priv ;
2856
+ struct dsa_port * dp = dsa_phylink_to_port (config );
2857
+ struct mt7530_priv * priv = dp -> ds -> priv ;
2857
2858
2858
2859
switch (interface ) {
2859
2860
case PHY_INTERFACE_MODE_TRGMII :
2860
- return & priv -> pcs [port ].pcs ;
2861
+ return & priv -> pcs [dp -> index ].pcs ;
2861
2862
case PHY_INTERFACE_MODE_SGMII :
2862
2863
case PHY_INTERFACE_MODE_1000BASEX :
2863
2864
case PHY_INTERFACE_MODE_2500BASEX :
2864
- return priv -> ports [port ].sgmii_pcs ;
2865
+ return priv -> ports [dp -> index ].sgmii_pcs ;
2865
2866
default :
2866
2867
return NULL ;
2867
2868
}
2868
2869
}
2869
2870
2870
2871
static void
2871
- mt753x_phylink_mac_config (struct dsa_switch * ds , int port , unsigned int mode ,
2872
+ mt753x_phylink_mac_config (struct phylink_config * config , unsigned int mode ,
2872
2873
const struct phylink_link_state * state )
2873
2874
{
2874
- struct mt7530_priv * priv = ds -> priv ;
2875
+ struct dsa_port * dp = dsa_phylink_to_port (config );
2876
+ struct dsa_switch * ds = dp -> ds ;
2877
+ struct mt7530_priv * priv ;
2878
+ int port = dp -> index ;
2879
+
2880
+ priv = ds -> priv ;
2875
2881
2876
2882
if ((port == 5 || port == 6 ) && priv -> info -> mac_port_config )
2877
2883
priv -> info -> mac_port_config (ds , port , mode , state -> interface );
@@ -2881,23 +2887,25 @@ mt753x_phylink_mac_config(struct dsa_switch *ds, int port, unsigned int mode,
2881
2887
mt7530_set (priv , MT7530_PMCR_P (port ), PMCR_EXT_PHY );
2882
2888
}
2883
2889
2884
- static void mt753x_phylink_mac_link_down (struct dsa_switch * ds , int port ,
2890
+ static void mt753x_phylink_mac_link_down (struct phylink_config * config ,
2885
2891
unsigned int mode ,
2886
2892
phy_interface_t interface )
2887
2893
{
2888
- struct mt7530_priv * priv = ds -> priv ;
2894
+ struct dsa_port * dp = dsa_phylink_to_port (config );
2895
+ struct mt7530_priv * priv = dp -> ds -> priv ;
2889
2896
2890
- mt7530_clear (priv , MT7530_PMCR_P (port ), PMCR_LINK_SETTINGS_MASK );
2897
+ mt7530_clear (priv , MT7530_PMCR_P (dp -> index ), PMCR_LINK_SETTINGS_MASK );
2891
2898
}
2892
2899
2893
- static void mt753x_phylink_mac_link_up (struct dsa_switch * ds , int port ,
2900
+ static void mt753x_phylink_mac_link_up (struct phylink_config * config ,
2901
+ struct phy_device * phydev ,
2894
2902
unsigned int mode ,
2895
2903
phy_interface_t interface ,
2896
- struct phy_device * phydev ,
2897
2904
int speed , int duplex ,
2898
2905
bool tx_pause , bool rx_pause )
2899
2906
{
2900
- struct mt7530_priv * priv = ds -> priv ;
2907
+ struct dsa_port * dp = dsa_phylink_to_port (config );
2908
+ struct mt7530_priv * priv = dp -> ds -> priv ;
2901
2909
u32 mcr ;
2902
2910
2903
2911
mcr = PMCR_RX_EN | PMCR_TX_EN | PMCR_FORCE_LNK ;
@@ -2932,7 +2940,7 @@ static void mt753x_phylink_mac_link_up(struct dsa_switch *ds, int port,
2932
2940
}
2933
2941
}
2934
2942
2935
- mt7530_set (priv , MT7530_PMCR_P (port ), mcr );
2943
+ mt7530_set (priv , MT7530_PMCR_P (dp -> index ), mcr );
2936
2944
}
2937
2945
2938
2946
static void mt753x_phylink_get_caps (struct dsa_switch * ds , int port ,
@@ -3152,16 +3160,19 @@ const struct dsa_switch_ops mt7530_switch_ops = {
3152
3160
.port_mirror_add = mt753x_port_mirror_add ,
3153
3161
.port_mirror_del = mt753x_port_mirror_del ,
3154
3162
.phylink_get_caps = mt753x_phylink_get_caps ,
3155
- .phylink_mac_select_pcs = mt753x_phylink_mac_select_pcs ,
3156
- .phylink_mac_config = mt753x_phylink_mac_config ,
3157
- .phylink_mac_link_down = mt753x_phylink_mac_link_down ,
3158
- .phylink_mac_link_up = mt753x_phylink_mac_link_up ,
3159
3163
.get_mac_eee = mt753x_get_mac_eee ,
3160
3164
.set_mac_eee = mt753x_set_mac_eee ,
3161
3165
.conduit_state_change = mt753x_conduit_state_change ,
3162
3166
};
3163
3167
EXPORT_SYMBOL_GPL (mt7530_switch_ops );
3164
3168
3169
+ static const struct phylink_mac_ops mt753x_phylink_mac_ops = {
3170
+ .mac_select_pcs = mt753x_phylink_mac_select_pcs ,
3171
+ .mac_config = mt753x_phylink_mac_config ,
3172
+ .mac_link_down = mt753x_phylink_mac_link_down ,
3173
+ .mac_link_up = mt753x_phylink_mac_link_up ,
3174
+ };
3175
+
3165
3176
const struct mt753x_info mt753x_table [] = {
3166
3177
[ID_MT7621 ] = {
3167
3178
.id = ID_MT7621 ,
@@ -3239,6 +3250,7 @@ mt7530_probe_common(struct mt7530_priv *priv)
3239
3250
priv -> dev = dev ;
3240
3251
priv -> ds -> priv = priv ;
3241
3252
priv -> ds -> ops = & mt7530_switch_ops ;
3253
+ priv -> ds -> phylink_mac_ops = & mt753x_phylink_mac_ops ;
3242
3254
mutex_init (& priv -> reg_mutex );
3243
3255
dev_set_drvdata (dev , priv );
3244
3256
0 commit comments