@@ -2966,7 +2966,7 @@ static int lan743x_phylink_2500basex_config(struct lan743x_adapter *adapter)
2966
2966
return lan743x_pcs_power_reset (adapter );
2967
2967
}
2968
2968
2969
- void lan743x_mac_eee_enable (struct lan743x_adapter * adapter , bool enable )
2969
+ static void lan743x_mac_eee_enable (struct lan743x_adapter * adapter , bool enable )
2970
2970
{
2971
2971
u32 mac_cr ;
2972
2972
@@ -3027,10 +3027,8 @@ static void lan743x_phylink_mac_link_down(struct phylink_config *config,
3027
3027
phy_interface_t interface )
3028
3028
{
3029
3029
struct net_device * netdev = to_net_dev (config -> dev );
3030
- struct lan743x_adapter * adapter = netdev_priv (netdev );
3031
3030
3032
3031
netif_tx_stop_all_queues (netdev );
3033
- lan743x_mac_eee_enable (adapter , false);
3034
3032
}
3035
3033
3036
3034
static void lan743x_phylink_mac_link_up (struct phylink_config * config ,
@@ -3072,16 +3070,40 @@ static void lan743x_phylink_mac_link_up(struct phylink_config *config,
3072
3070
cap & FLOW_CTRL_TX ,
3073
3071
cap & FLOW_CTRL_RX );
3074
3072
3075
- if (phydev )
3076
- lan743x_mac_eee_enable (adapter , phydev -> enable_tx_lpi );
3077
-
3078
3073
netif_tx_wake_all_queues (netdev );
3079
3074
}
3080
3075
3076
+ static void lan743x_mac_disable_tx_lpi (struct phylink_config * config )
3077
+ {
3078
+ struct net_device * netdev = to_net_dev (config -> dev );
3079
+ struct lan743x_adapter * adapter = netdev_priv (netdev );
3080
+
3081
+ lan743x_mac_eee_enable (adapter , false);
3082
+ }
3083
+
3084
+ static int lan743x_mac_enable_tx_lpi (struct phylink_config * config , u32 timer ,
3085
+ bool tx_clk_stop )
3086
+ {
3087
+ struct net_device * netdev = to_net_dev (config -> dev );
3088
+ struct lan743x_adapter * adapter = netdev_priv (netdev );
3089
+
3090
+ /* Software should only change this field when Energy Efficient
3091
+ * Ethernet Enable (EEEEN) is cleared. We ensure that by clearing
3092
+ * EEEEN during probe, and phylink itself guarantees that
3093
+ * mac_disable_tx_lpi() will have been previously called.
3094
+ */
3095
+ lan743x_csr_write (adapter , MAC_EEE_TX_LPI_REQ_DLY_CNT , timer );
3096
+ lan743x_mac_eee_enable (adapter , true);
3097
+
3098
+ return 0 ;
3099
+ }
3100
+
3081
3101
static const struct phylink_mac_ops lan743x_phylink_mac_ops = {
3082
3102
.mac_config = lan743x_phylink_mac_config ,
3083
3103
.mac_link_down = lan743x_phylink_mac_link_down ,
3084
3104
.mac_link_up = lan743x_phylink_mac_link_up ,
3105
+ .mac_disable_tx_lpi = lan743x_mac_disable_tx_lpi ,
3106
+ .mac_enable_tx_lpi = lan743x_mac_enable_tx_lpi ,
3085
3107
};
3086
3108
3087
3109
static int lan743x_phylink_create (struct lan743x_adapter * adapter )
@@ -3095,6 +3117,9 @@ static int lan743x_phylink_create(struct lan743x_adapter *adapter)
3095
3117
3096
3118
adapter -> phylink_config .mac_capabilities = MAC_ASYM_PAUSE |
3097
3119
MAC_SYM_PAUSE | MAC_10 | MAC_100 | MAC_1000FD ;
3120
+ adapter -> phylink_config .lpi_capabilities = MAC_100FD | MAC_1000FD ;
3121
+ adapter -> phylink_config .lpi_timer_default =
3122
+ lan743x_csr_read (adapter , MAC_EEE_TX_LPI_REQ_DLY_CNT );
3098
3123
3099
3124
lan743x_phy_interface_select (adapter );
3100
3125
@@ -3120,6 +3145,10 @@ static int lan743x_phylink_create(struct lan743x_adapter *adapter)
3120
3145
phy_interface_set_rgmii (adapter -> phylink_config .supported_interfaces );
3121
3146
}
3122
3147
3148
+ memcpy (adapter -> phylink_config .lpi_interfaces ,
3149
+ adapter -> phylink_config .supported_interfaces ,
3150
+ sizeof (adapter -> phylink_config .lpi_interfaces ));
3151
+
3123
3152
pl = phylink_create (& adapter -> phylink_config , NULL ,
3124
3153
adapter -> phy_interface , & lan743x_phylink_mac_ops );
3125
3154
@@ -3517,6 +3546,9 @@ static int lan743x_hardware_init(struct lan743x_adapter *adapter,
3517
3546
spin_lock_init (& tx -> ring_lock );
3518
3547
}
3519
3548
3549
+ /* Ensure EEEEN is clear */
3550
+ lan743x_mac_eee_enable (adapter , false);
3551
+
3520
3552
return 0 ;
3521
3553
}
3522
3554
0 commit comments