[U-Boot] [PATCH 07/10] dm: net: fec: Move enet init in fec_enet
Jagan Teki
jagan at amarulasolutions.com
Mon Jul 30 12:45:06 UTC 2018
Move enet initialization code in fec_enet function,
no functional changes.
Signed-off-by: Jagan Teki <jagan at amarulasolutions.com>
---
drivers/net/fec_mxc.c | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 3ae62ff9d1..76a3bd84f0 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -1254,11 +1254,8 @@ static int fec_phy_init(struct udevice *dev)
return 0;
}
-static int fecmxc_probe(struct udevice *dev)
+static int fec_enet_init(struct fec_priv *priv)
{
- struct eth_pdata *pdata = dev_get_platdata(dev);
- struct fec_priv *priv = dev_get_priv(dev);
- struct mii_dev *bus = NULL;
uint32_t start;
int ret;
@@ -1280,6 +1277,24 @@ static int fecmxc_probe(struct udevice *dev)
fec_reg_setup(priv);
+ return 0;
+
+err_timeout:
+ fec_free_descs(priv);
+ return ret;
+}
+
+static int fecmxc_probe(struct udevice *dev)
+{
+ struct eth_pdata *pdata = dev_get_platdata(dev);
+ struct fec_priv *priv = dev_get_priv(dev);
+ struct mii_dev *bus = NULL;
+ int ret;
+
+ ret = fec_enet_init(priv);
+ if (ret)
+ return ret;
+
priv->dev_id = dev->seq;
#ifdef CONFIG_FEC_MXC_MDIO_BASE
bus = fec_get_miibus((ulong)CONFIG_FEC_MXC_MDIO_BASE, dev->seq);
@@ -1303,7 +1318,6 @@ err_phy:
mdio_unregister(bus);
free(bus);
err_mii:
-err_timeout:
fec_free_descs(priv);
return ret;
}
--
2.18.0.321.gffc6fa0e3
More information about the U-Boot
mailing list