mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Marco Felsch <m.felsch@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 2/3] net: phy: micrel: backport finding PHY properties
Date: Mon, 9 Mar 2020 08:28:25 +0100	[thread overview]
Message-ID: <20200309072825.GD3335@pengutronix.de> (raw)
In-Reply-To: <20200303174616.4476-2-m.felsch@pengutronix.de>

On Tue, Mar 03, 2020 at 06:46:15PM +0100, Marco Felsch wrote:
> This backports linux commit 651df2183543 ("phy: micrel: Fix finding PHY
> properties in MAC node."):
> 
> 8<---------------------------------------------------------------------
> 
>     phy: micrel: Fix finding PHY properties in MAC node.
> 
>     commit 8b63ec1837fa ("phylib: Make PHYs children of their MDIO bus,
>     not the bus' parent.")  changed the parenting of PHY devices, making
>     them a child of the MDIO bus, instead of the MAC device. This broken
>     the Micrel PHY driver which has a deprecated feature of allowing PHY
>     properties to be placed into the MAC node.
> 
>     In order to find the MAC node, we need to walk up the tree of devices
>     until we find one with an OF node attached.
> 
>     Reported-by: Dinh Nguyen <dinguyen@opensource.altera.com>
>     Suggested-by: David Daney <david.daney@cavium.com>
>     Acked-by: David Daney <david.daney@cavium.com>
>     Fixes: 8b63ec1837fa ("phylib: Make PHYs children of their MDIO bus, not the bus' parent.")
>     Signed-off-by: Andrew Lunn <andrew@lunn.ch>
>     Tested-by: Dinh Nguyen <dinguyen@opensource.altera.com>
>     Acked-by: Florian Fainelli <f.fainelli@gmail.com>
>     Signed-off-by: David S. Miller <davem@davemloft.net>
> 
> 8<---------------------------------------------------------------------
> 
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> ---
>  drivers/net/phy/micrel.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
> index 8f0b81d8fa..b18db0a751 100644
> --- a/drivers/net/phy/micrel.c
> +++ b/drivers/net/phy/micrel.c
> @@ -115,6 +115,7 @@ static int ksz9021_config_init(struct phy_device *phydev)
>  {
>  	const struct device_d *dev = &phydev->dev;
>  	const struct device_node *of_node = dev->device_node;
> +	const struct device_d *dev_walker;
>  	const char *clk_pad_skew_names[] = {
>  		"txen-skew-ps", "txc-skew-ps",
>  		"rxdv-skew-ps", "rxc-skew-ps"
> @@ -128,8 +129,15 @@ static int ksz9021_config_init(struct phy_device *phydev)
>  		"txd2-skew-ps", "txd3-skew-ps"
>  	};
>  
> -	if (!of_node && dev->parent->device_node)
> -		of_node = dev->parent->device_node;
> +	/* The Micrel driver has a deprecated option to place phy OF
> +	 * properties in the MAC node. Walk up the tree of devices to
> +	 * find a device with an OF node.
> +	 */
> +	dev_walker = &phydev->dev;
> +	do {
> +		of_node = dev_walker->device_node;
> +		dev_walker = dev_walker->parent;
> +	} while (!of_node && dev_walker);

If that's deprecated that would be a good opportunity to fix it in the
upstream device trees and also to be more noisy here.

Unlike the Kernel we don't have to deal with deprecated device trees in
barebox.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
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

  reply	other threads:[~2020-03-09  7:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-03 17:46 [PATCH 1/3] ARM: nitrogen6x: add phy reset timings Marco Felsch
2020-03-03 17:46 ` [PATCH 2/3] net: phy: micrel: backport finding PHY properties Marco Felsch
2020-03-09  7:28   ` Sascha Hauer [this message]
2020-03-03 17:46 ` [PATCH 3/3] ARM: nitrogen6: remove hard coded values Marco Felsch
2020-03-06 16:06   ` Stefan Lengfeld
2020-03-09  6:32     ` Marco Felsch

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=20200309072825.GD3335@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=m.felsch@pengutronix.de \
    /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