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>, <sebastian.hesselbarth@gmail.com>,
	<sergei.shtylyov@cogentembedded.com>, <afleming@gmail.com>,
	<kyle@moffetthome.net>, Florian Fainelli <f.fainelli@gmail.com>
Subject: [PATCH 6/9] net: mv643xx_eth: use phy_init_hw to reset PHY
Date: Thu, 5 Dec 2013 16:55:14 -0800	[thread overview]
Message-ID: <1386291317-1202-7-git-send-email-f.fainelli@gmail.com> (raw)
In-Reply-To: <1386291317-1202-1-git-send-email-f.fainelli@gmail.com>

Instead of open-coding a PHY reset through the MII BMCR register, use
phy_init_hw() which does that for us and will also make sure that PHY
fixups are applied if required.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/ethernet/marvell/mv643xx_eth.c | 21 +--------------------
 1 file changed, 1 insertion(+), 20 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index 61088a6..8d9bb6b 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -2067,23 +2067,6 @@ static inline void oom_timer_wrapper(unsigned long data)
 	napi_schedule(&mp->napi);
 }
 
-static void phy_reset(struct mv643xx_eth_private *mp)
-{
-	int data;
-
-	data = phy_read(mp->phy, MII_BMCR);
-	if (data < 0)
-		return;
-
-	data |= BMCR_RESET;
-	if (phy_write(mp->phy, MII_BMCR, data) < 0)
-		return;
-
-	do {
-		data = phy_read(mp->phy, MII_BMCR);
-	} while (data >= 0 && data & BMCR_RESET);
-}
-
 static void port_start(struct mv643xx_eth_private *mp)
 {
 	u32 pscr;
@@ -2096,7 +2079,7 @@ static void port_start(struct mv643xx_eth_private *mp)
 		struct ethtool_cmd cmd;
 
 		mv643xx_eth_get_settings(mp->dev, &cmd);
-		phy_reset(mp);
+		phy_init_hw(mp);
 		mv643xx_eth_set_settings(mp->dev, &cmd);
 	}
 
@@ -2764,8 +2747,6 @@ static void phy_init(struct mv643xx_eth_private *mp, int speed, int duplex)
 {
 	struct phy_device *phy = mp->phy;
 
-	phy_reset(mp);
-
 	if (speed == 0) {
 		phy->autoneg = AUTONEG_ENABLE;
 		phy->speed = 0;
-- 
1.8.3.2

  parent reply	other threads:[~2013-12-06  1:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-06  0:55 [PATCH 0/9] net: phy: PHY reset consolidation Florian Fainelli
2013-12-06  0:55 ` [PATCH 1/9] net: phy: report link partner features through ethtool Florian Fainelli
2013-12-06  0:55 ` [PATCH 2/9] net: phy: use phy_init_hw instead of open-coding it Florian Fainelli
2013-12-06  0:55 ` [PATCH 3/9] net: greth: use phy_read_status() Florian Fainelli
2013-12-06  0:55 ` [PATCH 4/9] net: bfin_mac: do not reset PHY after phy_start() Florian Fainelli
2013-12-06  0:55 ` [PATCH 5/9] net: phy: consolidate PHY reset in phy_init_hw() Florian Fainelli
2013-12-06  0:55 ` Florian Fainelli [this message]
2013-12-06  2:16   ` [PATCH 6/9] net: mv643xx_eth: use phy_init_hw to reset PHY Sergei Shtylyov
2013-12-06  0:55 ` [PATCH 7/9] net: pxa168_eth: use phy_init_hw for PHY reset Florian Fainelli
2013-12-06  1:06   ` Florian Fainelli
2013-12-06  0:55 ` [PATCH 8/9] net: tc35815: " Florian Fainelli
2013-12-06  0:55 ` [PATCH 9/9] net: sh_eth: do not issue a wild PHY reset through BMCR Florian Fainelli

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=1386291317-1202-7-git-send-email-f.fainelli@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=afleming@gmail.com \
    --cc=davem@davemloft.net \
    --cc=kyle@moffetthome.net \
    --cc=netdev@vger.kernel.org \
    --cc=sebastian.hesselbarth@gmail.com \
    --cc=sergei.shtylyov@cogentembedded.com \
    /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).