From: Sascha Hauer <s.hauer@pengutronix.de>
To: Ian Abbott <abbotti@mev.co.uk>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] net: designware: look for a child device node for MDIO bus
Date: Fri, 2 Nov 2018 07:32:23 +0100 [thread overview]
Message-ID: <20181102063223.k2g2r2wfwohydtui@pengutronix.de> (raw)
In-Reply-To: <20181101170136.20588-1-abbotti@mev.co.uk>
On Thu, Nov 01, 2018 at 05:01:36PM +0000, Ian Abbott wrote:
> The Designware driver registers a local MDIO bus for each MAC device,
> but without setting a device node pointer for the MDIO bus device. In
> this case, mdiobus_register() will use the MDIO bus's parent device node
> (if any) as the MDIO device node.
>
> If the MAC device node has a child node compatible with
> "snps,dwmac-mdio", let us use that as the MDIO bus device node.
> Otherwise, leave the MDIO bus device node pointer set to NULL and carry
> on as before.
>
> The upshot is that PHY device nodes can now be placed in an intermediate
> node for the MDIO bus instead of having to place them directly in the
> Designware MAC device node.
>
> (Tested on a Terasic DE0-Nano-SoC with a suitably modified device tree.)
>
> Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
> ---
> drivers/net/designware.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
Applied, thanks
Sascha
>
> diff --git a/drivers/net/designware.c b/drivers/net/designware.c
> index 49ddaa20d..58880b0e5 100644
> --- a/drivers/net/designware.c
> +++ b/drivers/net/designware.c
> @@ -408,12 +408,22 @@ static void dwc_version(struct device_d *dev, u32 hwid)
>
> static int dwc_probe_dt(struct device_d *dev, struct dw_eth_dev *priv)
> {
> + struct device_node *child;
> +
> if (!IS_ENABLED(CONFIG_OFTREE))
> return -ENODEV;
>
> priv->phy_addr = -1;
> priv->interface = of_get_phy_mode(dev->device_node);
>
> + /* Set MDIO bus device node, if present. */
> + for_each_child_of_node(dev->device_node, child) {
> + if (of_device_is_compatible(child, "snps,dwmac-mdio")) {
> + priv->miibus.dev.device_node = child;
> + break;
> + }
> + }
> +
> return 0;
> }
>
> --
> 2.19.1
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
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
prev parent reply other threads:[~2018-11-02 6:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-01 17:01 Ian Abbott
2018-11-02 6:32 ` Sascha Hauer [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=20181102063223.k2g2r2wfwohydtui@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=abbotti@mev.co.uk \
--cc=barebox@lists.infradead.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