[U-Boot] [PATCH] net: kirkwood: updates: used eth_setenv_enetaddr api
Jean-Christophe PLAGNIOL-VILLARD
plagnioj at jcrosoft.com
Fri Aug 7 23:07:58 CEST 2009
On 22:17 Fri 07 Aug , Prafulla Wadaskar wrote:
> eth_setenv_enetaddr is avaible by upper layer
> using this saves 204 bytes on total image size
>
> Signed-off-by: Prafulla Wadaskar <prafulla at marvell.com>
> ---
> drivers/net/kirkwood_egiga.c | 13 ++++++++-----
> 1 files changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/kirkwood_egiga.c b/drivers/net/kirkwood_egiga.c
> index 3d908f8..1a208f2 100644
> --- a/drivers/net/kirkwood_egiga.c
> +++ b/drivers/net/kirkwood_egiga.c
> @@ -606,7 +606,7 @@ int kirkwood_egiga_initialize(bd_t * bis)
> struct kwgbe_device *dkwgbe;
> struct eth_device *dev;
> int devnum;
> - char *s, buf[NAMESIZE * 2];
> + char *s;
> u8 used_ports[MAX_KWGBE_DEVS] = CONFIG_KIRKWOOD_EGIGA_PORTS;
>
> for (devnum = 0; devnum < MAX_KWGBE_DEVS; devnum++) {
> @@ -665,10 +665,13 @@ int kirkwood_egiga_initialize(bd_t * bis)
>
> while (!eth_getenv_enetaddr(s, dev->enetaddr)) {
> /* Generate Ramdom MAC addresses if not set */
> - sprintf(buf, "00:50:43:%02x:%02x:%02x",
> - get_random_hex(), get_random_hex(),
> - get_random_hex());
> - setenv(s, buf);
> + dev->enetaddr[0] = 0x00;
> + dev->enetaddr[1] = 0x50;
> + dev->enetaddr[2] = 0x43;
> + dev->enetaddr[3] = get_random_hex();
> + dev->enetaddr[4] = get_random_hex();
> + dev->enetaddr[5] = get_random_hex();
> + eth_setenv_enetaddr(s, dev->enetaddr);
it will be also good to use a private mac address
dev->enetaddr[0] = 0x02;
Best Regards,
J.
More information about the U-Boot
mailing list