提交 651df218 编写于 作者: A Andrew Lunn 提交者: David S. Miller

phy: micrel: Fix finding PHY properties in MAC node.

commit 8b63ec18 ("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: NDinh Nguyen <dinguyen@opensource.altera.com>
Suggested-by: NDavid Daney <david.daney@cavium.com>
Acked-by: NDavid Daney <david.daney@cavium.com>
Fixes: 8b63ec18 ("phylib: Make PHYs children of their MDIO bus, not the bus' parent.")
Signed-off-by: NAndrew Lunn <andrew@lunn.ch>
Tested-by: NDinh Nguyen <dinguyen@opensource.altera.com>
Acked-by: NFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 9470e24f
......@@ -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,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册