1 --- a/board/mediatek/mt7622/mt7622_rfb.c
2 +++ b/board/mediatek/mt7622/mt7622_rfb.c
11 #include <asm/global_data.h>
12 +#include <linux/delay.h>
14 +#ifndef CONFIG_RESET_BUTTON_LABEL
15 +#define CONFIG_RESET_BUTTON_LABEL "reset"
18 DECLARE_GLOBAL_DATA_PTR;
20 @@ -20,7 +27,19 @@ int board_init(void)
22 int board_late_init(void)
24 - gd->env_valid = 1; //to load environment variable from persistent store
25 + struct udevice *dev;
28 + ret = !!button_get_by_label(CONFIG_RESET_BUTTON_LABEL, &dev);
31 +#ifdef CONFIG_RESET_BUTTON_SETTLE_DELAY
32 + udelay(1000 * CONFIG_RESET_BUTTON_SETTLE_DELAY);
34 + ret = !button_get_state(dev);
37 + gd->env_valid = ret; //to load environment variable from persistent store