netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, Florian Fainelli <f.fainelli@gmail.com>
Subject: [PATCH net-next 3/6] net: dsa: bcm_sf2: disable RGMII interface(s) when link is down
Date: Wed, 24 Sep 2014 17:05:19 -0700	[thread overview]
Message-ID: <1411603522-8384-4-git-send-email-f.fainelli@gmail.com> (raw)
In-Reply-To: <1411603522-8384-1-git-send-email-f.fainelli@gmail.com>

When the link is down, disable the RGMII interface to conserve as much
power as possible. We re-enable the RGMII interface whenever the link is
detected.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/dsa/bcm_sf2.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index d9b7da545063..58b8fef25b96 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -506,6 +506,15 @@ static void bcm_sf2_sw_adjust_link(struct dsa_switch *ds, int port,
 		port_mode = EXT_REVMII;
 		break;
 	default:
+		/* All other PHYs: internal and MoCA */
+		goto force_link;
+	}
+
+	/* If the link is down, just disable the interface to conserve power */
+	if (!phydev->link) {
+		reg = reg_readl(priv, REG_RGMII_CNTRL_P(port));
+		reg &= ~RGMII_MODE_EN;
+		reg_writel(priv, reg, REG_RGMII_CNTRL_P(port));
 		goto force_link;
 	}
 
-- 
1.9.1

  parent reply	other threads:[~2014-09-25  0:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-25  0:05 [PATCH net-next 0/6] net: dsa: EEE and other PM features Florian Fainelli
2014-09-25  0:05 ` [PATCH net-next 1/6] net: dsa: start and stop the PHY state machine Florian Fainelli
2014-09-25  0:05 ` [PATCH net-next 2/6] net: dsa: allow enabling and disable switch ports Florian Fainelli
2014-09-25  0:05 ` Florian Fainelli [this message]
2014-09-25  0:05 ` [PATCH net-next 4/6] net: dsa: bcm_sf2: add port_enable/disable callbacks Florian Fainelli
2014-09-25  0:05 ` [PATCH net-next 5/6] net: dsa: allow switches driver to implement get/set EEE Florian Fainelli
2014-09-25  0:05 ` [PATCH net-next 6/6] net: dsa: bcm_sf2: add support for controlling EEE Florian Fainelli
2014-09-28 21:14 ` [PATCH net-next 0/6] net: dsa: EEE and other PM features David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1411603522-8384-4-git-send-email-f.fainelli@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).