diff options
| author | Tom Rini <[email protected]> | 2024-03-28 11:05:30 -0400 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2024-03-28 11:05:30 -0400 |
| commit | 7761226e6aebfa20f32a8a6396bc9f18a1dd7643 (patch) | |
| tree | 73a4e1f0bb16dd59e65876e39f420e5cc3984f22 /net | |
| parent | 24eb391e1ae4b8886e9db4f71417b44030325eb9 (diff) | |
| parent | ba291718d7ab9ca0dc1c3c357d817bb12f587af0 (diff) | |
Merge branch '2024-03-28-assorted-net-changes' into next
- A few ncsi PHY fixes, clean up PHY GPIO reset code, support LEDs on
BCM54210E PHY, fix a signed shift overflow in the PHY code, hifemac
updates, E1000 i225-IT support, improve DM_MDIO+DM_PHY support and
enable it on the BeaglePlay platform.
Diffstat (limited to 'net')
| -rw-r--r-- | net/mdio-uclass.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/net/mdio-uclass.c b/net/mdio-uclass.c index 6fc7034111f..0ebfb2f1343 100644 --- a/net/mdio-uclass.c +++ b/net/mdio-uclass.c @@ -6,6 +6,8 @@ #include <common.h> #include <dm.h> +#include <dm/lists.h> +#include <eth_phy.h> #include <log.h> #include <malloc.h> #include <miiphy.h> @@ -121,6 +123,42 @@ static int mdio_reset(struct mii_dev *mii_bus) return dm_mdio_reset(mii_bus->priv); } +static int mdio_bind_phy_nodes(struct udevice *mdio_dev) +{ + ofnode mdio_node, phy_node; + struct udevice *phy_dev; + const char *node_name; + int ret; + + mdio_node = dev_ofnode(mdio_dev); + if (!ofnode_valid(mdio_node)) { + dev_dbg(mdio_dev, "invalid ofnode for mdio_dev\n"); + return -ENXIO; + } + + ofnode_for_each_subnode(phy_node, mdio_node) { + node_name = ofnode_get_name(phy_node); + dev_dbg(mdio_dev, "* Found child node: '%s'\n", node_name); + ret = device_bind_driver_to_node(mdio_dev, + "eth_phy_generic_drv", + node_name, phy_node, &phy_dev); + if (ret) { + dev_dbg(mdio_dev, " - Eth phy binding error: %d\n", ret); + continue; + } + + dev_dbg(mdio_dev, " - bound phy device: '%s'\n", node_name); + ret = device_probe(phy_dev); + if (ret) { + dev_dbg(mdio_dev, "Device '%s' probe failed\n", phy_dev->name); + device_unbind(phy_dev); + continue; + } + } + + return 0; +} + static int dm_mdio_post_probe(struct udevice *dev) { struct mdio_perdev_priv *pdata = dev_get_uclass_priv(dev); @@ -154,6 +192,9 @@ static int dm_mdio_post_probe(struct udevice *dev) } } + if (CONFIG_IS_ENABLED(DM_ETH_PHY)) + mdio_bind_phy_nodes(dev); + return mdio_register(pdata->mii_bus); } |
