Commit 4266aac456c61079979e0269ccf2312a6850686c
Committed by
Ye Li
1 parent
0cb58cfb87
Exists in
smarc_8mm-imx_v2018.03_4.14.98_2.0.0_ga
and in
5 other branches
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>
Showing 2 changed files with 5 additions and 18 deletions Side-by-side Diff
drivers/net/fec_mxc.c
| ... | ... | @@ -1011,18 +1011,9 @@ |
| 1011 | 1011 | free(fec->tbd_base); |
| 1012 | 1012 | } |
| 1013 | 1013 | |
| 1014 | -#ifdef CONFIG_DM_ETH | |
| 1015 | -struct mii_dev *fec_get_miibus(struct udevice *dev, int dev_id) | |
| 1016 | -#else | |
| 1017 | -struct mii_dev *fec_get_miibus(uint32_t base_addr, int dev_id) | |
| 1018 | -#endif | |
| 1014 | +struct mii_dev *fec_get_miibus(ulong base_addr, int dev_id) | |
| 1019 | 1015 | { |
| 1020 | -#ifdef CONFIG_DM_ETH | |
| 1021 | - struct fec_priv *priv = dev_get_priv(dev); | |
| 1022 | - struct ethernet_regs *eth = priv->eth; | |
| 1023 | -#else | |
| 1024 | - struct ethernet_regs *eth = (struct ethernet_regs *)(ulong)base_addr; | |
| 1025 | -#endif | |
| 1016 | + struct ethernet_regs *eth = (struct ethernet_regs *)base_addr; | |
| 1026 | 1017 | struct mii_dev *bus; |
| 1027 | 1018 | int ret; |
| 1028 | 1019 | |
| ... | ... | @@ -1164,7 +1155,7 @@ |
| 1164 | 1155 | base_mii = addr; |
| 1165 | 1156 | #endif |
| 1166 | 1157 | debug("eth_init: fec_probe(bd, %i, %i) @ %08x\n", dev_id, phy_id, addr); |
| 1167 | - bus = fec_get_miibus(base_mii, dev_id); | |
| 1158 | + bus = fec_get_miibus((ulong)base_mii, dev_id); | |
| 1168 | 1159 | if (!bus) |
| 1169 | 1160 | return -ENOMEM; |
| 1170 | 1161 | #ifdef CONFIG_PHYLIB |
| ... | ... | @@ -1282,7 +1273,7 @@ |
| 1282 | 1273 | fec_reg_setup(priv); |
| 1283 | 1274 | priv->dev_id = (dev_id == -1) ? 0 : dev_id; |
| 1284 | 1275 | |
| 1285 | - bus = fec_get_miibus(dev, dev_id); | |
| 1276 | + bus = fec_get_miibus((ulong)priv->eth, dev_id); | |
| 1286 | 1277 | if (!bus) { |
| 1287 | 1278 | ret = -ENOMEM; |
| 1288 | 1279 | goto err_mii; |
include/netdev.h
| ... | ... | @@ -119,11 +119,7 @@ |
| 119 | 119 | return num; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | -#ifdef CONFIG_DM_ETH | |
| 123 | -struct mii_dev *fec_get_miibus(struct udevice *dev, int dev_id); | |
| 124 | -#else | |
| 125 | -struct mii_dev *fec_get_miibus(uint32_t base_addr, int dev_id); | |
| 126 | -#endif | |
| 122 | +struct mii_dev *fec_get_miibus(ulong base_addr, int dev_id); | |
| 127 | 123 | |
| 128 | 124 | #ifdef CONFIG_PHYLIB |
| 129 | 125 | struct phy_device; |