@@ -873,15 +873,40 @@ static void stmmac_mac_pcs_get_state(struct phylink_config *config,
873
873
874
874
static void stmmac_mac_config (struct phylink_config * config , unsigned int mode ,
875
875
const struct phylink_link_state * state )
876
+ {
877
+ /* Nothing for now. */
878
+ }
879
+
880
+ static void stmmac_mac_an_restart (struct phylink_config * config )
881
+ {
882
+ /* Not Supported */
883
+ }
884
+
885
+ static void stmmac_mac_link_down (struct phylink_config * config ,
886
+ unsigned int mode , phy_interface_t interface )
887
+ {
888
+ struct stmmac_priv * priv = netdev_priv (to_net_dev (config -> dev ));
889
+
890
+ stmmac_mac_set (priv , priv -> ioaddr , false);
891
+ priv -> eee_active = false;
892
+ stmmac_eee_init (priv );
893
+ stmmac_set_eee_pls (priv , priv -> hw , false);
894
+ }
895
+
896
+ static void stmmac_mac_link_up (struct phylink_config * config ,
897
+ struct phy_device * phy ,
898
+ unsigned int mode , phy_interface_t interface ,
899
+ int speed , int duplex ,
900
+ bool tx_pause , bool rx_pause )
876
901
{
877
902
struct stmmac_priv * priv = netdev_priv (to_net_dev (config -> dev ));
878
903
u32 ctrl ;
879
904
880
905
ctrl = readl (priv -> ioaddr + MAC_CTRL_REG );
881
906
ctrl &= ~priv -> hw -> link .speed_mask ;
882
907
883
- if (state -> interface == PHY_INTERFACE_MODE_USXGMII ) {
884
- switch (state -> speed ) {
908
+ if (interface == PHY_INTERFACE_MODE_USXGMII ) {
909
+ switch (speed ) {
885
910
case SPEED_10000 :
886
911
ctrl |= priv -> hw -> link .xgmii .speed10000 ;
887
912
break ;
@@ -895,7 +920,7 @@ static void stmmac_mac_config(struct phylink_config *config, unsigned int mode,
895
920
return ;
896
921
}
897
922
} else {
898
- switch (state -> speed ) {
923
+ switch (speed ) {
899
924
case SPEED_2500 :
900
925
ctrl |= priv -> hw -> link .speed2500 ;
901
926
break ;
@@ -913,46 +938,21 @@ static void stmmac_mac_config(struct phylink_config *config, unsigned int mode,
913
938
}
914
939
}
915
940
916
- priv -> speed = state -> speed ;
941
+ priv -> speed = speed ;
917
942
918
943
if (priv -> plat -> fix_mac_speed )
919
- priv -> plat -> fix_mac_speed (priv -> plat -> bsp_priv , state -> speed );
944
+ priv -> plat -> fix_mac_speed (priv -> plat -> bsp_priv , speed );
920
945
921
- if (!state -> duplex )
946
+ if (!duplex )
922
947
ctrl &= ~priv -> hw -> link .duplex ;
923
948
else
924
949
ctrl |= priv -> hw -> link .duplex ;
925
950
926
951
/* Flow Control operation */
927
- if (state -> pause )
928
- stmmac_mac_flow_ctrl (priv , state -> duplex );
952
+ if (tx_pause && rx_pause )
953
+ stmmac_mac_flow_ctrl (priv , duplex );
929
954
930
955
writel (ctrl , priv -> ioaddr + MAC_CTRL_REG );
931
- }
932
-
933
- static void stmmac_mac_an_restart (struct phylink_config * config )
934
- {
935
- /* Not Supported */
936
- }
937
-
938
- static void stmmac_mac_link_down (struct phylink_config * config ,
939
- unsigned int mode , phy_interface_t interface )
940
- {
941
- struct stmmac_priv * priv = netdev_priv (to_net_dev (config -> dev ));
942
-
943
- stmmac_mac_set (priv , priv -> ioaddr , false);
944
- priv -> eee_active = false;
945
- stmmac_eee_init (priv );
946
- stmmac_set_eee_pls (priv , priv -> hw , false);
947
- }
948
-
949
- static void stmmac_mac_link_up (struct phylink_config * config ,
950
- struct phy_device * phy ,
951
- unsigned int mode , phy_interface_t interface ,
952
- int speed , int duplex ,
953
- bool tx_pause , bool rx_pause )
954
- {
955
- struct stmmac_priv * priv = netdev_priv (to_net_dev (config -> dev ));
956
956
957
957
stmmac_mac_set (priv , priv -> ioaddr , true);
958
958
if (phy && priv -> dma_cap .eee ) {
0 commit comments