From patchwork Fri Jul 17 07:31:36 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Likely X-Patchwork-Id: 29906 Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id 72F17B70CF for ; Fri, 17 Jul 2009 17:33:43 +1000 (EST) Received: by ozlabs.org (Postfix) id 66A59DDD1B; Fri, 17 Jul 2009 17:33:43 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from bilbo.ozlabs.org (bilbo.ozlabs.org [203.10.76.25]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "bilbo.ozlabs.org", Issuer "CAcert Class 3 Root" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id 6471DDDD01 for ; Fri, 17 Jul 2009 17:33:43 +1000 (EST) Received: from bilbo.ozlabs.org (localhost [127.0.0.1]) by bilbo.ozlabs.org (Postfix) with ESMTP id 48DF5B8192 for ; Fri, 17 Jul 2009 17:31:55 +1000 (EST) Received: from mail-px0-f181.google.com (mail-px0-f181.google.com [209.85.216.181]) by bilbo.ozlabs.org (Postfix) with ESMTP id 88ABFB7BBB for ; Fri, 17 Jul 2009 17:31:39 +1000 (EST) Received: by mail-px0-f181.google.com with SMTP id 11so451959pxi.26 for ; Fri, 17 Jul 2009 00:31:39 -0700 (PDT) Received: by 10.115.89.18 with SMTP id r18mr1163808wal.34.1247815899041; Fri, 17 Jul 2009 00:31:39 -0700 (PDT) Received: from trillian.cg.shawcable.net (S01060016b61d1226.cg.shawcable.net [68.146.92.145]) by mx.google.com with ESMTPS id d20sm1792919waa.47.2009.07.17.00.31.37 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 17 Jul 2009 00:31:38 -0700 (PDT) Received: from localhost.localdomain (trillian [127.0.0.1]) by trillian.cg.shawcable.net (Postfix) with ESMTP id D8BC8C80C1; Fri, 17 Jul 2009 01:31:36 -0600 (MDT) From: Grant Likely Subject: [PATCH v2 2/4] fs_enet: Revive fixed link support To: avorontsov@ru.mvista.com, davem@davemloft.net, afleming@freescale.com, netdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Fri, 17 Jul 2009 01:31:36 -0600 Message-ID: <20090717073136.15652.80098.stgit@localhost.localdomain> In-Reply-To: <20090717065220.15652.93331.stgit@localhost.localdomain> References: <20090717065220.15652.93331.stgit@localhost.localdomain> User-Agent: StGIT/0.14.2 MIME-Version: 1.0 Cc: leoli@freescale.com X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org From: Anton Vorontsov Since commit aa73832c5a80d6c52c69b18af858d88fa595dd3c ("Rework fs_enet driver to use of_mdio infrastructure") the fixed-link support is broken in the fs_enet driver. This patch fixes the support by removing a check for phy_node, and adding a call to of_phy_connect_fixed_link(). Also set netdev parent device via SET_NETDEV_DEV() call, this is needed so that OF MDIO core could find a node pointer for a device. Plus, fix "if (IS_ERR(phydev))" check, in case of errors, of_phy_connect() returns NULL, not ERR_PTR as phy_connect(). Signed-off-by: Anton Vorontsov Signed-off-by: Grant Likely --- drivers/net/fs_enet/fs_enet-main.c | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c index b892c3a..2bc2d2b 100644 --- a/drivers/net/fs_enet/fs_enet-main.c +++ b/drivers/net/fs_enet/fs_enet-main.c @@ -754,17 +754,16 @@ static int fs_init_phy(struct net_device *dev) fep->oldlink = 0; fep->oldspeed = 0; fep->oldduplex = -1; - if(fep->fpi->phy_node) - phydev = of_phy_connect(dev, fep->fpi->phy_node, - &fs_adjust_link, 0, - PHY_INTERFACE_MODE_MII); - else { - printk("No phy bus ID specified in BSP code\n"); - return -EINVAL; + + phydev = of_phy_connect(dev, fep->fpi->phy_node, &fs_adjust_link, 0, + PHY_INTERFACE_MODE_MII); + if (!phydev) { + phydev = of_phy_connect_fixed_link(dev, &fs_adjust_link, + PHY_INTERFACE_MODE_MII); } - if (IS_ERR(phydev)) { - printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name); - return PTR_ERR(phydev); + if (!phydev) { + dev_err(&dev->dev, "Could not attach to PHY\n"); + return -ENODEV; } fep->phydev = phydev; @@ -1005,6 +1004,7 @@ static int __devinit fs_enet_probe(struct of_device *ofdev, goto out_free_fpi; } + SET_NETDEV_DEV(ndev, &ofdev->dev); dev_set_drvdata(&ofdev->dev, ndev); fep = netdev_priv(ndev);