From patchwork Thu May 22 16:47:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 351565 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 5CA0A140088 for ; Fri, 23 May 2014 02:52:55 +1000 (EST) Received: from ozlabs.org (ozlabs.org [103.22.144.67]) by lists.ozlabs.org (Postfix) with ESMTP id 4A0221A0DD4 for ; Fri, 23 May 2014 02:52:55 +1000 (EST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mail-ig0-x233.google.com (mail-ig0-x233.google.com [IPv6:2607:f8b0:4001:c05::233]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id CFD9B1A05DE for ; Fri, 23 May 2014 02:48:25 +1000 (EST) Received: by mail-ig0-f179.google.com with SMTP id hn18so3776989igb.6 for ; Thu, 22 May 2014 09:48:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9Hj0A6/tTmV++QOden/C5/lAV8JmvhhAUERjhwxf28s=; b=GMPeCVl8QKTrK/FaMRgwmSebGE+N+lROLF/9GpaqU6D0SYrrLkaFG76W3swKDL1AV+ BdWGs/Pu3TTWNBTcU4FC2tBg0VHCLm6rkZfS+VSqWU7LHVgHRD9XgvDmy2LwqU4Wk4fM sIQ4MaxZflbuDt7nfOl82dzIeyiqfgPWT5suJ3gBvkq85ewjbFsZvb5EtjbddBDok/VD F/XCg/918FqYdREpstCUqViV6hDJrTyv86FU90+GG/QjB6uYCTe92iU+FOrMG9V8V4EE s99XzfbjpxoHAUFKj8kiceqaOZOmdIeWc/cSNG7HphWPzqCTU+rW2WsNLC0WtNG/p6mG himA== X-Received: by 10.42.206.70 with SMTP id ft6mr3582811icb.86.1400777303049; Thu, 22 May 2014 09:48:23 -0700 (PDT) Received: from fainelli-desktop.broadcom.com (5520-maca-inet1-outside.broadcom.com. [216.31.211.11]) by mx.google.com with ESMTPSA id ql7sm14455104igc.19.2014.05.22.09.48.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 22 May 2014 09:48:21 -0700 (PDT) From: Florian Fainelli To: netdev@vger.kernel.org Subject: [PATCH net-next v2 5/9] fs_enet: use the new fixed PHY helpers Date: Thu, 22 May 2014 09:47:47 -0700 Message-Id: <1400777271-32199-6-git-send-email-f.fainelli@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1400777271-32199-1-git-send-email-f.fainelli@gmail.com> References: <1400777271-32199-1-git-send-email-f.fainelli@gmail.com> Cc: Thomas Petazzoni , "open list:OPEN FIRMWARE AND..." , Florian Fainelli , Aida Mynzhasova , Sergei Shtylyov , Richard Cochran , open list , Claudiu Manoil , Vitaly Bordug , Grant Likely , "open list:LINUX FOR POWERPC..." , davem@davemloft.net X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" of_phy_connect_fixed_link() is becoming obsolete, and also required platform code to register the fixed PHYs at the specified addresses for those to be usable. Get rid of it and use the new of_phy_is_fixed_link() plus of_phy_register_fixed_link() helpers to transition over the new scheme. Signed-off-by: Florian Fainelli --- - merge if conditions on the same line as suggested by Sergei - add comment explaining the device_node pointer assignment drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c index dc80db41d6b3..cfaf17b70f3f 100644 --- a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c +++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c @@ -792,10 +792,6 @@ static int fs_init_phy(struct net_device *dev) phydev = of_phy_connect(dev, fep->fpi->phy_node, &fs_adjust_link, 0, iface); if (!phydev) { - phydev = of_phy_connect_fixed_link(dev, &fs_adjust_link, - iface); - } - if (!phydev) { dev_err(&dev->dev, "Could not attach to PHY\n"); return -ENODEV; } @@ -1029,9 +1025,16 @@ static int fs_enet_probe(struct platform_device *ofdev) fpi->use_napi = 1; fpi->napi_weight = 17; fpi->phy_node = of_parse_phandle(ofdev->dev.of_node, "phy-handle", 0); - if ((!fpi->phy_node) && (!of_get_property(ofdev->dev.of_node, "fixed-link", - NULL))) - goto out_free_fpi; + if (!fpi->phy_node && of_phy_is_fixed_link(ofdev->dev.of_node)) { + err = of_phy_register_fixed_link(ofdev->dev.of_node); + if (err) + goto out_free_fpi; + + /* In the case of a fixed PHY, the DT node associated + * to the PHY is the Ethernet MAC DT node. + */ + fpi->phy_node = ofdev->dev.of_node; + } if (of_device_is_compatible(ofdev->dev.of_node, "fsl,mpc5125-fec")) { phy_connection_type = of_get_property(ofdev->dev.of_node,