diff options
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 078ad0ec8593..b418f9437bf0 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
@@ -286,10 +286,25 @@ bool stmmac_eee_init(struct stmmac_priv *priv) | |||
286 | 286 | ||
287 | /* MAC core supports the EEE feature. */ | 287 | /* MAC core supports the EEE feature. */ |
288 | if (priv->dma_cap.eee) { | 288 | if (priv->dma_cap.eee) { |
289 | int tx_lpi_timer = priv->tx_lpi_timer; | ||
290 | |||
289 | /* Check if the PHY supports EEE */ | 291 | /* Check if the PHY supports EEE */ |
290 | if (phy_init_eee(priv->phydev, 1)) | 292 | if (phy_init_eee(priv->phydev, 1)) { |
293 | /* To manage at run-time if the EEE cannot be supported | ||
294 | * anymore (for example because the lp caps have been | ||
295 | * changed). | ||
296 | * In that case the driver disable own timers. | ||
297 | */ | ||
298 | if (priv->eee_active) { | ||
299 | pr_debug("stmmac: disable EEE\n"); | ||
300 | del_timer_sync(&priv->eee_ctrl_timer); | ||
301 | priv->hw->mac->set_eee_timer(priv->ioaddr, 0, | ||
302 | tx_lpi_timer); | ||
303 | } | ||
304 | priv->eee_active = 0; | ||
291 | goto out; | 305 | goto out; |
292 | 306 | } | |
307 | /* Activate the EEE and start timers */ | ||
293 | if (!priv->eee_active) { | 308 | if (!priv->eee_active) { |
294 | priv->eee_active = 1; | 309 | priv->eee_active = 1; |
295 | init_timer(&priv->eee_ctrl_timer); | 310 | init_timer(&priv->eee_ctrl_timer); |
@@ -300,13 +315,13 @@ bool stmmac_eee_init(struct stmmac_priv *priv) | |||
300 | 315 | ||
301 | priv->hw->mac->set_eee_timer(priv->ioaddr, | 316 | priv->hw->mac->set_eee_timer(priv->ioaddr, |
302 | STMMAC_DEFAULT_LIT_LS, | 317 | STMMAC_DEFAULT_LIT_LS, |
303 | priv->tx_lpi_timer); | 318 | tx_lpi_timer); |
304 | } else | 319 | } else |
305 | /* Set HW EEE according to the speed */ | 320 | /* Set HW EEE according to the speed */ |
306 | priv->hw->mac->set_eee_pls(priv->ioaddr, | 321 | priv->hw->mac->set_eee_pls(priv->ioaddr, |
307 | priv->phydev->link); | 322 | priv->phydev->link); |
308 | 323 | ||
309 | pr_info("stmmac: Energy-Efficient Ethernet initialized\n"); | 324 | pr_debug("stmmac: Energy-Efficient Ethernet initialized\n"); |
310 | 325 | ||
311 | ret = true; | 326 | ret = true; |
312 | } | 327 | } |