From patchwork Thu Oct 20 21:00:17 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kyle Moffett X-Patchwork-Id: 120906 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 5DC731007D1 for ; Fri, 21 Oct 2011 08:17:25 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753298Ab1JTVNX (ORCPT ); Thu, 20 Oct 2011 17:13:23 -0400 Received: from 26.241.167.70.in-addr.border.exmeritus.com ([70.167.241.26]:35665 "EHLO border.exmeritus.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751926Ab1JTVNV (ORCPT ); Thu, 20 Oct 2011 17:13:21 -0400 Received: from ysera.exmeritus.com (firewall2.exmeritus.com [10.13.38.2]) by border.exmeritus.com (Postfix) with ESMTP id 60025AC09F; Thu, 20 Oct 2011 17:03:01 -0400 (EDT) From: Kyle Moffett To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: Kyle Moffett , "David S. Miller" , Richard Cochran , Joe Perches , Jon Mason Subject: [RFC PATCH 10/17] pxa186_eth: Use standardized phy_init_hw() for PHY reset Date: Thu, 20 Oct 2011 17:00:17 -0400 Message-Id: <1319144425-15547-11-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/pxa168_eth.c | 21 +-------------------- 1 files changed, 1 insertions(+), 20 deletions(-) diff --git a/drivers/net/pxa168_eth.c b/drivers/net/pxa168_eth.c index d17d062..ab3bca9 100644 --- a/drivers/net/pxa168_eth.c +++ b/drivers/net/pxa168_eth.c @@ -323,23 +323,6 @@ static void ethernet_phy_set_addr(struct pxa168_eth_private *pep, int phy_addr) wrl(pep, PHY_ADDRESS, reg_data); } -static void ethernet_phy_reset(struct pxa168_eth_private *pep) -{ - int data; - - data = phy_read(pep->phy, MII_BMCR); - if (data < 0) - return; - - data |= BMCR_RESET; - if (phy_write(pep->phy, MII_BMCR, data) < 0) - return; - - do { - data = phy_read(pep->phy, MII_BMCR); - } while (data >= 0 && data & BMCR_RESET); -} - static void rxq_refill(struct net_device *dev) { struct pxa168_eth_private *pep = netdev_priv(dev); @@ -647,7 +630,7 @@ static void eth_port_start(struct net_device *dev) struct ethtool_cmd cmd; pxa168_get_settings(pep->dev, &cmd); - ethernet_phy_reset(pep); + phy_init_hw(pep->phy); pxa168_set_settings(pep->dev, &cmd); } @@ -1393,8 +1376,6 @@ static struct phy_device *phy_scan(struct pxa168_eth_private *pep, int phy_addr) static void phy_init(struct pxa168_eth_private *pep, int speed, int duplex) { struct phy_device *phy = pep->phy; - ethernet_phy_reset(pep); - phy_attach(pep->dev, dev_name(&phy->dev), 0, PHY_INTERFACE_MODE_MII); if (speed == 0) {