diff options
author | Tom Rini <trini@konsulko.com> | 2022-05-04 09:05:03 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-05-04 09:05:03 -0400 |
commit | c3d451d5e6b7c2ea6d83397d5b6c986ff6ab4ee3 (patch) | |
tree | 9101cb7a943fe6d055c08b64de8c8e05f09c591b /net/mdio-uclass.c | |
parent | 4209f7444541b67bf0505c5f1feccc585fb42583 (diff) | |
parent | 95a3a6ee086d47a8e0cd573e327fd48a97d87439 (diff) |
Merge https://source.denx.de/u-boot/custodians/u-boot-marvell
- mips: octeon: Add ethernet support (Aaron & Stefan)
- Misc mvneta changes, cleanups, fixes (Marek)
Diffstat (limited to 'net/mdio-uclass.c')
-rw-r--r-- | net/mdio-uclass.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/net/mdio-uclass.c b/net/mdio-uclass.c index 7593618d9ad..4401492ca01 100644 --- a/net/mdio-uclass.c +++ b/net/mdio-uclass.c @@ -129,6 +129,28 @@ static int dm_mdio_pre_remove(struct udevice *dev) return 0; } +struct phy_device *dm_phy_find_by_ofnode(ofnode phynode) +{ + struct mdio_perdev_priv *pdata; + struct udevice *mdiodev; + u32 phy_addr; + + if (ofnode_read_u32(phynode, "reg", &phy_addr)) + return NULL; + + if (uclass_get_device_by_ofnode(UCLASS_MDIO, + ofnode_get_parent(phynode), + &mdiodev)) + return NULL; + + if (device_probe(mdiodev)) + return NULL; + + pdata = dev_get_uclass_priv(mdiodev); + + return phy_find_by_mask(pdata->mii_bus, BIT(phy_addr)); +} + struct phy_device *dm_mdio_phy_connect(struct udevice *mdiodev, int phyaddr, struct udevice *ethdev, phy_interface_t interface) |