uboot: optimize the automatic upgrade time

This commit is contained in:
niyin
2022-09-12 20:01:00 -07:00
parent 7ce6c6c303
commit 4196c8d9c2
5 changed files with 12 additions and 11 deletions

View File

@@ -12,12 +12,6 @@ static void led_action_post(void *arg)
run_command("led blue:run on", 0);
}
static void try_auto_upgrade(void)
{
run_command("setenv tftptimeout 1000;setenv tftptimeoutcountmax 1;run lf && mtkboardboot", 0);
run_command("setenv tftptimeout;setenv tftptimeoutcountmax", 0);
}
static int do_glbtn(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
{
const char *button_label = "reset";
@@ -29,13 +23,11 @@ static int do_glbtn(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[
run_command("gpio clear 12", 0);
ret = button_get_by_label(button_label, &dev);
if (ret) {
try_auto_upgrade();
printf("Button '%s' not found (err=%d)\n", button_label, ret);
return CMD_RET_FAILURE;
}
if (!button_get_state(dev)) {
try_auto_upgrade();
poller_async_register(&led_p, "led_pa");
poller_call_async(&led_p, 1000000, led_action_post, NULL);
return CMD_RET_SUCCESS;

View File

@@ -481,6 +481,13 @@ const char *bootdelay_process(void)
return s;
}
static void try_auto_upgrade(void)
{
run_command("setenv tftptimeout 1000;setenv tftptimeoutcountmax 1;run lf && mtkboardboot", 0);
run_command("setenv tftptimeout;setenv tftptimeoutcountmax", 0);
}
void autoboot_command(const char *s)
{
debug("### main_loop: bootcmd=\"%s\"\n", s ? s : "<UNDEFINED>");
@@ -489,6 +496,8 @@ void autoboot_command(const char *s)
(stored_bootdelay != -1 && !abortboot(stored_bootdelay)))) {
bool lock;
int prev;
try_auto_upgrade();
lock = autoboot_keyed() &&
!IS_ENABLED(CONFIG_AUTOBOOT_KEYED_CTRLC);

View File

@@ -100,5 +100,5 @@ CONFIG_ENV_IMPORT_FDT=y
CONFIG_CMD_GL_BTN=y
CONFIG_CMD_LED_BLINK=y
CONFIG_HUSH_PARSER=y
CONFIG_ARP_TIMEOUT=2000
CONFIG_ARP_TIMEOUT=1000
CONFIG_NET_RETRY_COUNT=3

View File

@@ -90,5 +90,5 @@ CONFIG_ENV_IMPORT_FDT=y
CONFIG_CMD_GL_BTN=y
CONFIG_CMD_LED_BLINK=y
CONFIG_HUSH_PARSER=y
CONFIG_ARP_TIMEOUT=2000
CONFIG_ARP_TIMEOUT=1000
CONFIG_NET_RETRY_COUNT=3

View File

@@ -62,7 +62,7 @@ struct udevice;
SUPPORTED_10000baseT_Full)
#ifndef PHY_ANEG_TIMEOUT
#define PHY_ANEG_TIMEOUT 4000
#define PHY_ANEG_TIMEOUT 2000
#endif