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/mt7986/Kconfig"
|
||||||
source "board/mediatek/mt7988/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
|
endif
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <dm.h>
|
#include <dm.h>
|
||||||
#include <button.h>
|
|
||||||
#include <env.h>
|
#include <env.h>
|
||||||
#include <init.h>
|
#include <init.h>
|
||||||
#include <asm/global_data.h>
|
#include <asm/global_data.h>
|
||||||
@@ -15,10 +14,6 @@
|
|||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/libfdt.h>
|
#include <linux/libfdt.h>
|
||||||
|
|
||||||
#ifndef CONFIG_RESET_BUTTON_LABEL
|
|
||||||
#define CONFIG_RESET_BUTTON_LABEL "reset"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <mtd.h>
|
#include <mtd.h>
|
||||||
#include <linux/mtd/mtd.h>
|
#include <linux/mtd/mtd.h>
|
||||||
|
|
||||||
@@ -68,22 +63,7 @@ int board_init(void)
|
|||||||
|
|
||||||
int board_late_init(void)
|
int board_late_init(void)
|
||||||
{
|
{
|
||||||
struct udevice *dev;
|
gd->env_valid = 1; //to load environment variable from persistent store
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
env_relocate();
|
env_relocate();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -151,11 +151,4 @@ config MTK_BROM_HEADER_INFO
|
|||||||
|
|
||||||
source "board/mediatek/mt7629/Kconfig"
|
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
|
endif
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <dm.h>
|
#include <dm.h>
|
||||||
#include <button.h>
|
|
||||||
#include <env.h>
|
#include <env.h>
|
||||||
#include <init.h>
|
#include <init.h>
|
||||||
#include <asm/global_data.h>
|
#include <asm/global_data.h>
|
||||||
@@ -15,10 +14,6 @@
|
|||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/libfdt.h>
|
#include <linux/libfdt.h>
|
||||||
|
|
||||||
#ifndef CONFIG_RESET_BUTTON_LABEL
|
|
||||||
#define CONFIG_RESET_BUTTON_LABEL "reset"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define MT7622_TOPRGUSTRAP_PAR 0x10212060
|
#define MT7622_TOPRGUSTRAP_PAR 0x10212060
|
||||||
#define MT7622_BOOT_SEQ_MASK 0x18
|
#define MT7622_BOOT_SEQ_MASK 0x18
|
||||||
#define MT7622_BOOT_SEQ_SHIFT 3
|
#define MT7622_BOOT_SEQ_SHIFT 3
|
||||||
@@ -61,22 +56,7 @@ int board_init(void)
|
|||||||
|
|
||||||
int board_late_init(void)
|
int board_late_init(void)
|
||||||
{
|
{
|
||||||
struct udevice *dev;
|
gd->env_valid = 1; //to load environment variable from persistent store
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
env_relocate();
|
env_relocate();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user