summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeng Fan <peng.fan@nxp.com>2018-03-28 20:54:12 +0800
committerJoe Hershberger <joe.hershberger@ni.com>2018-04-13 15:47:37 -0500
commit1bcabd79215ece91ee8f79e768c4886efae182ba (patch)
tree15f5d726a329e5d9fac96b1d28de7ade49cf6a7e
parent07763ac9282f8d72c0f1e7d6c863a107997cbc3e (diff)
net: fec_mxc: simplify fec_get_miibus
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@nxp.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
-rw-r--r--drivers/net/fec_mxc.c15
-rw-r--r--include/netdev.h6
2 files changed, 4 insertions, 17 deletions
diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 450cc0b8ea2..74d36f479ec 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -1012,18 +1012,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 ethernet_regs *eth = (struct ethernet_regs *)base_addr;
struct mii_dev *bus;
int ret;
@@ -1283,7 +1274,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 86d28ade14b..68c6d49cbfc 100644
--- a/include/netdev.h
+++ b/include/netdev.h
@@ -117,11 +117,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;