All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2 net] phy: micrel: Fix finding PHY properties in MAC node.
@ 2015-12-09 18:56 Andrew Lunn
  2015-12-09 19:39 ` Dinh Nguyen
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Andrew Lunn @ 2015-12-09 18:56 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Florian Fainelli, dinguyen, david.daney, Andrew Lunn

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>
---
v2: Remove include of netdev.h
---
 drivers/net/phy/micrel.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index cf6312fafea5..e13ad6cdcc22 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -339,9 +339,18 @@ static int ksz9021_config_init(struct phy_device *phydev)
 {
 	const struct device *dev = &phydev->dev;
 	const struct device_node *of_node = dev->of_node;
+	const struct device *dev_walker;
 
-	if (!of_node && dev->parent->of_node)
-		of_node = dev->parent->of_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->of_node;
+		dev_walker = dev_walker->parent;
+
+	} while (!of_node && dev_walker);
 
 	if (of_node) {
 		ksz9021_load_values_from_of(phydev, of_node,
-- 
2.6.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCHv2 net] phy: micrel: Fix finding PHY properties in MAC node.
  2015-12-09 18:56 [PATCHv2 net] phy: micrel: Fix finding PHY properties in MAC node Andrew Lunn
@ 2015-12-09 19:39 ` Dinh Nguyen
  2015-12-09 21:40 ` Florian Fainelli
  2015-12-12  1:32 ` David Miller
  2 siblings, 0 replies; 5+ messages in thread
From: Dinh Nguyen @ 2015-12-09 19:39 UTC (permalink / raw)
  To: Andrew Lunn, David Miller; +Cc: netdev, Florian Fainelli, david.daney

On 12/09/2015 12:56 PM, Andrew Lunn wrote:
> 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>
> ---
> v2: Remove include of netdev.h
> ---

Feel free to add:

Tested-by: Dinh Nguyen <dinguyen@opensource.altera.com>

Thanks,
Dinh

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCHv2 net] phy: micrel: Fix finding PHY properties in MAC node.
  2015-12-09 18:56 [PATCHv2 net] phy: micrel: Fix finding PHY properties in MAC node Andrew Lunn
  2015-12-09 19:39 ` Dinh Nguyen
@ 2015-12-09 21:40 ` Florian Fainelli
  2015-12-09 21:57   ` Andrew Lunn
  2015-12-12  1:32 ` David Miller
  2 siblings, 1 reply; 5+ messages in thread
From: Florian Fainelli @ 2015-12-09 21:40 UTC (permalink / raw)
  To: Andrew Lunn, David Miller; +Cc: netdev, dinguyen, david.daney



On December 9, 2015 10:56:31 AM PST, Andrew Lunn <andrew@lunn.ch> wrote:
>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>
>---

>-	if (!of_node && dev->parent->of_node)
>-		of_node = dev->parent->of_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->of_node;
>+		dev_walker = dev_walker->parent;
>+
>+	} while (!of_node && dev_walker);

Looks good to me, can we also issuing à warning so people get a chance to update their Device Tree?

Acked-by: Florian Fainelli <f.fainelli@gmail.com>
> 
> 	if (of_node) {
> 		ksz9021_load_values_from_of(phydev, of_node,

-- 
Florian

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCHv2 net] phy: micrel: Fix finding PHY properties in MAC node.
  2015-12-09 21:40 ` Florian Fainelli
@ 2015-12-09 21:57   ` Andrew Lunn
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Lunn @ 2015-12-09 21:57 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: David Miller, netdev, dinguyen, david.daney

> >-	if (!of_node && dev->parent->of_node)
> >-		of_node = dev->parent->of_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->of_node;
> >+		dev_walker = dev_walker->parent;
> >+
> >+	} while (!of_node && dev_walker);
> 
> Looks good to me, can we also issuing à warning so people get a chance to update their Device Tree?

I did wounder about that.

But i think it might be better to wait until there are updated dts
files. No point telling users they need to update when there are no
updated DT files to use.

If Dinh updates the SoCFPGA .dts files then i think it makes sense to
add the warning.

    Andrew

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCHv2 net] phy: micrel: Fix finding PHY properties in MAC node.
  2015-12-09 18:56 [PATCHv2 net] phy: micrel: Fix finding PHY properties in MAC node Andrew Lunn
  2015-12-09 19:39 ` Dinh Nguyen
  2015-12-09 21:40 ` Florian Fainelli
@ 2015-12-12  1:32 ` David Miller
  2 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2015-12-12  1:32 UTC (permalink / raw)
  To: andrew; +Cc: netdev, f.fainelli, dinguyen, david.daney

From: Andrew Lunn <andrew@lunn.ch>
Date: Wed,  9 Dec 2015 19:56:31 +0100

> 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>

Applied and queued up for -stable, thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-12-12  1:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-09 18:56 [PATCHv2 net] phy: micrel: Fix finding PHY properties in MAC node Andrew Lunn
2015-12-09 19:39 ` Dinh Nguyen
2015-12-09 21:40 ` Florian Fainelli
2015-12-09 21:57   ` Andrew Lunn
2015-12-12  1:32 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.