
Currently we inject 5 ethernet addresses into the environment, just in case we may need them. We do this because some boards have no eeprom (programmed) with a proper ethernet address. With the recent addition of reading actual ethernet addresses from the eeprom via the net_op we should not inject environment variables any more.
Signed-off-by: Olliver Schinagl oliver@schinagl.nl --- board/sunxi/board.c | 45 +++++++++++++-------------------------------- 1 file changed, 13 insertions(+), 32 deletions(-)
diff --git a/board/sunxi/board.c b/board/sunxi/board.c index 9b56a89..71124f4 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -688,15 +688,19 @@ static void parse_spl_header(const uint32_t spl_addr) setenv_hex("fel_scriptaddr", spl->fel_script_address); }
-/* - * Note this function gets called multiple times. - * It must not make any changes to env variables which already exist. - */ -static void setup_environment(const void *fdt) +int misc_init_r(void) { char serial_string[17] = { 0 }; unsigned int sid[4]; - int ret; + __maybe_unused int ret; + + setenv("fel_booted", NULL); + setenv("fel_scriptaddr", NULL); + /* determine if we are running in FEL mode */ + if (!is_boot0_magic(SPL_ADDR + 4)) { /* eGON.BT0 */ + setenv("fel_booted", "1"); + parse_spl_header(SPL_ADDR); + }
ret = sunxi_get_sid(sid); if (ret == 0 && sid[0] != 0) { @@ -717,28 +721,11 @@ static void setup_environment(const void *fdt) sid[3] = crc32(0, (unsigned char *)&sid[1], 12); #endif
- if (!getenv("serial#")) { - snprintf(serial_string, sizeof(serial_string), - "%08x%08x", sid[0], sid[3]); + snprintf(serial_string, sizeof(serial_string), + "%08x%08x", sid[0], sid[3]);
- setenv("serial#", serial_string); - } + setenv("serial#", serial_string); } -} - -int misc_init_r(void) -{ - __maybe_unused int ret; - - setenv("fel_booted", NULL); - setenv("fel_scriptaddr", NULL); - /* determine if we are running in FEL mode */ - if (!is_boot0_magic(SPL_ADDR + 4)) { /* eGON.BT0 */ - setenv("fel_booted", "1"); - parse_spl_header(SPL_ADDR); - } - - setup_environment(gd->fdt_blob);
#ifndef CONFIG_MACH_SUN9I ret = sunxi_usb_phy_probe(); @@ -754,12 +741,6 @@ int ft_board_setup(void *blob, bd_t *bd) { int __maybe_unused r;
- /* - * Call setup_environment again in case the boot fdt has - * ethernet aliases the u-boot copy does not have. - */ - setup_environment(blob); - #ifdef CONFIG_VIDEO_DT_SIMPLEFB r = sunxi_simplefb_setup(blob); if (r)