From: Sascha Hauer <s.hauer@pengutronix.de>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: Barebox List <barebox@lists.infradead.org>
Subject: Re: [PATCH v3 2/3] phylib: add support for reset-gpios
Date: Tue, 21 Aug 2018 09:50:19 +0200 [thread overview]
Message-ID: <20180821075019.cl2r4w7zbyxilb26@pengutronix.de> (raw)
In-Reply-To: <20180820145612.17576-2-sam@ravnborg.org>
Hi Sam,
Looks good generally, but there's one point
On Mon, Aug 20, 2018 at 04:56:11PM +0200, Sam Ravnborg wrote:
> /**
> * of_mdiobus_register - Register mii_bus and create PHYs from the device tree
> * @mdio: pointer to mii_bus structure
> @@ -111,6 +186,8 @@ static int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
> continue;
> }
>
> + of_reset_phy(mdio, child);
> +
> of_mdiobus_register_phy(mdio, child, addr);
> }
>
> @@ -154,6 +231,11 @@ int mdiobus_register(struct mii_bus *bus)
>
> pr_info("%s: probed\n", dev_name(&bus->dev));
>
> + /* register PHY's as child node to the ethernet node */
> + if (bus->parent->device_node)
> + of_mdiobus_register(bus, bus->parent->device_node);
I am not so convinced of this change. Here you assume that bus->parent
is the ethernet node, but this doesn't necessarily have to be the case
as some mdio controllers are standalone and not part of an ethernet
device (see "virtual,mdio-gpio" to get examples).
So instead of introducing this change I would prefer if you let the code
below trigger:
> +
> + /* register PHY's as child node to mdio node */
> if (bus->dev.device_node)
> of_mdiobus_register(bus, bus->dev.device_node);
This means you have to set bus->dev.device_node in your ethernet driver
like some drivers already do:
drivers/net/macb.c:666: macb->miibus.dev.device_node = mdiobus;
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2018-08-21 7:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-20 14:52 [PATCH v3 0/3] Add Davicom phy + reset-gpios Sam Ravnborg
2018-08-20 14:56 ` [PATCH v3 1/3] phylib: add Davicom PHY support Sam Ravnborg
2018-08-20 14:56 ` [PATCH v3 2/3] phylib: add support for reset-gpios Sam Ravnborg
2018-08-21 7:50 ` Sascha Hauer [this message]
2018-08-21 19:46 ` Sam Ravnborg
2018-08-22 13:14 ` Ahmad Fatoum
2018-08-22 18:26 ` Sam Ravnborg
2018-08-20 14:56 ` [PATCH v3 3/3] at91sam9263ek: add PHY, miitool etc. to config Sam Ravnborg
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=20180821075019.cl2r4w7zbyxilb26@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=sam@ravnborg.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