summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLothar Waßmann <LW@KARO-electronics.de>2017-06-27 13:23:16 (GMT)
committerStefano Babic <sbabic@denx.de>2017-07-12 07:44:22 (GMT)
commit306dd7dabd6472b8b66ab5106d5a6a516ef15d79 (patch)
tree767de80c5acf62e09ad3cbb27bfa1e2d811b1056
parent34d45d123aeaa0a23e5c9bf87eb996cb95df37b1 (diff)
downloadu-boot-306dd7dabd6472b8b66ab5106d5a6a516ef15d79.tar.xz
net: fec_mxc: fix PHY initialization bug with CONFIG_DM_ETH
When CONFIG_DM_ETH is set, the FEC ethernet controller is reset after the PHY has been set up and initialzed. This breaks the communication with the PHY and results in an inoperable ethernet interface. Do the initialization with CONFIG_DM_ETH in the same order as with legacy ETH support to fix this. Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
-rw-r--r--drivers/net/fec_mxc.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 6840908..4ad4ddc 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -1223,17 +1223,6 @@ static int fecmxc_probe(struct udevice *dev)
if (ret)
return ret;
- bus = fec_get_miibus((uint32_t)priv->eth, dev_id);
- 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,
&priv->eth->ecntrl);
@@ -1249,6 +1238,19 @@ static int fecmxc_probe(struct udevice *dev)
fec_reg_setup(priv);
priv->dev_id = (dev_id == -1) ? 0 : dev_id;
+ bus = fec_get_miibus(dev, dev_id);
+ if (!bus) {
+ ret = -ENOMEM;
+ 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;
+
return 0;
err_timeout: