arm: 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. Some warts are remaining and should be killed off (by moving the func to the appropriate board init code): - davinci_eth_set_mac_addr - cs8900_get_enetaddr - smc_set_mac_addr Signed-off-by: Mike Frysinger <vapier@gentoo.org> CC: Ben Warren <biggerbadderben@gmail.com>
This commit is contained in:
parent
0107cf66f7
commit
f11e6ff5b1
|
@ -73,7 +73,7 @@ const char version_string[] =
|
||||||
U_BOOT_VERSION" (" U_BOOT_DATE " - " U_BOOT_TIME ")"CONFIG_IDENT_STRING;
|
U_BOOT_VERSION" (" U_BOOT_DATE " - " U_BOOT_TIME ")"CONFIG_IDENT_STRING;
|
||||||
|
|
||||||
#ifdef CONFIG_DRIVER_CS8900
|
#ifdef CONFIG_DRIVER_CS8900
|
||||||
extern void cs8900_get_enetaddr (uchar * addr);
|
extern void cs8900_get_enetaddr (void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_DRIVER_RTL8019
|
#ifdef CONFIG_DRIVER_RTL8019
|
||||||
|
@ -379,34 +379,6 @@ void start_armboot (void)
|
||||||
/* IP Address */
|
/* IP Address */
|
||||||
gd->bd->bi_ip_addr = getenv_IPaddr ("ipaddr");
|
gd->bd->bi_ip_addr = getenv_IPaddr ("ipaddr");
|
||||||
|
|
||||||
/* MAC Address */
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
ulong reg;
|
|
||||||
char *s, *e;
|
|
||||||
char tmp[64];
|
|
||||||
|
|
||||||
i = getenv_r ("ethaddr", tmp, sizeof (tmp));
|
|
||||||
s = (i > 0) ? tmp : NULL;
|
|
||||||
|
|
||||||
for (reg = 0; reg < 6; ++reg) {
|
|
||||||
gd->bd->bi_enetaddr[reg] = s ? simple_strtoul (s, &e, 16) : 0;
|
|
||||||
if (s)
|
|
||||||
s = (*e) ? e + 1 : e;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef CONFIG_HAS_ETH1
|
|
||||||
i = getenv_r ("eth1addr", tmp, sizeof (tmp));
|
|
||||||
s = (i > 0) ? tmp : NULL;
|
|
||||||
|
|
||||||
for (reg = 0; reg < 6; ++reg) {
|
|
||||||
gd->bd->bi_enet1addr[reg] = s ? simple_strtoul (s, &e, 16) : 0;
|
|
||||||
if (s)
|
|
||||||
s = (*e) ? e + 1 : e;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
devices_init (); /* get the devices list going. */
|
devices_init (); /* get the devices list going. */
|
||||||
|
|
||||||
#ifdef CONFIG_CMC_PU2
|
#ifdef CONFIG_CMC_PU2
|
||||||
|
@ -432,19 +404,26 @@ void start_armboot (void)
|
||||||
|
|
||||||
/* Perform network card initialisation if necessary */
|
/* Perform network card initialisation if necessary */
|
||||||
#ifdef CONFIG_DRIVER_TI_EMAC
|
#ifdef CONFIG_DRIVER_TI_EMAC
|
||||||
|
/* XXX: this needs to be moved to board init */
|
||||||
extern void davinci_eth_set_mac_addr (const u_int8_t *addr);
|
extern void davinci_eth_set_mac_addr (const u_int8_t *addr);
|
||||||
if (getenv ("ethaddr")) {
|
if (getenv ("ethaddr")) {
|
||||||
davinci_eth_set_mac_addr(gd->bd->bi_enetaddr);
|
uchar enetaddr[6];
|
||||||
|
eth_getenv_enetaddr("ethaddr", enetaddr);
|
||||||
|
davinci_eth_set_mac_addr(enetaddr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_DRIVER_CS8900
|
#ifdef CONFIG_DRIVER_CS8900
|
||||||
cs8900_get_enetaddr (gd->bd->bi_enetaddr);
|
/* XXX: this needs to be moved to board init */
|
||||||
|
cs8900_get_enetaddr ();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_DRIVER_SMC91111) || defined (CONFIG_DRIVER_LAN91C96)
|
#if defined(CONFIG_DRIVER_SMC91111) || defined (CONFIG_DRIVER_LAN91C96)
|
||||||
|
/* XXX: this needs to be moved to board init */
|
||||||
if (getenv ("ethaddr")) {
|
if (getenv ("ethaddr")) {
|
||||||
smc_set_mac_addr(gd->bd->bi_enetaddr);
|
uchar enetaddr[6];
|
||||||
|
eth_getenv_enetaddr("ethaddr", enetaddr);
|
||||||
|
smc_set_mac_addr(enetaddr);
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_DRIVER_SMC91111 || CONFIG_DRIVER_LAN91C96 */
|
#endif /* CONFIG_DRIVER_SMC91111 || CONFIG_DRIVER_LAN91C96 */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue