diff options
author | Mike Frysinger <vapier@gentoo.org> | 2009-02-11 19:14:09 -0500 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2009-03-20 22:39:11 +0100 |
commit | c527ce92511cbf723c2ca77bee1cf9ecf83dac81 (patch) | |
tree | 90a981552d474d6e7d24f1ace37751ea21e004cf /drivers/net/sh_eth.c | |
parent | 0a5238cea90665c230297a8fd77bb0b3b61ca177 (diff) | |
download | u-boot-imx-c527ce92511cbf723c2ca77bee1cf9ecf83dac81.zip u-boot-imx-c527ce92511cbf723c2ca77bee1cf9ecf83dac81.tar.gz u-boot-imx-c527ce92511cbf723c2ca77bee1cf9ecf83dac81.tar.bz2 |
sh_eth: get mac address from environment
The environment is the canonical storage location of the mac address, so
we're killing off the global data location and moving everything to
querying the env directly.
The sh_eth driver can also be simplified a bit by using enetaddr member of
the eth_device structure.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
CC: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
CC: Carlos Munoz <carlos@kenati.com>
CC: Ben Warren <biggerbadderben@gmail.com>
Diffstat (limited to 'drivers/net/sh_eth.c')
-rw-r--r-- | drivers/net/sh_eth.c | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c index bee3f02..f24ded2 100644 --- a/drivers/net/sh_eth.c +++ b/drivers/net/sh_eth.c @@ -514,6 +514,7 @@ static int sh_eth_config(struct sh_eth_dev *eth, bd_t *bd) int port = eth->port, ret = 0; u32 val, phy_status; struct sh_eth_info *port_info = ð->port_info[port]; + struct eth_device *dev = port_info->dev; /* Configure e-dmac registers */ outl((inl(EDMR(port)) & ~EMDR_DESC_R) | EDMR_EL, EDMR(port)); @@ -529,11 +530,11 @@ static int sh_eth_config(struct sh_eth_dev *eth, bd_t *bd) outl(0, ECSIPR(port)); /* Set Mac address */ - val = bd->bi_enetaddr[0] << 24 | bd->bi_enetaddr[1] << 16 | - bd->bi_enetaddr[2] << 8 | bd->bi_enetaddr[3]; + val = dev->enetaddr[0] << 24 | dev->enetaddr[1] << 16 | + dev->enetaddr[2] << 8 | dev->enetaddr[3]; outl(val, MAHR(port)); - val = bd->bi_enetaddr[4] << 8 | bd->bi_enetaddr[5]; + val = dev->enetaddr[4] << 8 | dev->enetaddr[5]; outl(val, MALR(port)); outl(RFLR_RFL_MIN, RFLR(port)); @@ -589,24 +590,6 @@ static void sh_eth_stop(struct sh_eth_dev *eth) outl(~EDRRR_R, EDRRR(eth->port)); } -static int sh_eth_get_mac(bd_t *bd) -{ - char *s, *e; - - s = getenv("ethaddr"); - if (s != NULL) { - int i; - for (i = 0; i < 6; ++i) { - bd->bi_enetaddr[i] = s ? simple_strtoul(s, &e, 16) : 0; - if (s) - s = (*e) ? e + 1 : e; - } - } else { - puts("Please set MAC address\n"); - } - return 0; -} - int sh_eth_init(struct eth_device *dev, bd_t *bd) { int ret = 0; @@ -680,7 +663,8 @@ int sh_eth_initialize(bd_t *bd) /* Register Device to EtherNet subsystem */ eth_register(dev); - sh_eth_get_mac(bd); + if (!eth_getenv_enetaddr("ethaddr", dev->enetaddr)) + puts("Please set MAC address\n"); return ret; |