netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH (net.git) 1/2 (v2)] stmmac: disable at run-time the EEE if not supported
@ 2013-08-21  5:28 Giuseppe CAVALLARO
  2013-08-21  5:28 ` [PATCH (net.git) 2/2] stmmac: remove useless csum flag Giuseppe CAVALLARO
  0 siblings, 1 reply; 5+ messages in thread
From: Giuseppe CAVALLARO @ 2013-08-21  5:28 UTC (permalink / raw)
  To: netdev; +Cc: Giuseppe Cavallaro

This patch is to disable the EEE (so HW and timers)
for example when the phy communicates that the EEE
can be supported nomore.

v2: clean the patch removing an useless change

Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
---
 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 0a9bb9d..45ca081 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -285,10 +285,25 @@ bool stmmac_eee_init(struct stmmac_priv *priv)
 
 	/* MAC core supports the EEE feature. */
 	if (priv->dma_cap.eee) {
+		int tx_lpi_timer = priv->tx_lpi_timer;
+
 		/* Check if the PHY supports EEE */
-		if (phy_init_eee(priv->phydev, 1))
+		if (phy_init_eee(priv->phydev, 1)) {
+			/* To manage at run-time if the EEE cannot be supported
+			 * anymore (for example becasue the lp caps have been
+			 * changed).
+			 * In that case the driver disable own timers.
+			 */
+			if (priv->eee_active) {
+				pr_debug("stmmac: disable EEE\n");
+				del_timer_sync(&priv->eee_ctrl_timer);
+				priv->hw->mac->set_eee_timer(priv->ioaddr, 0,
+							     tx_lpi_timer);
+			}
+			priv->eee_active = 0;
 			goto out;
-
+		}
+		/* Activate the EEE and start timers */
 		if (!priv->eee_active) {
 			priv->eee_active = 1;
 			init_timer(&priv->eee_ctrl_timer);
@@ -299,13 +314,13 @@ bool stmmac_eee_init(struct stmmac_priv *priv)
 
 			priv->hw->mac->set_eee_timer(priv->ioaddr,
 						     STMMAC_DEFAULT_LIT_LS,
-						     priv->tx_lpi_timer);
+						     tx_lpi_timer);
 		} else
 			/* Set HW EEE according to the speed */
 			priv->hw->mac->set_eee_pls(priv->ioaddr,
 						   priv->phydev->link);
 
-		pr_info("stmmac: Energy-Efficient Ethernet initialized\n");
+		pr_debug("stmmac: Energy-Efficient Ethernet initialized\n");
 
 		ret = true;
 	}
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-08-22  3:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-21  5:28 [PATCH (net.git) 1/2 (v2)] stmmac: disable at run-time the EEE if not supported Giuseppe CAVALLARO
2013-08-21  5:28 ` [PATCH (net.git) 2/2] stmmac: remove useless csum flag Giuseppe CAVALLARO
2013-08-21  7:06   ` David Miller
2013-08-21  7:11     ` [net-next.git] " Giuseppe CAVALLARO
2013-08-22  3:38       ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).