summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYe Li <ye.li@nxp.com>2017-09-26 00:44:47 -0500
committerYe Li <ye.li@nxp.com>2017-09-26 00:44:47 -0500
commit543559e03fb78cbfb58480584fd637c5fa6d9b4e (patch)
tree19f2ecdffafa7be73e2efe7c60f5e5f96da3c385
parentaf61fd630e50abf59d363040a63e01ae96391f14 (diff)
MLK-16535 net: fec: Fix issue in DM probe function
Met a problem that mii command fails to work after u-boot booting up. The root cause is the fec_probe function initializes ethernet PHY first, then reset the FEC controller. This causes the mii_speed register reset to 0 and lead mdio can't work. Change the flow to reset FEC controller prior than setup PHY. Signed-off-by: Ye Li <ye.li@nxp.com>
-rw-r--r--drivers/net/fec_mxc.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 4c9fd73def..d137c96f19 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -1286,20 +1286,7 @@ static int fecmxc_probe(struct udevice *dev)
if (ret)
return ret;
-#ifdef CONFIG_FEC_MXC_MDIO_BASE
- bus = fec_get_miibus((ulong)CONFIG_FEC_MXC_MDIO_BASE, dev->seq);
-#else
- bus = fec_get_miibus((ulong)priv->eth, dev->seq);
-#endif
- if (!bus)
- goto err_mii;
-
- priv->bus = bus;
priv->xcv_type = CONFIG_FEC_XCV_TYPE;
- priv->interface = pdata->phy_interface;
- ret = fec_phy_init(priv, dev);
- if (ret)
- goto err_phy;
/* Reset chip. */
writel(readl(&priv->eth->ecntrl) | FEC_ECNTRL_RESET,
@@ -1314,16 +1301,30 @@ static int fecmxc_probe(struct udevice *dev)
}
fec_reg_setup(priv);
+
+#ifdef CONFIG_FEC_MXC_MDIO_BASE
+ bus = fec_get_miibus((ulong)CONFIG_FEC_MXC_MDIO_BASE, dev->seq);
+#else
+ bus = fec_get_miibus((ulong)priv->eth, dev->seq);
+#endif
+ if (!bus)
+ goto err_mii;
+
+ priv->bus = bus;
+ priv->interface = pdata->phy_interface;
+ ret = fec_phy_init(priv, dev);
+ if (ret)
+ goto err_phy;
+
priv->dev_id = dev->seq;
return 0;
-err_timeout:
- free(priv->phydev);
err_phy:
mdio_unregister(bus);
free(bus);
err_mii:
+err_timeout:
fec_free_descs(priv);
return ret;
}