1 --- a/board/mediatek/mt7623/mt7623_rfb.c
2 +++ b/board/mediatek/mt7623/mt7623_rfb.c
13 #include <asm/global_data.h>
14 +#include <linux/delay.h>
16 +#ifndef CONFIG_RESET_BUTTON_LABEL
17 +#define CONFIG_RESET_BUTTON_LABEL "reset"
20 DECLARE_GLOBAL_DATA_PTR;
22 @@ -60,3 +69,25 @@ int mmc_get_env_dev(void)
27 +int board_late_init(void)
29 + struct udevice *dev;
31 + if (!button_get_by_label(CONFIG_RESET_BUTTON_LABEL, &dev)) {
32 + puts("reset button found\n");
33 +#ifdef CONFIG_RESET_BUTTON_SETTLE_DELAY
34 + if (CONFIG_RESET_BUTTON_SETTLE_DELAY > 0) {
35 + button_get_state(dev);
36 + mdelay(CONFIG_RESET_BUTTON_SETTLE_DELAY);
39 + if (button_get_state(dev) == BUTTON_ON) {
40 + puts("button pushed, resetting environment\n");
41 + gd->env_valid = ENV_INVALID;