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:
Tianling Shen
2025-08-19 16:28:25 +08:00
committed by GitHub
parent 6416a8200b
commit 8d0a22474b
4 changed files with 2 additions and 56 deletions

View File

@@ -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

View File

@@ -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;
}

View File

@@ -151,11 +151,4 @@ config MTK_BROM_HEADER_INFO
source "board/mediatek/mt7629/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

View File

@@ -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
#define MT7622_TOPRGUSTRAP_PAR 0x10212060
#define MT7622_BOOT_SEQ_MASK 0x18
#define MT7622_BOOT_SEQ_SHIFT 3
@@ -61,22 +56,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;
}