Skip to content

Commit

Permalink
of_mdio / mdiobus: ensure mdio devices have fwnode correctly populated
Browse files Browse the repository at this point in the history
Ensure that all mdio devices populate the struct device fwnode pointer
as well as the of_node pointer to allow drivers that wish to use
fwnode APIs to work.

Signed-off-by: Russell King <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
Reviewed-by: Andrew Lunn <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Russell King authored and davem330 committed Dec 13, 2017
1 parent f5e6403 commit 94a5ef1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/net/phy/mdio_bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ static void of_mdiobus_link_mdiodev(struct mii_bus *bus,

if (addr == mdiodev->addr) {
dev->of_node = child;
dev->fwnode = of_fwnode_handle(child);
return;
}
}
Expand Down
3 changes: 3 additions & 0 deletions drivers/of/of_mdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ static int of_mdiobus_register_phy(struct mii_bus *mdio,
* can be looked up later */
of_node_get(child);
phy->mdio.dev.of_node = child;
phy->mdio.dev.fwnode = of_fwnode_handle(child);

/* All data is now stored in the phy struct;
* register it */
Expand Down Expand Up @@ -111,6 +112,7 @@ static int of_mdiobus_register_device(struct mii_bus *mdio,
*/
of_node_get(child);
mdiodev->dev.of_node = child;
mdiodev->dev.fwnode = of_fwnode_handle(child);

/* All data is now stored in the mdiodev struct; register it. */
rc = mdio_device_register(mdiodev);
Expand Down Expand Up @@ -206,6 +208,7 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
mdio->phy_mask = ~0;

mdio->dev.of_node = np;
mdio->dev.fwnode = of_fwnode_handle(np);

/* Get bus level PHY reset GPIO details */
mdio->reset_delay_us = DEFAULT_GPIO_RESET_DELAY;
Expand Down

0 comments on commit 94a5ef1

Please sign in to comment.