uboot: mt7622: do not auto erase uboot env when reset button is pressed (#131)
Fixes: 84cfb1511b ("uboot: mt7622: add rootdisk support from openwrt")
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
@@ -152,11 +152,4 @@ source "board/mediatek/mt7981/Kconfig"
|
||||
source "board/mediatek/mt7986/Kconfig"
|
||||
source "board/mediatek/mt7988/Kconfig"
|
||||
|
||||
config RESET_BUTTON_LABEL
|
||||
string "Button to trigger factory reset"
|
||||
default "reset"
|
||||
|
||||
config RESET_BUTTON_SETTLE_DELAY
|
||||
int "Delay to wait for button to settle"
|
||||
default 0
|
||||
endif
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include <common.h>
|
||||
#include <config.h>
|
||||
#include <dm.h>
|
||||
#include <button.h>
|
||||
#include <env.h>
|
||||
#include <init.h>
|
||||
#include <asm/global_data.h>
|
||||
@@ -15,10 +14,6 @@
|
||||
#include <linux/delay.h>
|
||||
#include <linux/libfdt.h>
|
||||
|
||||
#ifndef CONFIG_RESET_BUTTON_LABEL
|
||||
#define CONFIG_RESET_BUTTON_LABEL "reset"
|
||||
#endif
|
||||
|
||||
#include <mtd.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
|
||||
@@ -68,22 +63,7 @@ int board_init(void)
|
||||
|
||||
int board_late_init(void)
|
||||
{
|
||||
struct udevice *dev;
|
||||
|
||||
if (!button_get_by_label(CONFIG_RESET_BUTTON_LABEL, &dev)) {
|
||||
puts("reset button found\n");
|
||||
#ifdef CONFIG_RESET_BUTTON_SETTLE_DELAY
|
||||
if (CONFIG_RESET_BUTTON_SETTLE_DELAY > 0) {
|
||||
button_get_state(dev);
|
||||
mdelay(CONFIG_RESET_BUTTON_SETTLE_DELAY);
|
||||
}
|
||||
#endif
|
||||
if (button_get_state(dev) == BUTTON_ON) {
|
||||
puts("button pushed, resetting environment\n");
|
||||
gd->env_valid = ENV_INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
gd->env_valid = 1; //to load environment variable from persistent store
|
||||
env_relocate();
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user