diff options
author | Andy Duan <fugang.duan@nxp.com> | 2017-01-19 14:22:29 +0800 |
---|---|---|
committer | Andy Duan <fugang.duan@nxp.com> | 2017-01-19 14:45:09 +0800 |
commit | df42b7b0c5e6847f32419075eb25f274ed039d6f (patch) | |
tree | a77c24fca5661610e7564976f4bc5eb437c85d5e | |
parent | 7e4a55b068311d46d16e86e697d36f34a59bf47a (diff) | |
download | u-boot-imx-df42b7b0c5e6847f32419075eb25f274ed039d6f.zip u-boot-imx-df42b7b0c5e6847f32419075eb25f274ed039d6f.tar.gz u-boot-imx-df42b7b0c5e6847f32419075eb25f274ed039d6f.tar.bz2 |
MLK-13782 net: fec_mxc: specify the registered eth index by dev_id
Specify the registered eth index by dev_id.
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
-rw-r--r-- | drivers/net/fec_mxc.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c index 8ea81f9..7940db4 100644 --- a/drivers/net/fec_mxc.c +++ b/drivers/net/fec_mxc.c @@ -980,6 +980,7 @@ static int fec_probe(bd_t *bd, int dev_id, uint32_t base_addr, struct eth_device *edev; struct fec_priv *fec; unsigned char ethaddr[6]; + char mac[16]; uint32_t start; int ret = 0; @@ -1042,12 +1043,18 @@ static int fec_probe(bd_t *bd, int dev_id, uint32_t base_addr, fec->phy_id = phy_id; #endif eth_register(edev); + /* only support one eth device, the index number pointed by dev_id */ + edev->index = fec->dev_id; if (fec_get_hwaddr(edev, fec->dev_id, ethaddr) == 0) { debug("got MAC%d address from fuse: %pM\n", fec->dev_id, ethaddr); memcpy(edev->enetaddr, ethaddr, 6); - if (!getenv("ethaddr")) - eth_setenv_enetaddr("ethaddr", ethaddr); + if (fec->dev_id) + sprintf(mac, "eth%daddr", fec->dev_id); + else + strcpy(mac, "ethaddr"); + if (!getenv(mac)) + eth_setenv_enetaddr(mac, ethaddr); } return ret; err4: |