aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/fec_mxc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/fec_mxc.c')
-rw-r--r--drivers/net/fec_mxc.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 3046305cfb6..910c961a60e 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -28,6 +28,7 @@
#include <asm-generic/gpio.h>
#include "fec_mxc.h"
+#include <eth_phy.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -1444,16 +1445,27 @@ static int fecmxc_probe(struct udevice *dev)
fec_reg_setup(priv);
priv->dev_id = dev->seq;
+
+#ifdef CONFIG_DM_ETH_PHY
+ bus = eth_phy_get_mdio_bus(dev);
+#endif
+
+ if (!bus) {
#ifdef CONFIG_FEC_MXC_MDIO_BASE
- bus = fec_get_miibus((ulong)CONFIG_FEC_MXC_MDIO_BASE, dev->seq);
+ bus = fec_get_miibus((ulong)CONFIG_FEC_MXC_MDIO_BASE, dev->seq);
#else
- bus = fec_get_miibus((ulong)priv->eth, dev->seq);
+ bus = fec_get_miibus((ulong)priv->eth, dev->seq);
#endif
+ }
if (!bus) {
ret = -ENOMEM;
goto err_mii;
}
+#ifdef CONFIG_DM_ETH_PHY
+ eth_phy_set_mdio_bus(dev, bus);
+#endif
+
priv->bus = bus;
priv->interface = pdata->phy_interface;
switch (priv->interface) {