summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMike Rapoport <mike@compulab.co.il>2007-08-12 08:48:27 +0300
committerBen Warren <bwarren@qstreams.com>2007-08-13 23:06:34 -0400
commit50cca8b976ec74069860208c36e64ce8f4d5e4c1 (patch)
tree52e8323efd924077a21bcc80604538fb2c4acd0f /drivers
parentd1bc6c8d5f4a9c7ca9fb2292d5c65f846dcc3995 (diff)
downloadu-boot-imx-50cca8b976ec74069860208c36e64ce8f4d5e4c1.zip
u-boot-imx-50cca8b976ec74069860208c36e64ce8f4d5e4c1.tar.gz
u-boot-imx-50cca8b976ec74069860208c36e64ce8f4d5e4c1.tar.bz2
Add ability to take MAC address from the environment to DM9000 driver
Signed-off-by: Mike Rapoport <mike@compulab.co.il> Signed-off-by: Ben Warren <bwarren@qstreams.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/dm9000x.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/dm9000x.c b/drivers/dm9000x.c
index 6877076..78acb09 100644
--- a/drivers/dm9000x.c
+++ b/drivers/dm9000x.c
@@ -302,6 +302,21 @@ eth_init(bd_t * bd)
/* Set Node address */
for (i = 0; i < 6; i++)
((u16 *) bd->bi_enetaddr)[i] = read_srom_word(i);
+
+ if (!is_zero_ether_addr(bd->bi_enetaddr) &&
+ !is_mutlicast_ether_addr(bd->bi_enetaddr)) {
+ /* try reading from environment */
+ u8 i;
+ char *s, *e;
+ s = getenv ("ethaddr");
+ for (i = 0; i < 6; ++i) {
+ bd->bi_enetaddr[i] = s ?
+ simple_strtoul (s, &e, 16) : 0;
+ if (s)
+ s = (*e) ? e + 1 : e;
+ }
+ }
+
printf("MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", bd->bi_enetaddr[0],
bd->bi_enetaddr[1], bd->bi_enetaddr[2], bd->bi_enetaddr[3],
bd->bi_enetaddr[4], bd->bi_enetaddr[5]);