summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSean Anderson <sean.anderson@seco.com>2021-04-15 13:06:08 -0400
committerStefano Babic <sbabic@denx.de>2021-05-02 12:46:54 +0200
commiteccd132974f1f66247e72bbf3fd2bab71ab7d10e (patch)
tree1c7db2c5a6119d035d7788b93c8b0aa034949abf /drivers
parentcecd013fdfc740612c171cb3ffa5cabd88ffa1de (diff)
downloadu-boot-eccd132974f1f66247e72bbf3fd2bab71ab7d10e.tar.gz
u-boot-eccd132974f1f66247e72bbf3fd2bab71ab7d10e.tar.xz
u-boot-eccd132974f1f66247e72bbf3fd2bab71ab7d10e.zip
net: fec: Don't use disabled phys
If a phy is disabled, don't use it. This matches Linux's behavior. Signed-off-by: Sean Anderson <sean.anderson@seco.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/fec_mxc.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index ec21157d71..59f5a14e54 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -1299,16 +1299,19 @@ static const struct eth_ops fecmxc_ops = {
static int device_get_phy_addr(struct fec_priv *priv, struct udevice *dev)
{
struct ofnode_phandle_args phandle_args;
- int reg;
+ int reg, ret;
- if (dev_read_phandle_with_args(dev, "phy-handle", NULL, 0, 0,
- &phandle_args)) {
- debug("Failed to find phy-handle");
- return -ENODEV;
+ 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);
+ return ret;
}
- priv->phy_of_node = phandle_args.node;
+ if (!ofnode_is_available(phandle_args.node))
+ return -ENOENT;
+ priv->phy_of_node = phandle_args.node;
reg = ofnode_read_u32_default(phandle_args.node, "reg", 0);
return reg;