summaryrefslogtreecommitdiff
path: root/cpu/ixp/npe/npe.c
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2009-03-21 22:15:49 +0100
committerWolfgang Denk <wd@denx.de>2009-03-21 22:15:49 +0100
commitee1702d75a30d076139d1841383a1fa7220a0e11 (patch)
treeb008c231b7d5e4e52ac49aec9a49bc73413aaf30 /cpu/ixp/npe/npe.c
parente60beb13cf0135dc71c541021487b5ccc4d269cb (diff)
parentfaac4fd852e39cb1d7a740801b060e41aeacef1f (diff)
downloadu-boot-imx-ee1702d75a30d076139d1841383a1fa7220a0e11.zip
u-boot-imx-ee1702d75a30d076139d1841383a1fa7220a0e11.tar.gz
u-boot-imx-ee1702d75a30d076139d1841383a1fa7220a0e11.tar.bz2
Merge branch 'next' of ../next
Diffstat (limited to 'cpu/ixp/npe/npe.c')
-rw-r--r--cpu/ixp/npe/npe.c36
1 files changed, 11 insertions, 25 deletions
diff --git a/cpu/ixp/npe/npe.c b/cpu/ixp/npe/npe.c
index 03e3bf7..2e68689 100644
--- a/cpu/ixp/npe/npe.c
+++ b/cpu/ixp/npe/npe.c
@@ -565,25 +565,19 @@ int npe_initialize(bd_t * bis)
struct eth_device *dev;
int eth_num = 0;
struct npe *p_npe = NULL;
+ uchar enetaddr[6];
for (eth_num = 0; eth_num < CONFIG_SYS_NPE_NUMS; eth_num++) {
/* See if we can actually bring up the interface, otherwise, skip it */
- switch (eth_num) {
- default: /* fall through */
- case 0:
- if (memcmp (bis->bi_enetaddr, "\0\0\0\0\0\0", 6) == 0) {
- continue;
- }
- break;
#ifdef CONFIG_HAS_ETH1
- case 1:
- if (memcmp (bis->bi_enet1addr, "\0\0\0\0\0\0", 6) == 0) {
+ if (eth_num == 1) {
+ if (!eth_getenv_enetaddr("eth1addr", enetaddr))
continue;
- }
- break;
+ } else
#endif
- }
+ if (!eth_getenv_enetaddr("ethaddr", enetaddr))
+ continue;
/* Allocate device structure */
dev = (struct eth_device *)malloc(sizeof(*dev));
@@ -603,22 +597,14 @@ int npe_initialize(bd_t * bis)
}
memset(p_npe, 0, sizeof(struct npe));
- switch (eth_num) {
- default: /* fall through */
- case 0:
- memcpy(dev->enetaddr, bis->bi_enetaddr, 6);
- p_npe->eth_id = 0;
- p_npe->phy_no = CONFIG_PHY_ADDR;
- break;
-
+ p_npe->eth_id = eth_num;
+ memcpy(dev->enetaddr, enetaddr, 6);
#ifdef CONFIG_HAS_ETH1
- case 1:
- memcpy(dev->enetaddr, bis->bi_enet1addr, 6);
- p_npe->eth_id = 1;
+ if (eth_num == 1)
p_npe->phy_no = CONFIG_PHY1_ADDR;
- break;
+ else
#endif
- }
+ p_npe->phy_no = CONFIG_PHY_ADDR;
sprintf(dev->name, "NPE%d", eth_num);
dev->priv = (void *)p_npe;