Skip to content

Commit

Permalink
fix: repair check mac vaild timing
Browse files Browse the repository at this point in the history
Signed-off-by: Han Gao <[email protected]>
  • Loading branch information
RevySR committed Jul 11, 2023
1 parent d43b782 commit 93f965c
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions board/thead/light-c910/light.c
Original file line number Diff line number Diff line change
Expand Up @@ -1868,11 +1868,19 @@ static void light_usb_boot_check(void)
#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
env_set("usb_fastboot", "yes");
#endif

run_command("env default -a -f", 0);
run_command("env save", 0);
run_command("run gpt_partition", 0);
run_command("fastboot usb 0", 0);
}

static void light_mac_vaild_check(void)
{
/*Get this version ethaddr(mac addr) env,which follows one board, trans to next version env*/
env_ethaddr_flag = eth_env_get_enetaddr_by_index("eth", 0, env_enetaddr);
env_eth1addr_flag = eth_env_get_enetaddr_by_index("eth", 1, env_enet1addr);

run_command("env default -a -f", 0);
/*If mac addr in last version env is valid, before save,inherit env mac addr */
if(env_ethaddr_flag){
eth_env_set_enetaddr_by_index("eth", 0, env_enetaddr);
Expand All @@ -1897,10 +1905,6 @@ static void light_usb_boot_check(void)
//printf("env eth1addr not exist or invalid\n");
printf("use random addr as fixed mac addr\n");
}

run_command("env save", 0);
run_command("run gpt_partition", 0);
run_command("fastboot usb 0", 0);
}

int board_late_init(void)
Expand All @@ -1913,6 +1917,7 @@ int board_late_init(void)
sec_firmware_version_dump();
#endif
light_usb_boot_check();
light_mac_vaild_check();
ap_peri_clk_disable();
return 0;
}
Expand Down

0 comments on commit 93f965c

Please sign in to comment.