devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Appana Durga Kedareswara Rao <appana.durga.rao@xilinx.com>
Cc: David Miller <davem@davemloft.net>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"mark.rutland@arm.com" <mark.rutland@arm.com>,
	"nicolas.ferre@atmel.com" <nicolas.ferre@atmel.com>,
	"sergio.prado@e-labworks.com" <sergio.prado@e-labworks.com>,
	"gregory.clement@free-electrons.com"
	<gregory.clement@free-electrons.com>,
	"narmstrong@baylibre.com" <narmstrong@baylibre.com>,
	Michal Simek <michals@xilinx.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] net: macb: add phy-handle support for the macb
Date: Tue, 16 Aug 2016 22:14:36 +0200	[thread overview]
Message-ID: <20160816201436.GB3751@lunn.ch> (raw)
In-Reply-To: <C246CAC1457055469EF09E3A7AC4E11A4A5E27C6@XAP-PVEXMBX01.xlnx.xilinx.com>

> Agree with you my intention is if there is a MDIO bus on the device-tree
> The MAC driver should create PHY/MDIO devices using of_mdiobus_register().

What you suggest is better, and is similar to what other drivers use.

In order to keep backwards compatibility with phy nodes in the MAC
node, you have to do of_mdiobus_register() with the MAC node. However,
please change the binding documentation to say this is deprecated, all
phy nodes should be placed inside an mdio node.

Using some better variable names would also help. mac_np and mdio_np
for example.

    Andrew

> 
> How about below code...
> 
> -       struct device_node *np;
> +       struct device_node *np, *np1;
>         int err = -ENXIO, i;
>  
>         /* Enable management port */
> @@ -445,7 +445,14 @@ static int macb_mii_init(struct macb *bp)
>         dev_set_drvdata(&bp->dev->dev, bp->mii_bus);
>  
>         np = bp->pdev->dev.of_node;
> -       if (np) {
> +       np1 = of_get_child_by_name(np, "mdio");
> +       if (np1) {
> +               of_node_put(np1);
> +               err = of_mdiobus_register(bp->mii_bus, np1);
> +               if (err)
> +                       goto err_out_unregister_bus;
> +       } else if (np) {
>                 /* try dt phy registration */
>                 err = of_mdiobus_register(bp->mii_bus, np);
> 
> If you are ok with the above code please let me know will post it as v2...
> 
> Regards,
> Kedar.

  reply	other threads:[~2016-08-16 20:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-13 10:01 [PATCH] net: macb: add phy-handle support for the macb Kedareswara rao Appana
2016-08-13 18:52 ` David Miller
2016-08-16  7:01   ` Appana Durga Kedareswara Rao
2016-08-16 20:14     ` Andrew Lunn [this message]
     [not found]       ` <20160816201436.GB3751-g2DYL2Zd6BY@public.gmane.org>
2016-08-18 15:53         ` Appana Durga Kedareswara Rao

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=20160816201436.GB3751@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=appana.durga.rao@xilinx.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=gregory.clement@free-electrons.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=michals@xilinx.com \
    --cc=narmstrong@baylibre.com \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.ferre@atmel.com \
    --cc=robh+dt@kernel.org \
    --cc=sergio.prado@e-labworks.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).