summaryrefslogtreecommitdiff
path: root/drivers/net/fec_mxc.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2019-01-30 07:22:12 -0500
committerTom Rini <trini@konsulko.com>2019-01-30 07:22:12 -0500
commit748ad078eefea2ee5a3c8e53ca46e9e93c2fc7f1 (patch)
tree0067011f4422174e2834136f83ebe417dfa260d7 /drivers/net/fec_mxc.c
parent1b35c90836e5660a37ed33581f06ebb0b36b01ad (diff)
parent6d69e535116ba9d6d3b8e4dc57cf3543301b59df (diff)
Merge tag 'u-boot-imx-20190129' of git://git.denx.de/u-boot-imx
For 2019.04
Diffstat (limited to 'drivers/net/fec_mxc.c')
-rw-r--r--drivers/net/fec_mxc.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 32fb34b793..1a59026a62 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -1264,11 +1264,32 @@ static const struct eth_ops fecmxc_ops = {
.read_rom_hwaddr = fecmxc_read_rom_hwaddr,
};
+static int device_get_phy_addr(struct udevice *dev)
+{
+ struct ofnode_phandle_args phandle_args;
+ int reg;
+
+ if (dev_read_phandle_with_args(dev, "phy-handle", NULL, 0, 0,
+ &phandle_args)) {
+ debug("Failed to find phy-handle");
+ return -ENODEV;
+ }
+
+ reg = ofnode_read_u32_default(phandle_args.node, "reg", 0);
+
+ return reg;
+}
+
static int fec_phy_init(struct fec_priv *priv, struct udevice *dev)
{
struct phy_device *phydev;
+ int addr;
int mask = 0xffffffff;
+ addr = device_get_phy_addr(dev);
+ if (addr >= 0)
+ mask = 1 << addr;
+
#ifdef CONFIG_FEC_MXC_PHYADDR
mask = 1 << CONFIG_FEC_MXC_PHYADDR;
#endif