From: Prabhakar Lad <prabhakar.csengg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Grygorii Strashko <grygorii.strashko-l0cyMroinI0@public.gmane.org>
Cc: "devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
dlos
<davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org>,
Florian Fainelli
<f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Mugunthan V N <mugunthanvnm-l0cyMroinI0@public.gmane.org>,
netdev <netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
LKML <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Santosh Shilimkar
<santosh.shilimkar-l0cyMroinI0@public.gmane.org>,
"David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
Subject: Re: [PATCH v2 2/2] net: davinci_mdio: allow to create phys from dt
Date: Wed, 16 Jul 2014 20:23:17 +0100 [thread overview]
Message-ID: <CA+V-a8sNcWFdzRws5NkBwwiAb6KymZZHqFLh4Hsqsip3vaRj2g@mail.gmail.com> (raw)
In-Reply-To: <1405512783-20307-3-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org>
On Wed, Jul 16, 2014 at 1:13 PM, Grygorii Strashko
<grygorii.strashko-l0cyMroinI0@public.gmane.org> wrote:
> This patch allows to create PHYs from DT in case
> if they are explicitly defined. The of_mdiobus_register() is
> used for such purposes.
>
> For backward compatibility, call of_mdiobus_register() only in case
> if at least one PHY's child is defined in DT, otherwise rollback to
> mdiobus_register().
>
> Reviewed-by: Santosh Shilimkar <santosh.shilimkar-l0cyMroinI0@public.gmane.org>
> Acked-by: Mugunthan V N <mugunthanvnm-l0cyMroinI0@public.gmane.org>
> Signed-off-by: Grygorii Strashko <grygorii.strashko-l0cyMroinI0@public.gmane.org>
Reviewed-by: Lad, Prabhakar <prabhakar.csengg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Thanks,
--Prabhakar Lad
> ---
> Hi Santosh,
>
> I haven't changed style for long-comments, because Networking subsystem
> requires first line of comment not to be empty:
> WARNING:NETWORKING_BLOCK_COMMENT_STYLE: networking block comments don't use an empty /* line, use /* Comment...
>
> drivers/net/ethernet/ti/davinci_mdio.c | 21 +++++++++++++++++++--
> 1 file changed, 19 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/ti/davinci_mdio.c b/drivers/net/ethernet/ti/davinci_mdio.c
> index 735dc53..2791f6f 100644
> --- a/drivers/net/ethernet/ti/davinci_mdio.c
> +++ b/drivers/net/ethernet/ti/davinci_mdio.c
> @@ -38,6 +38,7 @@
> #include <linux/davinci_emac.h>
> #include <linux/of.h>
> #include <linux/of_device.h>
> +#include <linux/of_mdio.h>
> #include <linux/pinctrl/consumer.h>
>
> /*
> @@ -95,6 +96,10 @@ struct davinci_mdio_data {
> struct mii_bus *bus;
> bool suspended;
> unsigned long access_time; /* jiffies */
> + /* Indicates that driver shouldn't modify phy_mask in case
> + * if MDIO bus is registered from DT.
> + */
> + bool skip_scan;
> };
>
> static void __davinci_mdio_reset(struct davinci_mdio_data *data)
> @@ -144,6 +149,9 @@ static int davinci_mdio_reset(struct mii_bus *bus)
> dev_info(data->dev, "davinci mdio revision %d.%d\n",
> (ver >> 8) & 0xff, ver & 0xff);
>
> + if (data->skip_scan)
> + return 0;
> +
> /* get phy mask from the alive register */
> phy_mask = __raw_readl(&data->regs->alive);
> if (phy_mask) {
> @@ -369,8 +377,17 @@ static int davinci_mdio_probe(struct platform_device *pdev)
> goto bail_out;
> }
>
> - /* register the mii bus */
> - ret = mdiobus_register(data->bus);
> + /* register the mii bus
> + * Create PHYs from DT only in case if PHY child nodes are explicitly
> + * defined to support backward compatibility with DTs which assume that
> + * Davinci MDIO will always scan the bus for PHYs detection.
> + */
> + if (dev->of_node && of_get_child_count(dev->of_node)) {
> + data->skip_scan = true;
> + ret = of_mdiobus_register(data->bus, dev->of_node);
> + } else {
> + ret = mdiobus_register(data->bus);
> + }
> if (ret)
> goto bail_out;
>
> --
> 1.7.9.5
>
prev parent reply other threads:[~2014-07-16 19:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-16 12:13 [PATCH v2 0/2] net: davinci_mdio: reuse for keystone2 arch Grygorii Strashko
[not found] ` <1405512783-20307-1-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org>
2014-07-16 12:13 ` [PATCH v2 1/2] " Grygorii Strashko
[not found] ` <1405512783-20307-2-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org>
2014-07-16 19:22 ` Prabhakar Lad
2014-07-17 6:33 ` [PATCH v2 0/2] " David Miller
2014-07-16 12:13 ` [PATCH v2 2/2] net: davinci_mdio: allow to create phys from dt Grygorii Strashko
[not found] ` <1405512783-20307-3-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org>
2014-07-16 19:23 ` Prabhakar Lad [this message]
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=CA+V-a8sNcWFdzRws5NkBwwiAb6KymZZHqFLh4Hsqsip3vaRj2g@mail.gmail.com \
--to=prabhakar.csengg-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
--cc=davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=grygorii.strashko-l0cyMroinI0@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mugunthanvnm-l0cyMroinI0@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=santosh.shilimkar-l0cyMroinI0@public.gmane.org \
/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).