uboot-mediatek: fix factory/reset button
[openwrt/openwrt.git] / package / boot / uboot-mediatek / patches / 303-mt7986-generic-reset-button-ignore-env.patch
index 0af267c50db60cf45bb33725a03343a63b0b31a3..45290149f3f0982ae4c66a6ee1bd117c2409eae4 100644 (file)
@@ -17,7 +17,7 @@
  
  #include <mtd.h>
  #include <linux/mtd/mtd.h>
-@@ -24,7 +31,19 @@ int board_init(void)
+@@ -24,7 +31,22 @@ int board_init(void)
  
  int board_late_init(void)
  {
 +      if (!button_get_by_label(CONFIG_RESET_BUTTON_LABEL, &dev)) {
 +              puts("reset button found\n");
 +#ifdef CONFIG_RESET_BUTTON_SETTLE_DELAY
-+              mdelay(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");