From patchwork Thu Oct 4 18:14:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 189236 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 E815B2C0079 for ; Fri, 5 Oct 2012 04:17:38 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754000Ab2JDSRX (ORCPT ); Thu, 4 Oct 2012 14:17:23 -0400 Received: from mail-wg0-f44.google.com ([74.125.82.44]:42821 "EHLO mail-wg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754893Ab2JDSPN (ORCPT ); Thu, 4 Oct 2012 14:15:13 -0400 Received: by mail-wg0-f44.google.com with SMTP id dr13so731939wgb.1 for ; Thu, 04 Oct 2012 11:15:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=GfKBEvhA6XkTA+Ai3T2wEGiXJnNZgwjA8N/QkI5ZKVc=; b=YT0DwxeTirTwOR/X+AIO6PSWwxrIN5XyRe1cvYcZd1uZIVJFgFbogHi80uYAst9aOH BF6C+26bSEny/jlFh7cp0u2o2n/LddjUs8tIlBrFWSuVNf0T8wpTqvhIGD0l3jiPOtka H0jAnX43Qt5lDr3e6Pix6u2ID06/6w9W5jUKqUHs9Mq955E1HNLYff+MEJmmqfPl3/2o zsOX7SYBABrL9+9QCmADp+CgrkrXpmRFJWt2pwQU8dEQqF56wxciA3hRnVNK1j4eFLA0 dLJK/rnBDRHoQK+OnuoU89xgOPuwPnZHllZUHmJfdNybeInlCpx5J1H0Mwm7v01lzFoz YZ5w== Received: by 10.180.79.103 with SMTP id i7mr14678553wix.13.1349374512545; Thu, 04 Oct 2012 11:15:12 -0700 (PDT) Received: from localhost (nat-2.starnet.cz. [92.62.224.2]) by mx.google.com with ESMTPS id gg4sm16002434wib.6.2012.10.04.11.15.12 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 04 Oct 2012 11:15:12 -0700 (PDT) From: Michal Simek To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Michal Simek , Anirudha Sarangi , John Linn , Grant Likely , Rob Herring , "David S. Miller" Subject: [PATCH 06/11] net: ll_temac: Fix mdio initialization Date: Thu, 4 Oct 2012 20:14:52 +0200 Message-Id: <1349374497-9540-6-git-send-email-monstr@monstr.eu> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1349374497-9540-1-git-send-email-monstr@monstr.eu> References: <1349374497-9540-1-git-send-email-monstr@monstr.eu> X-Gm-Message-State: ALoCoQkpeM4HGu2jt9eAWSM457bRXuAK9crS2K8yjOkB1dBr3oVIgr8IzfCl7HQjfQHCdCuZNchF Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Current driver required to have phy-node directly in the driver. After this fixed we can use standard structure. DTS fragment: phy-handle = <&phy0>; mdio { #address-cells = <1>; #size-cells = <0>; phy0: phy@7 { compatible = "marvell,88e1111"; device_type = "ethernet-phy"; reg = <7>; } ; } ; Signed-off-by: Michal Simek CC: Anirudha Sarangi CC: John Linn CC: Grant Likely CC: Rob Herring CC: David S. Miller --- drivers/net/ethernet/xilinx/ll_temac_main.c | 11 ++++++----- drivers/net/ethernet/xilinx/ll_temac_mdio.c | 5 +++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c index f8e3518..482b572 100644 --- a/drivers/net/ethernet/xilinx/ll_temac_main.c +++ b/drivers/net/ethernet/xilinx/ll_temac_main.c @@ -1108,14 +1108,15 @@ static int __devinit temac_of_probe(struct platform_device *op) } temac_set_mac_address(ndev, (void *)addr); - rc = temac_mdio_setup(lp, op->dev.of_node); - if (rc) - dev_warn(&op->dev, "error registering MDIO bus\n"); - lp->phy_node = of_parse_phandle(op->dev.of_node, "phy-handle", 0); - if (lp->phy_node) + if (lp->phy_node) { dev_dbg(lp->dev, "using PHY node %s (%p)\n", np->full_name, np); + rc = temac_mdio_setup(lp, op->dev.of_node); + if (rc) + dev_warn(&op->dev, "error registering MDIO bus\n"); + } + /* Add the device attributes */ rc = sysfs_create_group(&lp->dev->kobj, &temac_attr_group); if (rc) { diff --git a/drivers/net/ethernet/xilinx/ll_temac_mdio.c b/drivers/net/ethernet/xilinx/ll_temac_mdio.c index 8cf9d4f..634d898 100644 --- a/drivers/net/ethernet/xilinx/ll_temac_mdio.c +++ b/drivers/net/ethernet/xilinx/ll_temac_mdio.c @@ -63,6 +63,7 @@ int temac_mdio_setup(struct temac_local *lp, struct device_node *np) int clk_div; int rc, size; struct resource res; + struct device_node *np1 = of_get_parent(lp->phy_node); /* Calculate a reasonable divisor for the clock rate */ clk_div = 0x3f; /* worst-case default setting */ @@ -85,7 +86,7 @@ int temac_mdio_setup(struct temac_local *lp, struct device_node *np) if (!bus) return -ENOMEM; - of_address_to_resource(np, 0, &res); + of_address_to_resource(np1, 0, &res); snprintf(bus->id, MII_BUS_ID_SIZE, "%.8llx", (unsigned long long)res.start); bus->priv = lp; @@ -97,7 +98,7 @@ int temac_mdio_setup(struct temac_local *lp, struct device_node *np) lp->mii_bus = bus; - rc = of_mdiobus_register(bus, np); + rc = of_mdiobus_register(bus, np1); if (rc) goto err_register;