X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;ds=sidebyside;f=board%2Fpn62%2Fpn62.c;h=676f8d34f2a5c693604b14d8eb21fcd91be8beca;hb=47c5455a489c8e558ecb002a3a97a030ce490f9e;hp=1b545bfa9d5e9aed0730cf37c2006545df4fc855;hpb=156feb90d200f186cdfd856d7f6f1878bb1bec1e;p=u-boot diff --git a/board/pn62/pn62.c b/board/pn62/pn62.c index 1b545bfa9d..676f8d34f2 100644 --- a/board/pn62/pn62.c +++ b/board/pn62/pn62.c @@ -22,6 +22,7 @@ #include #include +#include #include #include @@ -30,7 +31,7 @@ DECLARE_GLOBAL_DATA_PTR; static int get_serial_number (char *string, int size); -static int get_mac_address (int id, u8 * mac, char *string, int size); +static void get_mac_address(int id, u8 *mac); #ifdef CONFIG_SHOW_BOOT_PROGRESS void show_boot_progress (int phase) @@ -138,18 +139,16 @@ int misc_init_r (void) } show_startup_phase (9); - if (getenv ("ethaddr") == NULL && - get_mac_address (0, mac, str, sizeof (str)) > 0) { - setenv ("ethaddr", str); - memcpy (gd->bd->bi_enetaddr, mac, 6); + if (!eth_getenv_enetaddr("ethaddr", mac)) { + get_mac_address(0, mac); + eth_setenv_enetaddr("ethaddr", mac); } show_startup_phase (10); #ifdef CONFIG_HAS_ETH1 - if (getenv ("eth1addr") == NULL && - get_mac_address (1, mac, str, sizeof (str)) > 0) { - setenv ("eth1addr", str); - memcpy (gd->bd->bi_enet1addr, mac, 6); + if (!eth_getenv_enetaddr("eth1addr", mac)) { + get_mac_address(1, mac); + eth_setenv_enetaddr("eth1addr", mac); } #endif /* CONFIG_HAS_ETH1 */ show_startup_phase (11); @@ -177,15 +176,9 @@ static int get_serial_number (char *string, int size) return i; } -static int get_mac_address (int id, u8 * mac, char *string, int size) +static void get_mac_address(int id, u8 *mac) { - if (size < 6 * 3) - return -1; - i2155x_read_vpd (I2155X_VPD_MAC0_START + 6 * id, 6, mac); - return sprintf (string, "%02x:%02x:%02x:%02x:%02x:%02x", - mac[0], mac[1], mac[2], - mac[3], mac[4], mac[5]); } int board_eth_init(bd_t *bis)