]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
net: fec: set phy_of_node properly for fixed-link phy
authorTim Harvey <tharvey@gateworks.com>
Wed, 30 Jun 2021 23:50:04 +0000 (16:50 -0700)
committerStefano Babic <sbabic@denx.de>
Sat, 10 Jul 2021 16:12:41 +0000 (18:12 +0200)
If the FEC is connected to a fixed-link (upstream switch port for
example) the phy_of_node should be set to the fixed-link node
so that speed and other properties can be found properly.

In addition fix a typo in the debug string.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
drivers/net/fec_mxc.c

index 3abf9148333ab4feca5e36bc3d7a0a3454cac7d4..77680491d0d62cab18e2b373786eea601ca31066 100644 (file)
@@ -1304,7 +1304,11 @@ static int device_get_phy_addr(struct fec_priv *priv, struct udevice *dev)
        ret = dev_read_phandle_with_args(dev, "phy-handle", NULL, 0, 0,
                                         &phandle_args);
        if (ret) {
-               debug("Failed to find phy-handle (err = %d\n)", ret);
+               priv->phy_of_node = ofnode_find_subnode(dev_ofnode(dev),
+                                                       "fixed-link");
+               if (ofnode_valid(priv->phy_of_node))
+                       return 0;
+               debug("Failed to find phy-handle (err = %d)\n", ret);
                return ret;
        }