diff --git a/uboot-mtk-20220606/cmd/glbtn.c b/uboot-mtk-20220606/cmd/glbtn.c index ded5398af..12f838cab 100644 --- a/uboot-mtk-20220606/cmd/glbtn.c +++ b/uboot-mtk-20220606/cmd/glbtn.c @@ -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; diff --git a/uboot-mtk-20220606/common/autoboot.c b/uboot-mtk-20220606/common/autoboot.c index c029e7b77..cca8aeb3c 100644 --- a/uboot-mtk-20220606/common/autoboot.c +++ b/uboot-mtk-20220606/common/autoboot.c @@ -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 : ""); @@ -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); diff --git a/uboot-mtk-20220606/configs/gl_mt2500_defconfig b/uboot-mtk-20220606/configs/gl_mt2500_defconfig index 842d0fa32..6a09be4f6 100644 --- a/uboot-mtk-20220606/configs/gl_mt2500_defconfig +++ b/uboot-mtk-20220606/configs/gl_mt2500_defconfig @@ -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 diff --git a/uboot-mtk-20220606/configs/gl_mt3000_defconfig b/uboot-mtk-20220606/configs/gl_mt3000_defconfig index a1402c9a5..40fcc4539 100644 --- a/uboot-mtk-20220606/configs/gl_mt3000_defconfig +++ b/uboot-mtk-20220606/configs/gl_mt3000_defconfig @@ -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 diff --git a/uboot-mtk-20220606/include/phy.h b/uboot-mtk-20220606/include/phy.h index b32959571..1ae4330cb 100644 --- a/uboot-mtk-20220606/include/phy.h +++ b/uboot-mtk-20220606/include/phy.h @@ -62,7 +62,7 @@ struct udevice; SUPPORTED_10000baseT_Full) #ifndef PHY_ANEG_TIMEOUT -#define PHY_ANEG_TIMEOUT 4000 +#define PHY_ANEG_TIMEOUT 2000 #endif