All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Simek <monstr@monstr.eu>
To: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Michal Simek <monstr@monstr.eu>,
	Anirudha Sarangi <anirudh@xilinx.com>,
	John Linn <John.Linn@xilinx.com>,
	Grant Likely <grant.likely@secretlab.ca>,
	Rob Herring <rob.herring@calxeda.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: [PATCH 06/11] net: ll_temac: Fix mdio initialization
Date: Thu,  4 Oct 2012 20:14:52 +0200	[thread overview]
Message-ID: <1349374497-9540-6-git-send-email-monstr@monstr.eu> (raw)
In-Reply-To: <1349374497-9540-1-git-send-email-monstr@monstr.eu>

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 <monstr@monstr.eu>
CC: Anirudha Sarangi <anirudh@xilinx.com>
CC: John Linn <John.Linn@xilinx.com>
CC: Grant Likely <grant.likely@secretlab.ca>
CC: Rob Herring <rob.herring@calxeda.com>
CC: David S. Miller <davem@davemloft.net>
---
 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;
 
-- 
1.7.0.4


  parent reply	other threads:[~2012-10-04 18:17 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-04 18:14 [PATCH 01/11] net: axienet: Remove NETIF_F_SG dropping for no checksum feature Michal Simek
2012-10-04 18:14 ` [PATCH 02/11] net: axienet: Add ioctl support Michal Simek
2012-10-04 19:17   ` Ben Hutchings
2012-10-05  5:54     ` Michal Simek
2012-10-04 18:14 ` [PATCH 03/11] net: axienet: Do not use NO_IRQ Michal Simek
2012-10-04 18:14 ` [PATCH 04/11] net: axienet: Additional MDIO clock functionality Michal Simek
2012-10-04 18:14 ` [PATCH 05/11] net: axienet: Enable VLAN support by default Michal Simek
2012-10-04 18:14 ` Michal Simek [this message]
2012-10-04 18:14 ` [PATCH 07/11] net: ll_temac: Fix DMA map size bug Michal Simek
2012-10-04 18:14 ` [PATCH 08/11] net: ll_temac: Do not use fixed mtu size Michal Simek
2012-10-04 19:22   ` Ben Hutchings
2012-10-05  5:58     ` Michal Simek
2012-10-04 18:14 ` [PATCH 09/11] net: ll_temac: Move frag loading to frag loop Michal Simek
2012-10-04 18:14 ` [PATCH 10/11] net: ll_temac: Simplify xmit Michal Simek
2012-10-04 18:14 ` [PATCH 11/11] net: xilinx: Show csum in bootlog Michal Simek
2012-10-04 19:15   ` Ben Hutchings
2012-10-05  5:48     ` Michal Simek
2012-10-05 13:36       ` Ben Hutchings
2012-10-05  9:35     ` Michal Simek
2012-10-05 13:51       ` Ben Hutchings
2012-10-09  9:08         ` Michal Simek
2012-10-09 16:56           ` Ben Hutchings
2012-10-10 16:06             ` Michal Simek
2012-10-10 16:14               ` Ben Hutchings
2012-10-04 18:26 ` [PATCH 01/11] net: axienet: Remove NETIF_F_SG dropping for no checksum feature David Miller
2012-10-05  5:22   ` Michal Simek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1349374497-9540-6-git-send-email-monstr@monstr.eu \
    --to=monstr@monstr.eu \
    --cc=John.Linn@xilinx.com \
    --cc=anirudh@xilinx.com \
    --cc=davem@davemloft.net \
    --cc=grant.likely@secretlab.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rob.herring@calxeda.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.