[U-Boot] [PATCH 2/5] net: fec_mxc: simplify fec_get_miibus
Peng Fan
peng.fan at nxp.com
Sat Mar 10 01:19:54 UTC 2018
No need to provide two prototype for this function.
Use ulong for the first parameter, then this function
could be shared for DM/non DM case.
Signed-off-by: Peng Fan <peng.fan at nxp.com>
---
drivers/net/fec_mxc.c | 13 ++-----------
include/netdev.h | 6 +-----
2 files changed, 3 insertions(+), 16 deletions(-)
diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 7c396d8d95..2bd4ba4ef1 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -1021,18 +1021,9 @@ static void fec_free_descs(struct fec_priv *fec)
free(fec->tbd_base);
}
-#ifdef CONFIG_DM_ETH
-struct mii_dev *fec_get_miibus(struct udevice *dev, int dev_id)
-#else
-struct mii_dev *fec_get_miibus(uint32_t base_addr, int dev_id)
-#endif
+struct mii_dev *fec_get_miibus(ulong base_addr, int dev_id)
{
-#ifdef CONFIG_DM_ETH
- struct fec_priv *priv = dev_get_priv(dev);
- struct ethernet_regs *eth = priv->eth;
-#else
struct ethernet_regs *eth = (struct ethernet_regs *)(ulong)base_addr;
-#endif
struct mii_dev *bus;
int ret;
@@ -1284,7 +1275,7 @@ 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);
+ bus = fec_get_miibus((ulong)priv->eth, dev_id);
if (!bus) {
ret = -ENOMEM;
goto err_mii;
diff --git a/include/netdev.h b/include/netdev.h
index 3958a4cd32..c96f851be0 100644
--- a/include/netdev.h
+++ b/include/netdev.h
@@ -119,11 +119,7 @@ static inline int pci_eth_init(bd_t *bis)
return num;
}
-#ifdef CONFIG_DM_ETH
-struct mii_dev *fec_get_miibus(struct udevice *dev, int dev_id);
-#else
-struct mii_dev *fec_get_miibus(uint32_t base_addr, int dev_id);
-#endif
+struct mii_dev *fec_get_miibus(ulong base_addr, int dev_id);
#ifdef CONFIG_PHYLIB
struct phy_device;
--
2.14.1
More information about the U-Boot
mailing list