@@ -790,24 +790,27 @@ static void mv88e6xxx_get_caps(struct dsa_switch *ds, int port,
790
790
}
791
791
}
792
792
793
- static struct phylink_pcs * mv88e6xxx_mac_select_pcs ( struct dsa_switch * ds ,
794
- int port ,
795
- phy_interface_t interface )
793
+ static struct phylink_pcs *
794
+ mv88e6xxx_mac_select_pcs ( struct phylink_config * config ,
795
+ phy_interface_t interface )
796
796
{
797
- struct mv88e6xxx_chip * chip = ds -> priv ;
797
+ struct dsa_port * dp = dsa_phylink_to_port (config );
798
+ struct mv88e6xxx_chip * chip = dp -> ds -> priv ;
798
799
struct phylink_pcs * pcs = ERR_PTR (- EOPNOTSUPP );
799
800
800
801
if (chip -> info -> ops -> pcs_ops )
801
- pcs = chip -> info -> ops -> pcs_ops -> pcs_select (chip , port ,
802
+ pcs = chip -> info -> ops -> pcs_ops -> pcs_select (chip , dp -> index ,
802
803
interface );
803
804
804
805
return pcs ;
805
806
}
806
807
807
- static int mv88e6xxx_mac_prepare (struct dsa_switch * ds , int port ,
808
+ static int mv88e6xxx_mac_prepare (struct phylink_config * config ,
808
809
unsigned int mode , phy_interface_t interface )
809
810
{
810
- struct mv88e6xxx_chip * chip = ds -> priv ;
811
+ struct dsa_port * dp = dsa_phylink_to_port (config );
812
+ struct mv88e6xxx_chip * chip = dp -> ds -> priv ;
813
+ int port = dp -> index ;
811
814
int err = 0 ;
812
815
813
816
/* In inband mode, the link may come up at any time while the link
@@ -826,11 +829,13 @@ static int mv88e6xxx_mac_prepare(struct dsa_switch *ds, int port,
826
829
return err ;
827
830
}
828
831
829
- static void mv88e6xxx_mac_config (struct dsa_switch * ds , int port ,
832
+ static void mv88e6xxx_mac_config (struct phylink_config * config ,
830
833
unsigned int mode ,
831
834
const struct phylink_link_state * state )
832
835
{
833
- struct mv88e6xxx_chip * chip = ds -> priv ;
836
+ struct dsa_port * dp = dsa_phylink_to_port (config );
837
+ struct mv88e6xxx_chip * chip = dp -> ds -> priv ;
838
+ int port = dp -> index ;
834
839
int err = 0 ;
835
840
836
841
mv88e6xxx_reg_lock (chip );
@@ -846,13 +851,15 @@ static void mv88e6xxx_mac_config(struct dsa_switch *ds, int port,
846
851
mv88e6xxx_reg_unlock (chip );
847
852
848
853
if (err && err != - EOPNOTSUPP )
849
- dev_err (ds -> dev , "p%d: failed to configure MAC/PCS\n" , port );
854
+ dev_err (chip -> dev , "p%d: failed to configure MAC/PCS\n" , port );
850
855
}
851
856
852
- static int mv88e6xxx_mac_finish (struct dsa_switch * ds , int port ,
857
+ static int mv88e6xxx_mac_finish (struct phylink_config * config ,
853
858
unsigned int mode , phy_interface_t interface )
854
859
{
855
- struct mv88e6xxx_chip * chip = ds -> priv ;
860
+ struct dsa_port * dp = dsa_phylink_to_port (config );
861
+ struct mv88e6xxx_chip * chip = dp -> ds -> priv ;
862
+ int port = dp -> index ;
856
863
int err = 0 ;
857
864
858
865
/* Undo the forced down state above after completing configuration
@@ -876,12 +883,14 @@ static int mv88e6xxx_mac_finish(struct dsa_switch *ds, int port,
876
883
return err ;
877
884
}
878
885
879
- static void mv88e6xxx_mac_link_down (struct dsa_switch * ds , int port ,
886
+ static void mv88e6xxx_mac_link_down (struct phylink_config * config ,
880
887
unsigned int mode ,
881
888
phy_interface_t interface )
882
889
{
883
- struct mv88e6xxx_chip * chip = ds -> priv ;
890
+ struct dsa_port * dp = dsa_phylink_to_port (config );
891
+ struct mv88e6xxx_chip * chip = dp -> ds -> priv ;
884
892
const struct mv88e6xxx_ops * ops ;
893
+ int port = dp -> index ;
885
894
int err = 0 ;
886
895
887
896
ops = chip -> info -> ops ;
@@ -904,14 +913,16 @@ static void mv88e6xxx_mac_link_down(struct dsa_switch *ds, int port,
904
913
"p%d: failed to force MAC link down\n" , port );
905
914
}
906
915
907
- static void mv88e6xxx_mac_link_up (struct dsa_switch * ds , int port ,
908
- unsigned int mode , phy_interface_t interface ,
916
+ static void mv88e6xxx_mac_link_up (struct phylink_config * config ,
909
917
struct phy_device * phydev ,
918
+ unsigned int mode , phy_interface_t interface ,
910
919
int speed , int duplex ,
911
920
bool tx_pause , bool rx_pause )
912
921
{
913
- struct mv88e6xxx_chip * chip = ds -> priv ;
922
+ struct dsa_port * dp = dsa_phylink_to_port (config );
923
+ struct mv88e6xxx_chip * chip = dp -> ds -> priv ;
914
924
const struct mv88e6xxx_ops * ops ;
925
+ int port = dp -> index ;
915
926
int err = 0 ;
916
927
917
928
ops = chip -> info -> ops ;
@@ -937,7 +948,7 @@ static void mv88e6xxx_mac_link_up(struct dsa_switch *ds, int port,
937
948
mv88e6xxx_reg_unlock (chip );
938
949
939
950
if (err && err != - EOPNOTSUPP )
940
- dev_err (ds -> dev ,
951
+ dev_err (chip -> dev ,
941
952
"p%d: failed to configure MAC link up\n" , port );
942
953
}
943
954
@@ -6922,6 +6933,15 @@ static int mv88e6xxx_crosschip_lag_leave(struct dsa_switch *ds, int sw_index,
6922
6933
return err_sync ? : err_pvt ;
6923
6934
}
6924
6935
6936
+ static const struct phylink_mac_ops mv88e6xxx_phylink_mac_ops = {
6937
+ .mac_select_pcs = mv88e6xxx_mac_select_pcs ,
6938
+ .mac_prepare = mv88e6xxx_mac_prepare ,
6939
+ .mac_config = mv88e6xxx_mac_config ,
6940
+ .mac_finish = mv88e6xxx_mac_finish ,
6941
+ .mac_link_down = mv88e6xxx_mac_link_down ,
6942
+ .mac_link_up = mv88e6xxx_mac_link_up ,
6943
+ };
6944
+
6925
6945
static const struct dsa_switch_ops mv88e6xxx_switch_ops = {
6926
6946
.get_tag_protocol = mv88e6xxx_get_tag_protocol ,
6927
6947
.change_tag_protocol = mv88e6xxx_change_tag_protocol ,
@@ -6930,12 +6950,6 @@ static const struct dsa_switch_ops mv88e6xxx_switch_ops = {
6930
6950
.port_setup = mv88e6xxx_port_setup ,
6931
6951
.port_teardown = mv88e6xxx_port_teardown ,
6932
6952
.phylink_get_caps = mv88e6xxx_get_caps ,
6933
- .phylink_mac_select_pcs = mv88e6xxx_mac_select_pcs ,
6934
- .phylink_mac_prepare = mv88e6xxx_mac_prepare ,
6935
- .phylink_mac_config = mv88e6xxx_mac_config ,
6936
- .phylink_mac_finish = mv88e6xxx_mac_finish ,
6937
- .phylink_mac_link_down = mv88e6xxx_mac_link_down ,
6938
- .phylink_mac_link_up = mv88e6xxx_mac_link_up ,
6939
6953
.get_strings = mv88e6xxx_get_strings ,
6940
6954
.get_ethtool_stats = mv88e6xxx_get_ethtool_stats ,
6941
6955
.get_eth_mac_stats = mv88e6xxx_get_eth_mac_stats ,
@@ -7004,6 +7018,7 @@ static int mv88e6xxx_register_switch(struct mv88e6xxx_chip *chip)
7004
7018
ds -> priv = chip ;
7005
7019
ds -> dev = dev ;
7006
7020
ds -> ops = & mv88e6xxx_switch_ops ;
7021
+ ds -> phylink_mac_ops = & mv88e6xxx_phylink_mac_ops ;
7007
7022
ds -> ageing_time_min = chip -> info -> age_time_coeff ;
7008
7023
ds -> ageing_time_max = chip -> info -> age_time_coeff * U8_MAX ;
7009
7024
0 commit comments