From patchwork Thu Oct 20 21:00:16 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kyle Moffett X-Patchwork-Id: 120903 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 45AC71007D1 for ; Fri, 21 Oct 2011 08:16:45 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753779Ab1JTVPn (ORCPT ); Thu, 20 Oct 2011 17:15:43 -0400 Received: from 26.241.167.70.in-addr.border.exmeritus.com ([70.167.241.26]:35677 "EHLO border.exmeritus.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1753261Ab1JTVNY (ORCPT ); Thu, 20 Oct 2011 17:13:24 -0400 Received: from ysera.exmeritus.com (firewall2.exmeritus.com [10.13.38.2]) by border.exmeritus.com (Postfix) with ESMTP id EE66FAC09E; Thu, 20 Oct 2011 17:02:58 -0400 (EDT) From: Kyle Moffett To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: Kyle Moffett , Lennert Buytenhek Subject: [RFC PATCH 09/17] mv643xx_eth: Use standardized phy_init_hw() for PHY reset Date: Thu, 20 Oct 2011 17:00:16 -0400 Message-Id: <1319144425-15547-10-git-send-email-Kyle.D.Moffett@boeing.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1319144425-15547-1-git-send-email-Kyle.D.Moffett@boeing.com> References: <1319144425-15547-1-git-send-email-Kyle.D.Moffett@boeing.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The PHY does not need to be reset immediately before phy_attach(), as that function will call phy_init_hw() properly on its own. Furthermore, the PHY should not be manually reset, as that will undo board-specific PHY fixups and driver-specific phy->drv->config_init() register tweaks. NOTE: Depends on earlier phy_init_hw() patch. Not-yet-Signed-off-by: Kyle Moffett --- drivers/net/mv643xx_eth.c | 22 +--------------------- 1 files changed, 1 insertions(+), 21 deletions(-) diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index 2596999..d3e223c 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c @@ -2188,23 +2188,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; @@ -2217,7 +2200,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->phy); mv643xx_eth_set_settings(mp->dev, &cmd); } @@ -2779,9 +2762,6 @@ static struct phy_device *phy_scan(struct mv643xx_eth_private *mp, static void phy_init(struct mv643xx_eth_private *mp, int speed, int duplex) { struct phy_device *phy = mp->phy; - - phy_reset(mp); - phy_attach(mp->dev, dev_name(&phy->dev), 0, PHY_INTERFACE_MODE_GMII); if (speed == 0) {