Skip to content
Snippets Groups Projects
Commit 979a5893 authored by Andy Duan's avatar Andy Duan Committed by Stefano Babic
Browse files

net: fec_mxc: specify the registered eth index by dev_id


Specify the registered eth index by dev_id.

Signed-off-by: default avatarFugang Duan <fugang.duan@nxp.com>
Signed-off-by: default avatarPeng Fan <peng.fan@nxp.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
parent f01e4e1e
No related branches found
No related tags found
No related merge requests found
...@@ -1023,6 +1023,7 @@ static int fec_probe(bd_t *bd, int dev_id, uint32_t base_addr, ...@@ -1023,6 +1023,7 @@ static int fec_probe(bd_t *bd, int dev_id, uint32_t base_addr,
struct eth_device *edev; struct eth_device *edev;
struct fec_priv *fec; struct fec_priv *fec;
unsigned char ethaddr[6]; unsigned char ethaddr[6];
char mac[16];
uint32_t start; uint32_t start;
int ret = 0; int ret = 0;
...@@ -1085,12 +1086,18 @@ static int fec_probe(bd_t *bd, int dev_id, uint32_t base_addr, ...@@ -1085,12 +1086,18 @@ static int fec_probe(bd_t *bd, int dev_id, uint32_t base_addr,
fec->phy_id = phy_id; fec->phy_id = phy_id;
#endif #endif
eth_register(edev); eth_register(edev);
/* only support one eth device, the index number pointed by dev_id */
edev->index = fec->dev_id;
if (fec_get_hwaddr(fec->dev_id, ethaddr) == 0) { if (fec_get_hwaddr(fec->dev_id, ethaddr) == 0) {
debug("got MAC%d address from fuse: %pM\n", fec->dev_id, ethaddr); debug("got MAC%d address from fuse: %pM\n", fec->dev_id, ethaddr);
memcpy(edev->enetaddr, ethaddr, 6); memcpy(edev->enetaddr, ethaddr, 6);
if (!getenv("ethaddr")) if (fec->dev_id)
eth_setenv_enetaddr("ethaddr", ethaddr); sprintf(mac, "eth%daddr", fec->dev_id);
else
strcpy(mac, "ethaddr");
if (!getenv(mac))
eth_setenv_enetaddr(mac, ethaddr);
} }
return ret; return ret;
err4: err4:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment