From patchwork Fri Mar 5 19:48:19 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Collins X-Patchwork-Id: 164271 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 1391DB6FE0 for ; Tue, 12 Jun 2012 09:02:38 +1000 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SeDcz-0003xv-8R; Mon, 11 Jun 2012 23:02:29 +0000 Received: from mail-pz0-f49.google.com ([209.85.210.49]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SeDcn-0003hC-20 for kernel-team@lists.ubuntu.com; Mon, 11 Jun 2012 23:02:17 +0000 Received: by mail-pz0-f49.google.com with SMTP id m1so6348994dad.8 for ; Mon, 11 Jun 2012 16:02:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:in-reply-to:references:from:date:subject:to; bh=6BSkjFTijae+mXQ54qjIoYlcR3kFUoyaebS9Vk+9VQw=; b=VrZji5mMpyNweNe5d41ZqAQr8WnvoeB8GnVtJCony9KUgBxZP82vUIi5dK/lcMhzeo YbG0EYfO5g/bsWyOe/eQVug+xSCp6WMlU5ScypyQArAknYiwhLGSZOwbnshRM4+aAHH1 2lN9N8TcC5xVCBNRN78bbySy/LnN8mh9W1RSNEjQ31qTyrB9JTr2fEPAyt0PXAkfSCjW dGbFRgh97AmbNdD+WDzIGgP7LhTV4oNPHjxO98maxXE2cyBvavtzGjWgxbvLmD87KG1+ n4Ae0/2s4nBsRvY8vy4OUZvUjcE/78mb1grdS2vh4KDryn7ZwK1WlNWCG7s8mJxnYhCi U1sw== Received: by 10.68.234.35 with SMTP id ub3mr31838690pbc.8.1339455736624; Mon, 11 Jun 2012 16:02:16 -0700 (PDT) Received: from localhost (ip68-13-200-36.hr.hr.cox.net. [68.13.200.36]) by mx.google.com with ESMTPS id qm6sm19946142pbc.10.2012.06.11.16.02.13 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 11 Jun 2012 16:02:15 -0700 (PDT) Received: by localhost (sSMTP sendmail emulation); Mon, 11 Jun 2012 19:02:11 -0400 Message-Id: <826c9b40c472cfe453b5caa65873a9799468c938.1339455422.git.bcollins@ubuntu.com> In-Reply-To: References: From: Andy Fleming Date: Fri, 5 Mar 2010 13:48:19 -0600 Subject: [PATCH 15/27] UBUNTU: SAUCE: of_mdio: Add of_phy_attach function To: kernel-team@lists.ubuntu.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com of_phy_connect is useful for most systems, but some drivers will want finer-grained control over their PHYs, and won't want to use the PHY Lib state machine or interrupt handlers. This patch is being maintained and will eventually be merged upstream by Freescale directly. The powerpc-e500mc flavour uses this. Signed-off-by: Andy Fleming Signed-off-by: Ben Collins --- drivers/of/of_mdio.c | 14 ++++++++++++++ include/linux/of_mdio.h | 3 +++ 2 files changed, 17 insertions(+) diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index f048fa6..3bcad29 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c @@ -192,3 +192,17 @@ struct phy_device *of_phy_connect_fixed_link(struct net_device *dev, return IS_ERR(phy) ? NULL : phy; } EXPORT_SYMBOL(of_phy_connect_fixed_link); + +/* XXX add comment */ +struct phy_device *of_phy_attach(struct net_device *dev, + struct device_node *phy_np, u32 flags, + phy_interface_t iface) +{ + struct phy_device *phy = of_phy_find_device(phy_np); + + if (!phy) + return NULL; + + return phy_attach_direct(dev, phy, flags, iface) ? NULL : phy; +} +EXPORT_SYMBOL(of_phy_attach); diff --git a/include/linux/of_mdio.h b/include/linux/of_mdio.h index 912c27a..4ed53ef 100644 --- a/include/linux/of_mdio.h +++ b/include/linux/of_mdio.h @@ -21,6 +21,9 @@ extern struct phy_device *of_phy_connect(struct net_device *dev, extern struct phy_device *of_phy_connect_fixed_link(struct net_device *dev, void (*hndlr)(struct net_device *), phy_interface_t iface); +extern struct phy_device *of_phy_attach(struct net_device *dev, + struct device_node *phy_np, u32 flags, + phy_interface_t iface); extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np);