Skip to contentSkip to conversation

board: mediatek: disable watchdog on BananaPi R2

PATCH New matthias.bgg at kernel.org 5 participants 13 messages Jan 7, 2021 – Jan 11, 2021 Arm MediaTek

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 board: mediatek: disable watchdog on BananaPi R2

From: Matthias Brugger <[email protected]>

Watchdog timeout comes in before we are able to load the kernel and reset the watchdog. Disable the watchdog late in the boot process to be able to boot the board.

---

 board/mediatek/mt7623/mt7623_rfb.c | 8 ++++++++
 configs/mt7623n_bpir2_defconfig    | 1 +
 2 files changed, 9 insertions(+)
board/mediatek/mt7623/mt7623_rfb.c +8 -0
index 984e75ccaf..22120be412 100644
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <mmc.h>
+#include <watchdog.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -40,3 +41,10 @@ int mmc_get_env_dev(void)
 	return mmc_get_boot_dev();
 }
 #endif
+
+#ifdef CONFIG_BOARD_LATE_INIT
+int board_late_init(void)
+{
+	wdt_stop(gd->watchdog_dev);
+}
+#endif
configs/mt7623n_bpir2_defconfig +1 -0
index 9177c17dff..fe0b6259dd 100644
@@ -14,6 +14,7 @@ CONFIG_FIT_VERBOSE=y
 CONFIG_BOOTDELAY=3
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 CONFIG_DEFAULT_FDT_FILE="mt7623n-bananapi-bpi-r2.dtb"
+CONFIG_BOARD_LATE_INIT=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_SYS_PROMPT="U-Boot> "
 CONFIG_CMD_BOOTMENU=y
Signature · 1 line
2.29.2
#1 lore raw

PATCH 1/1 board: mediatek: disable watchdog on BananaPi R2

Quoted 5 lines · matthias.bgg at kernel.org

From: Matthias Brugger <[email protected]>

Watchdog timeout comes in before we are able to load the kernel and reset the watchdog. Disable the watchdog late in the boot process to be able to boot the board.

Can't you change the WDT reset timeout instead to a higher value?

Thanks,
Stefan

Quoted 37 lines

---

  board/mediatek/mt7623/mt7623_rfb.c | 8 ++++++++
  configs/mt7623n_bpir2_defconfig    | 1 +
  2 files changed, 9 insertions(+)
board/mediatek/mt7623/mt7623_rfb.c +8 -0
index 984e75ccaf..22120be412 100644
@@ -5,6 +5,7 @@
 
  #include <common.h>
  #include <mmc.h>
+#include <watchdog.h>
 
  DECLARE_GLOBAL_DATA_PTR;
 
@@ -40,3 +41,10 @@ int mmc_get_env_dev(void)
  	return mmc_get_boot_dev();
  }
  #endif
+
+#ifdef CONFIG_BOARD_LATE_INIT
+int board_late_init(void)
+{
+	wdt_stop(gd->watchdog_dev);
+}
+#endif
configs/mt7623n_bpir2_defconfig +0 -0
index 9177c17dff..fe0b6259dd 100644

configs/mt7623n_bpir2_defconfig CONFIG_FIT_VERBOSE=y · line 20

Quoted 7 lines
configs/mt7623n_bpir2_defconfig +1 -0
@@ -14,6 +14,7 @@ CONFIG_FIT_VERBOSE=y
  CONFIG_BOOTDELAY=3
  CONFIG_SYS_CONSOLE_IS_IN_ENV=y
  CONFIG_DEFAULT_FDT_FILE="mt7623n-bananapi-bpi-r2.dtb"
+CONFIG_BOARD_LATE_INIT=y
  # CONFIG_DISPLAY_BOARDINFO is not set
  CONFIG_SYS_PROMPT="U-Boot> "
  CONFIG_CMD_BOOTMENU=y

Viele Gr??e,
Stefan

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de
#2 lore raw

PATCH 1/1 board: mediatek: disable watchdog on BananaPi R2

Quoted 9 lines · Stefan Roese
Quoted 5 lines · matthias.bgg at kernel.org

From: Matthias Brugger <[email protected]>

Watchdog timeout comes in before we are able to load the kernel and reset the watchdog. Disable the watchdog late in the boot process to be able to boot the board.

Can't you change the WDT reset timeout instead to a higher value?

I tried that, but the HW has a max timeout of 15984 ms. Unfortunately that's not enough.

Regards,
Matthias

Quoted 50 lines

Thanks,
Stefan

Quoted 34 lines

---

? board/mediatek/mt7623/mt7623_rfb.c | 8 ++++++++
? configs/mt7623n_bpir2_defconfig??? | 1 +
? 2 files changed, 9 insertions(+)

board/mediatek/mt7623/mt7623_rfb.c +0 -0
index 984e75ccaf..22120be412 100644
@@ -5,6 +5,7 @@

? ? #include <common.h>
? #include <mmc.h>
+#include <watchdog.h>
? ? DECLARE_GLOBAL_DATA_PTR;
? @@ -40,3 +41,10 @@ int mmc_get_env_dev(void)
????? return mmc_get_boot_dev();
? }
? #endif

board/mediatek/mt7623/mt7623_rfb.c +7 -0
+
+#ifdef CONFIG_BOARD_LATE_INIT
+int board_late_init(void)
+{
+??? wdt_stop(gd->watchdog_dev);
+}
+#endif
configs/mt7623n_bpir2_defconfig +0 -0
index 9177c17dff..fe0b6259dd 100644
@@ -14,6 +14,7 @@ CONFIG_FIT_VERBOSE=y
Quoted 8 lines

? CONFIG_BOOTDELAY=3
? CONFIG_SYS_CONSOLE_IS_IN_ENV=y
? CONFIG_DEFAULT_FDT_FILE="mt7623n-bananapi-bpi-r2.dtb" +CONFIG_BOARD_LATE_INIT=y
? # CONFIG_DISPLAY_BOARDINFO is not set
? CONFIG_SYS_PROMPT="U-Boot> "
? CONFIG_CMD_BOOTMENU=y

Viele Gr??e,
Stefan

#3 lore raw

PATCH 1/1 board: mediatek: disable watchdog on BananaPi R2

Quoted 8 lines · Matthias Brugger
Quoted 7 lines · Stefan Roese
Quoted 5 lines · matthias.bgg at kernel.org

From: Matthias Brugger <[email protected]>

Watchdog timeout comes in before we are able to load the kernel and reset the watchdog. Disable the watchdog late in the boot process to be able to boot the board.

Quoted 5 lines
Quoted 2 lines

Can't you change the WDT reset timeout instead to a higher value?

I tried that, but the HW has a max timeout of 15984 ms. Unfortunately that's not enough.

Nearly 16 seconds is not enough to boot into Linux so that the Linux watchdog daemon can take control?

Thanks,
Stefan

Quoted 54 lines

Regards,
Matthias

Quoted 50 lines

Thanks,
Stefan

Quoted 35 lines

---

 ? board/mediatek/mt7623/mt7623_rfb.c | 8 ++++++++
 ? configs/mt7623n_bpir2_defconfig??? | 1 +

? 2 files changed, 9 insertions(+)

board/mediatek/mt7623/mt7623_rfb.c +1 -0
index 984e75ccaf..22120be412 100644
@@ -5,6 +5,7 @@
 ? ? #include <common.h>
 ? #include <mmc.h>
+#include <watchdog.h>
 ? ? DECLARE_GLOBAL_DATA_PTR;
 ? @@ -40,3 +41,10 @@ int mmc_get_env_dev(void)
 ????? return mmc_get_boot_dev();
 ? }

? #endif

board/mediatek/mt7623/mt7623_rfb.c +7 -0
+
+#ifdef CONFIG_BOARD_LATE_INIT
+int board_late_init(void)
+{
+??? wdt_stop(gd->watchdog_dev);
+}
+#endif
configs/mt7623n_bpir2_defconfig +0 -0
index 9177c17dff..fe0b6259dd 100644

configs/mt7623n_bpir2_defconfig CONFIG_FIT_VERBOSE=y · line 20

Quoted 7 lines
configs/mt7623n_bpir2_defconfig +1 -0
@@ -14,6 +14,7 @@ CONFIG_FIT_VERBOSE=y
 ? CONFIG_BOOTDELAY=3
 ? CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 ? CONFIG_DEFAULT_FDT_FILE="mt7623n-bananapi-bpi-r2.dtb"
+CONFIG_BOARD_LATE_INIT=y
 ? # CONFIG_DISPLAY_BOARDINFO is not set
 ? CONFIG_SYS_PROMPT="U-Boot> "
 ? CONFIG_CMD_BOOTMENU=y

Viele Gr??e,
Stefan

Viele Gr??e,
Stefan

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de
#4 lore raw

PATCH 1/1 board: mediatek: disable watchdog on BananaPi R2

Quoted 9 lines · Stefan Roese
Quoted 8 lines · Matthias Brugger
Quoted 7 lines · Stefan Roese
Quoted 5 lines · matthias.bgg at kernel.org

From: Matthias Brugger <[email protected]>

Watchdog timeout comes in before we are able to load the kernel and reset the watchdog. Disable the watchdog late in the boot process to be able to boot the board.

Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

Can't you change the WDT reset timeout instead to a higher value?

I tried that, but the HW has a max timeout of 15984 ms. Unfortunately that's not enough.

Nearly 16 seconds is not enough to boot into Linux so that the Linux watchdog daemon can take control?

Exactly. I'm using a standard distro image. I think the main problem is, that it needs 14 seconds for the EFI stub to actually boot the kernel. I've already the watchdog timer as build-in (which is not the best to do, taking into account that we don't want to bloat our distro kernel with random board specific drivers build-in. If we I had the watchdog driver as kernel module it would take forever to get that loaded.

You can find a serial log with timestamp from the moment U-Boot got loaded until the kernel actually boots here:
https://paste.opensuse.org/98390849

Regards,
Matthias

Quoted 62 lines

Thanks,
Stefan

Quoted 54 lines

Regards,
Matthias

Quoted 50 lines

Thanks,
Stefan

Quoted 34 lines

---

?? board/mediatek/mt7623/mt7623_rfb.c | 8 ++++++++ ?? configs/mt7623n_bpir2_defconfig??? | 1 + ?? 2 files changed, 9 insertions(+)

board/mediatek/mt7623/mt7623_rfb.c +0 -0
index 984e75ccaf..22120be412 100644
@@ -5,6 +5,7 @@

?? ? #include <common.h>
?? #include <mmc.h>
+#include <watchdog.h>
?? ? DECLARE_GLOBAL_DATA_PTR;
?? @@ -40,3 +41,10 @@ int mmc_get_env_dev(void)
?????? return mmc_get_boot_dev();
?? }
?? #endif

board/mediatek/mt7623/mt7623_rfb.c +7 -0
+
+#ifdef CONFIG_BOARD_LATE_INIT
+int board_late_init(void)
+{
+??? wdt_stop(gd->watchdog_dev);
+}
+#endif
configs/mt7623n_bpir2_defconfig +0 -0
index 9177c17dff..fe0b6259dd 100644
@@ -14,6 +14,7 @@ CONFIG_FIT_VERBOSE=y
Quoted 8 lines

?? CONFIG_BOOTDELAY=3
?? CONFIG_SYS_CONSOLE_IS_IN_ENV=y
?? CONFIG_DEFAULT_FDT_FILE="mt7623n-bananapi-bpi-r2.dtb" +CONFIG_BOARD_LATE_INIT=y
?? # CONFIG_DISPLAY_BOARDINFO is not set
?? CONFIG_SYS_PROMPT="U-Boot> "
?? CONFIG_CMD_BOOTMENU=y

Viele Gr??e,
Stefan

Viele Gr??e,
Stefan

#5 lore raw

PATCH 1/1 board: mediatek: disable watchdog on BananaPi R2

Quoted 22 lines · Matthias Brugger
Quoted 9 lines · Stefan Roese
Quoted 8 lines · Matthias Brugger
Quoted 7 lines · Stefan Roese
Quoted 5 lines · matthias.bgg at kernel.org

From: Matthias Brugger <[email protected]>

Watchdog timeout comes in before we are able to load the kernel and reset the watchdog. Disable the watchdog late in the boot process to be able to boot the board.

Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

Can't you change the WDT reset timeout instead to a higher value?

I tried that, but the HW has a max timeout of 15984 ms. Unfortunately that's not enough.

Nearly 16 seconds is not enough to boot into Linux so that the Linux watchdog daemon can take control?

Quoted 6 lines

Exactly. I'm using a standard distro image. I think the main problem is, that it needs 14 seconds for the EFI stub to actually boot the kernel. I've already the watchdog timer as build-in (which is not the best to do, taking into account that we don't want to bloat our distro kernel with random board specific drivers build-in. If we I had the watchdog driver as kernel module it would take forever to get that loaded.

I just checked and "forever" was a bit of a overstatement. Kernel modules get loaded after around 2 seconds into kernel booting. But adding this to the 14 seconds the EFI stub needs we already got reset by the watchdog.

Regards,
Matthias

Quoted 70 lines

You can find a serial log with timestamp from the moment U-Boot got loaded until the kernel actually boots here:
https://paste.opensuse.org/98390849

Regards,
Matthias

Quoted 62 lines

Thanks,
Stefan

Quoted 54 lines

Regards,
Matthias

Quoted 50 lines

Thanks,
Stefan

Quoted 34 lines

---

?? board/mediatek/mt7623/mt7623_rfb.c | 8 ++++++++ ?? configs/mt7623n_bpir2_defconfig??? | 1 + ?? 2 files changed, 9 insertions(+)

board/mediatek/mt7623/mt7623_rfb.c +0 -0
index 984e75ccaf..22120be412 100644
@@ -5,6 +5,7 @@

?? ? #include <common.h>
?? #include <mmc.h>
+#include <watchdog.h>
?? ? DECLARE_GLOBAL_DATA_PTR;
?? @@ -40,3 +41,10 @@ int mmc_get_env_dev(void)
?????? return mmc_get_boot_dev();
?? }
?? #endif

board/mediatek/mt7623/mt7623_rfb.c +7 -0
+
+#ifdef CONFIG_BOARD_LATE_INIT
+int board_late_init(void)
+{
+??? wdt_stop(gd->watchdog_dev);
+}
+#endif
configs/mt7623n_bpir2_defconfig +0 -0
index 9177c17dff..fe0b6259dd 100644
@@ -14,6 +14,7 @@ CONFIG_FIT_VERBOSE=y
Quoted 8 lines

?? CONFIG_BOOTDELAY=3
?? CONFIG_SYS_CONSOLE_IS_IN_ENV=y
?? CONFIG_DEFAULT_FDT_FILE="mt7623n-bananapi-bpi-r2.dtb" +CONFIG_BOARD_LATE_INIT=y
?? # CONFIG_DISPLAY_BOARDINFO is not set
?? CONFIG_SYS_PROMPT="U-Boot> "
?? CONFIG_CMD_BOOTMENU=y

Viele Gr??e,
Stefan

Viele Gr??e,
Stefan

#6 lore raw

PATCH 1/1 board: mediatek: disable watchdog on BananaPi R2

In reply to Matthias Brugger

Added Heinrich to Cc.

Quoted 16 lines · Matthias Brugger
Quoted 15 lines · Stefan Roese
Quoted 13 lines · Matthias Brugger
Quoted 9 lines · Stefan Roese
Quoted 5 lines · matthias.bgg at kernel.org

From: Matthias Brugger <[email protected]>

Watchdog timeout comes in before we are able to load the kernel and reset the watchdog. Disable the watchdog late in the boot process to be able to boot the board.

Can't you change the WDT reset timeout instead to a higher value?

I tried that, but the HW has a max timeout of 15984 ms. Unfortunately that's not enough.

Quoted 6 lines
Quoted 3 lines

Nearly 16 seconds is not enough to boot into Linux so that the Linux watchdog daemon can take control?

Exactly. I'm using a standard distro image. I think the main problem is, that it needs 14 seconds for the EFI stub to actually boot the kernel.

I've not much experience (yet) with the "EFI stub". But if it takes this long, wouldn't it make sense that this stub also supports the WDT?

Thanks,
Stefan

Quoted 6 lines

I've already the
watchdog timer as build-in (which is not the best to do, taking into account that we don't want to bloat our distro kernel with random board specific drivers build-in. If we I had the watchdog driver as kernel module it would take forever to get that loaded.

Quoted 70 lines

You can find a serial log with timestamp from the moment U-Boot got loaded until the kernel actually boots here:
https://paste.opensuse.org/98390849

Regards,
Matthias

Quoted 62 lines

Thanks,
Stefan

Quoted 54 lines

Regards,
Matthias

Quoted 50 lines

Thanks,
Stefan

Quoted 35 lines

---

 ?? board/mediatek/mt7623/mt7623_rfb.c | 8 ++++++++
 ?? configs/mt7623n_bpir2_defconfig??? | 1 +

?? 2 files changed, 9 insertions(+)

board/mediatek/mt7623/mt7623_rfb.c +1 -0
index 984e75ccaf..22120be412 100644
@@ -5,6 +5,7 @@
 ?? ? #include <common.h>
 ?? #include <mmc.h>
+#include <watchdog.h>
 ?? ? DECLARE_GLOBAL_DATA_PTR;
 ?? @@ -40,3 +41,10 @@ int mmc_get_env_dev(void)
 ?????? return mmc_get_boot_dev();
 ?? }

?? #endif

board/mediatek/mt7623/mt7623_rfb.c +7 -0
+
+#ifdef CONFIG_BOARD_LATE_INIT
+int board_late_init(void)
+{
+??? wdt_stop(gd->watchdog_dev);
+}
+#endif
configs/mt7623n_bpir2_defconfig +0 -0
index 9177c17dff..fe0b6259dd 100644

configs/mt7623n_bpir2_defconfig CONFIG_FIT_VERBOSE=y · line 20

Quoted 7 lines
configs/mt7623n_bpir2_defconfig +1 -0
@@ -14,6 +14,7 @@ CONFIG_FIT_VERBOSE=y
 ?? CONFIG_BOOTDELAY=3
 ?? CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 ?? CONFIG_DEFAULT_FDT_FILE="mt7623n-bananapi-bpi-r2.dtb"
+CONFIG_BOARD_LATE_INIT=y
 ?? # CONFIG_DISPLAY_BOARDINFO is not set
 ?? CONFIG_SYS_PROMPT="U-Boot> "
 ?? CONFIG_CMD_BOOTMENU=y

Viele Gr??e,
Stefan

Viele Gr??e,
Stefan

Viele Gr??e,
Stefan

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de
#7 lore raw

PATCH 1/1 board: mediatek: disable watchdog on BananaPi R2

Am 11. Januar 2021 08:02:12 MEZ schrieb Stefan Roese <[email protected]>:

Quoted 25 lines

Added Heinrich to Cc.

Quoted 8 lines · Matthias Brugger
Quoted 7 lines · Stefan Roese
Quoted 6 lines · Matthias Brugger
Quoted 5 lines · Stefan Roese
Quoted 4 lines · matthias.bgg at kernel.org

From: Matthias Brugger <[email protected]>

Watchdog timeout comes in before we are able to load the kernel and reset the watchdog. Disable the watchdog late in the

boot

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

process to be able to boot the board.

Can't you change the WDT reset timeout instead to a higher value?

I tried that, but the HW has a max timeout of 15984 ms.

Unfortunately that's not

Quoted 6 lines
Quoted 5 lines
Quoted 1 line

enough.

Nearly 16 seconds is not enough to boot into Linux so that the Linux watchdog daemon can take control?

Quoted 7 lines
Quoted 1 line

Exactly. I'm using a standard distro image. I think the main problem

is, that it

Quoted 1 line

needs 14 seconds for the EFI stub to actually boot the kernel.

I've not much experience (yet) with the "EFI stub". But if it takes this
long, wouldn't it make sense that this stub also supports the WDT?

efi_timer_check() calls WATCHDOG_RESET() trying to avoid that the hardware watchdog is triggered. There is a software watchdog defaulting to 5 minutes in efi_watchdog.c which can be modified via the EFI API.

Is there a U-Boot API to disable the hardware watchdog?

Best regards

Heinrich

Quoted 89 lines

Thanks,
Stefan

Quoted 2 lines

I've already the
watchdog timer as build-in (which is not the best to do, taking into

account

Quoted 1 line

that we don't want to bloat our distro kernel with random board

specific drivers

Quoted 1 line

build-in. If we I had the watchdog driver as kernel module it would

take forever

Quoted 3 lines

to get that loaded.

You can find a serial log with timestamp from the moment U-Boot got

loaded until

Quoted 37 lines

the kernel actually boots here:
https://paste.opensuse.org/98390849

Regards,
Matthias

Quoted 31 lines

Thanks,
Stefan

Quoted 28 lines

Regards,
Matthias

Quoted 25 lines

Thanks,
Stefan

Quoted 22 lines

---

 ?? board/mediatek/mt7623/mt7623_rfb.c | 8 ++++++++
 ?? configs/mt7623n_bpir2_defconfig??? | 1 +

?? 2 files changed, 9 insertions(+)

board/mediatek/mt7623/mt7623_rfb.c +1 -0
index 984e75ccaf..22120be412 100644
@@ -5,6 +5,7 @@
 ?? ? #include <common.h>
 ?? #include <mmc.h>
+#include <watchdog.h>
 ?? ? DECLARE_GLOBAL_DATA_PTR;
 ?? @@ -40,3 +41,10 @@ int mmc_get_env_dev(void)
 ?????? return mmc_get_boot_dev();
 ?? }

?? #endif

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Review

Quoted 8 lines
board/mediatek/mt7623/mt7623_rfb.c +7 -0
+
+#ifdef CONFIG_BOARD_LATE_INIT
+int board_late_init(void)
+{
+??? wdt_stop(gd->watchdog_dev);
+}
+#endif
(quoted diff) +0 -0

b/configs/mt7623n_bpir2_defconfig

Quoted 20 lines
Quoted 20 lines
Quoted 18 lines
Quoted 17 lines

configs/mt7623n_bpir2_defconfig CONFIG_FIT_VERBOSE=y · line 20

Quoted 12 lines

index 9177c17dff..fe0b6259dd 100644

configs/mt7623n_bpir2_defconfig +1 -0
@@ -14,6 +14,7 @@ CONFIG_FIT_VERBOSE=y
 ?? CONFIG_BOOTDELAY=3
 ?? CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 ?? CONFIG_DEFAULT_FDT_FILE="mt7623n-bananapi-bpi-r2.dtb"
+CONFIG_BOARD_LATE_INIT=y
 ?? # CONFIG_DISPLAY_BOARDINFO is not set
 ?? CONFIG_SYS_PROMPT="U-Boot> "
 ?? CONFIG_CMD_BOOTMENU=y

Viele Gr??e,
Stefan

Quoted 4 lines
Quoted 3 lines

Viele Gr??e,
Stefan

Viele Gr??e,
Stefan

#8 lore raw

PATCH 1/1 board: mediatek: disable watchdog on BananaPi R2

Quoted 28 lines · Heinrich Schuchardt

Am 11. Januar 2021 08:02:12 MEZ schrieb Stefan Roese <[email protected]>:

Quoted 27 lines

Added Heinrich to Cc.

Quoted 8 lines · Matthias Brugger
Quoted 7 lines · Stefan Roese
Quoted 6 lines · Matthias Brugger
Quoted 5 lines · Stefan Roese
Quoted 4 lines · matthias.bgg at kernel.org

From: Matthias Brugger <[email protected]>

Watchdog timeout comes in before we are able to load the kernel and reset the watchdog. Disable the watchdog late in the

boot

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

process to be able to boot the board.

Can't you change the WDT reset timeout instead to a higher value?

I tried that, but the HW has a max timeout of 15984 ms.

Unfortunately that's not

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

enough.

Nearly 16 seconds is not enough to boot into Linux so that the Linux watchdog daemon can take control?

Exactly. I'm using a standard distro image. I think the main problem

is, that it

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

needs 14 seconds for the EFI stub to actually boot the kernel.

I've not much experience (yet) with the "EFI stub". But if it takes this
long, wouldn't it make sense that this stub also supports the WDT?

efi_timer_check() calls WATCHDOG_RESET() trying to avoid that the hardware watchdog is triggered.

So efi_timer_check() is called quite frequently and should be enough to reset the U-Boot WDT while residing in EFI? Not sure, why the reset occurs in Matthias's case then.

Quoted 5 lines

There is a software watchdog
defaulting to 5 minutes in efi_watchdog.c which can be modified via the EFI API.

Is there a U-Boot API to disable the hardware watchdog?

Yes:

/*
* Stop the timer, thus disabling the Watchdog. Use wdt_start to start
it again.
*
* @dev: WDT Device
* @return: 0 if OK, -ve on error
*/
int wdt_stop(struct udevice *dev);

Thanks,
Stefan

Quoted 95 lines

Best regards

Heinrich

Quoted 89 lines

Thanks,
Stefan

Quoted 2 lines

I've already the
watchdog timer as build-in (which is not the best to do, taking into

account

Quoted 1 line

that we don't want to bloat our distro kernel with random board

specific drivers

Quoted 1 line

build-in. If we I had the watchdog driver as kernel module it would

take forever

Quoted 3 lines

to get that loaded.

You can find a serial log with timestamp from the moment U-Boot got

loaded until

Quoted 37 lines

the kernel actually boots here:
https://paste.opensuse.org/98390849

Regards,
Matthias

Quoted 31 lines

Thanks,
Stefan

Quoted 28 lines

Regards,
Matthias

Quoted 25 lines

Thanks,
Stefan

Quoted 22 lines

---

  ?? board/mediatek/mt7623/mt7623_rfb.c | 8 ++++++++
  ?? configs/mt7623n_bpir2_defconfig??? | 1 +

?? 2 files changed, 9 insertions(+)

board/mediatek/mt7623/mt7623_rfb.c +1 -0
index 984e75ccaf..22120be412 100644
@@ -5,6 +5,7 @@
  ?? ? #include <common.h>
  ?? #include <mmc.h>
+#include <watchdog.h>
  ?? ? DECLARE_GLOBAL_DATA_PTR;
  ?? @@ -40,3 +41,10 @@ int mmc_get_env_dev(void)
  ?????? return mmc_get_boot_dev();
  ?? }

?? #endif

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Review

Quoted 8 lines
board/mediatek/mt7623/mt7623_rfb.c +7 -0
+
+#ifdef CONFIG_BOARD_LATE_INIT
+int board_late_init(void)
+{
+??? wdt_stop(gd->watchdog_dev);
+}
+#endif
(quoted diff) +0 -0

b/configs/mt7623n_bpir2_defconfig

Quoted 20 lines
Quoted 20 lines
Quoted 18 lines
Quoted 17 lines

configs/mt7623n_bpir2_defconfig CONFIG_FIT_VERBOSE=y · line 20

Quoted 12 lines

index 9177c17dff..fe0b6259dd 100644

configs/mt7623n_bpir2_defconfig +1 -0
@@ -14,6 +14,7 @@ CONFIG_FIT_VERBOSE=y
  ?? CONFIG_BOOTDELAY=3
  ?? CONFIG_SYS_CONSOLE_IS_IN_ENV=y
  ?? CONFIG_DEFAULT_FDT_FILE="mt7623n-bananapi-bpi-r2.dtb"
+CONFIG_BOARD_LATE_INIT=y
  ?? # CONFIG_DISPLAY_BOARDINFO is not set
  ?? CONFIG_SYS_PROMPT="U-Boot> "
  ?? CONFIG_CMD_BOOTMENU=y

Viele Gr??e,
Stefan

Quoted 4 lines
Quoted 3 lines

Viele Gr??e,
Stefan

Viele Gr??e,
Stefan

Viele Gr??e,
Stefan

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de
#9 lore raw

PATCH 1/1 board: mediatek: disable watchdog on BananaPi R2

Quoted 25 lines · Stefan Roese
Quoted 22 lines · Heinrich Schuchardt

Am 11. Januar 2021 08:02:12 MEZ schrieb Stefan Roese <[email protected]>:

Quoted 21 lines

Added Heinrich to Cc.

Quoted 8 lines · Matthias Brugger
Quoted 7 lines · Stefan Roese
Quoted 6 lines · Matthias Brugger
Quoted 5 lines · Stefan Roese
Quoted 4 lines · matthias.bgg at kernel.org

From: Matthias Brugger <[email protected]>

Watchdog timeout comes in before we are able to load the kernel and reset the watchdog. Disable the watchdog late in the

boot

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

process to be able to boot the board.

Can't you change the WDT reset timeout instead to a higher value?

I tried that, but the HW has a max timeout of 15984 ms.

Unfortunately that's not

Quoted 2 lines
Quoted 2 lines
Quoted 1 line

enough.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Nearly 16 seconds is not enough to boot into Linux so that the Linux watchdog daemon can take control?

Exactly. I'm using a standard distro image. I think the main problem

is, that it

Quoted 1 line

needs 14 seconds for the EFI stub to actually boot the kernel.

Hello Matthias,

I observed that on some recent version Linux before 5.10 booting seemed to be delayed by dozens of seconds on many boards. On which Linux version did you see the problem?

Quoted 11 lines
Quoted 7 lines
Quoted 4 lines

I've not much experience (yet) with the "EFI stub". But if it takes this
long, wouldn't it make sense that this stub also supports the WDT?

efi_timer_check() calls WATCHDOG_RESET() trying to avoid that the hardware watchdog is triggered.

So efi_timer_check() is called quite frequently and should be enough to reset the U-Boot WDT while residing in EFI? Not sure, why the reset occurs in Matthias's case then.

efi_timer_check() is only invoked, if the UEFI API is invoked. Especially if the problem occurs after ExitBootServices() it is not called anymore.

Quoted 9 lines
Quoted 6 lines

There is a software watchdog
defaulting to 5 minutes in efi_watchdog.c which can be modified via the EFI API.

Is there a U-Boot API to disable the hardware watchdog?

Yes:

Quoted 8 lines

/*
?* Stop the timer, thus disabling the Watchdog. Use wdt_start to start it again.
?*
?* @dev: WDT Device
?* @return: 0 if OK, -ve on error
?*/
int wdt_stop(struct udevice *dev);

It would be interesting to understand if your problem occurs before or after efi_exit_boot_services() is called. You could you add printf() statements after EFI_ENTRY() and before EFI_EXIT() to see if it is reached.

Could you further, please, test if adding wdt_stop() to the start of do_bootefi() in cmd/bootefi.c solves your problem.

Best regards

Heinrich

Quoted 104 lines

Thanks,
Stefan

Quoted 95 lines

Best regards

Heinrich

Quoted 89 lines

Thanks,
Stefan

Quoted 2 lines

I've already the
watchdog timer as build-in (which is not the best to do, taking into

account

Quoted 1 line

that we don't want to bloat our distro kernel with random board

specific drivers

Quoted 1 line

build-in. If we I had the watchdog driver as kernel module it would

take forever

Quoted 3 lines

to get that loaded.

You can find a serial log with timestamp from the moment U-Boot got

loaded until

Quoted 37 lines

the kernel actually boots here:
https://paste.opensuse.org/98390849

Regards,
Matthias

Quoted 31 lines

Thanks,
Stefan

Quoted 28 lines

Regards,
Matthias

Quoted 25 lines

Thanks,
Stefan

Quoted 22 lines

---

? ?? board/mediatek/mt7623/mt7623_rfb.c | 8 ++++++++ ? ?? configs/mt7623n_bpir2_defconfig??? | 1 + ? ?? 2 files changed, 9 insertions(+)

board/mediatek/mt7623/mt7623_rfb.c +0 -0
index 984e75ccaf..22120be412 100644
@@ -5,6 +5,7 @@

? ?? ? #include <common.h>
? ?? #include <mmc.h>
+#include <watchdog.h>
? ?? ? DECLARE_GLOBAL_DATA_PTR;
? ?? @@ -40,3 +41,10 @@ int mmc_get_env_dev(void)
? ?????? return mmc_get_boot_dev();
? ?? }
? ?? #endif

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Review

Quoted 8 lines
board/mediatek/mt7623/mt7623_rfb.c +7 -0
+
+#ifdef CONFIG_BOARD_LATE_INIT
+int board_late_init(void)
+{
+??? wdt_stop(gd->watchdog_dev);
+}
+#endif
(quoted diff) +0 -0

b/configs/mt7623n_bpir2_defconfig

Quoted 20 lines
Quoted 20 lines
Quoted 18 lines
Quoted 17 lines
Quoted 4 lines

index 9177c17dff..fe0b6259dd 100644

configs/mt7623n_bpir2_defconfig +0 -0
@@ -14,6 +14,7 @@ CONFIG_FIT_VERBOSE=y
Quoted 8 lines

? ?? CONFIG_BOOTDELAY=3
? ?? CONFIG_SYS_CONSOLE_IS_IN_ENV=y
? ?? CONFIG_DEFAULT_FDT_FILE="mt7623n-bananapi-bpi-r2.dtb" +CONFIG_BOARD_LATE_INIT=y
? ?? # CONFIG_DISPLAY_BOARDINFO is not set
? ?? CONFIG_SYS_PROMPT="U-Boot> "
? ?? CONFIG_CMD_BOOTMENU=y

Viele Gr??e,
Stefan

Quoted 4 lines
Quoted 3 lines

Viele Gr??e,
Stefan

Viele Gr??e,
Stefan

Viele Gr??e,
Stefan

#10 lore raw
Quoted 19 lines

Gesendet: Montag, 11. Januar 2021 um 09:57 Uhr
Von: "Heinrich Schuchardt" <[email protected]>

I observed that on some recent version Linux before 5.10 booting seemed to be delayed by dozens of seconds on many boards. On which Linux version did you see the problem?

Quoted 11 lines
Quoted 7 lines
Quoted 4 lines

I've not much experience (yet) with the "EFI stub". But if it takes this
long, wouldn't it make sense that this stub also supports the WDT?

efi_timer_check() calls WATCHDOG_RESET() trying to avoid that the hardware watchdog is triggered.

So efi_timer_check() is called quite frequently and should be enough to reset the U-Boot WDT while residing in EFI? Not sure, why the reset occurs in Matthias's case then.

Matthias could you check if/when/how often efi_timer_check is called in you bootprocess?

Quoted 9 lines

efi_timer_check() is only invoked, if the UEFI API is invoked. Especially if the problem occurs after ExitBootServices() it is not called anymore.

Quoted 4 lines
Quoted 4 lines

There is a software watchdog
defaulting to 5 minutes in efi_watchdog.c which can be modified via the EFI API.

Quoted 6 lines

It would be interesting to understand if your problem occurs before or after efi_exit_boot_services() is called. You could you add printf() statements after EFI_ENTRY() and before EFI_EXIT() to see if it is reached.

Could you further, please, test if adding wdt_stop() to the start of do_bootefi() in cmd/bootefi.c solves your problem.

should efi_timer_check not be called there to reset WDT-timer a last time to leave the maximum time for booting linux kernel? maybe a wdt_stop is not neccessary anymore then

regards Frank

#11 lore raw
Quoted 35 lines · Frank Wunderlich
Quoted 19 lines

Gesendet: Montag, 11. Januar 2021 um 09:57 Uhr
Von: "Heinrich Schuchardt" <[email protected]>

I observed that on some recent version Linux before 5.10 booting seemed to be delayed by dozens of seconds on many boards. On which Linux version did you see the problem?

Quoted 11 lines
Quoted 7 lines
Quoted 4 lines

I've not much experience (yet) with the "EFI stub". But if it takes this
long, wouldn't it make sense that this stub also supports the WDT?

efi_timer_check() calls WATCHDOG_RESET() trying to avoid that the hardware watchdog is triggered.

So efi_timer_check() is called quite frequently and should be enough to reset the U-Boot WDT while residing in EFI? Not sure, why the reset occurs in Matthias's case then.

Matthias could you check if/when/how often efi_timer_check is called in you bootprocess?

Quoted 13 lines

efi_timer_check() is only invoked, if the UEFI API is invoked. Especially if the problem occurs after ExitBootServices() it is not called anymore.

Quoted 4 lines
Quoted 4 lines

There is a software watchdog
defaulting to 5 minutes in efi_watchdog.c which can be modified via the EFI API.

It would be interesting to understand if your problem occurs before or after efi_exit_boot_services() is called. You could you add printf() statements after EFI_ENTRY() and before EFI_EXIT() to see if it is reached.

Quoted 5 lines
Quoted 2 lines

Could you further, please, test if adding wdt_stop() to the start of do_bootefi() in cmd/bootefi.c solves your problem.

should efi_timer_check not be called there to reset WDT-timer a last time to leave the maximum time for booting linux kernel? maybe a wdt_stop is not neccessary anymore then

WATCHDOG_RESET() is already the last call in efi_exit_boot_services().

Best regards

Heinrich

#12 lore raw

PATCH 1/1 board: mediatek: disable watchdog on BananaPi R2

In reply to Heinrich Schuchardt
Quoted 30 lines · Heinrich Schuchardt
Quoted 29 lines · Stefan Roese
Quoted 26 lines · Heinrich Schuchardt

Am 11. Januar 2021 08:02:12 MEZ schrieb Stefan Roese <[email protected]>:

Quoted 25 lines

Added Heinrich to Cc.

Quoted 8 lines · Matthias Brugger
Quoted 7 lines · Stefan Roese
Quoted 6 lines · Matthias Brugger
Quoted 5 lines · Stefan Roese
Quoted 4 lines · matthias.bgg at kernel.org

From: Matthias Brugger <[email protected]>

Watchdog timeout comes in before we are able to load the kernel and reset the watchdog. Disable the watchdog late in the

boot

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

process to be able to boot the board.

Can't you change the WDT reset timeout instead to a higher value?

I tried that, but the HW has a max timeout of 15984 ms.

Unfortunately that's not

Quoted 6 lines
Quoted 5 lines
Quoted 1 line

enough.

Nearly 16 seconds is not enough to boot into Linux so that the Linux watchdog daemon can take control?

Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

Exactly. I'm using a standard distro image. I think the main problem

is, that it

Quoted 1 line

needs 14 seconds for the EFI stub to actually boot the kernel.

Hello Matthias,

Hi Heinrich :)

Quoted 5 lines

I observed that on some recent version Linux before 5.10 booting seemed to be delayed by dozens of seconds on many boards. On which Linux version did you see the problem?

I think it started on 5.9 or 5.10. Right now I'm seeing it with 5.10 and 5.11-rc2.

Quoted 34 lines
Quoted 11 lines
Quoted 7 lines
Quoted 4 lines

I've not much experience (yet) with the "EFI stub". But if it takes this
long, wouldn't it make sense that this stub also supports the WDT?

efi_timer_check() calls WATCHDOG_RESET() trying to avoid that the hardware watchdog is triggered.

So efi_timer_check() is called quite frequently and should be enough to reset the U-Boot WDT while residing in EFI? Not sure, why the reset occurs in Matthias's case then.

efi_timer_check() is only invoked, if the UEFI API is invoked. Especially if the problem occurs after ExitBootServices() it is not called anymore.

Quoted 9 lines
Quoted 6 lines

There is a software watchdog
defaulting to 5 minutes in efi_watchdog.c which can be modified via the EFI API.

Is there a U-Boot API to disable the hardware watchdog?

Yes:

Quoted 8 lines

/*
?* Stop the timer, thus disabling the Watchdog. Use wdt_start to start it again.
?*
?* @dev: WDT Device
?* @return: 0 if OK, -ve on error
?*/
int wdt_stop(struct udevice *dev);

Quoted 4 lines

It would be interesting to understand if your problem occurs before or after efi_exit_boot_services() is called. You could you add printf() statements after EFI_ENTRY() and before EFI_EXIT() to see if it is reached.

It happens after EFI_EXIT():
[2021-01-11 14:06:04.621] EFI stub: Booting Linux Kernel... [2021-01-11 14:06:04.624] EFI stub: Using DTB from configuration table [2021-01-11 14:06:04.628] EFI stub: Exiting boot services and installing virtual address map...
[2021-01-11 14:06:04.637] efi_exit_boot_services EFI_ENTRY [2021-01-11 14:06:04.641] efi_exit_boot_services EFI_EXIT [2021-01-11 14:06:20.972]
[2021-01-11 14:06:20.973] [USBD] USB PRB0 LineState: 40

So reboot after around 16 seconds.

Quoted 2 lines

Could you further, please, test if adding wdt_stop() to the start of do_bootefi() in cmd/bootefi.c solves your problem.

Yes, that works. Do you want me to disable watchdog for all EFI boot cases?

Regards,
Matthias

Quoted 110 lines

Best regards

Heinrich

Quoted 104 lines

Thanks,
Stefan

Quoted 95 lines

Best regards

Heinrich

Quoted 89 lines

Thanks,
Stefan

Quoted 2 lines

I've already the
watchdog timer as build-in (which is not the best to do, taking into

account

Quoted 1 line

that we don't want to bloat our distro kernel with random board

specific drivers

Quoted 1 line

build-in. If we I had the watchdog driver as kernel module it would

take forever

Quoted 3 lines

to get that loaded.

You can find a serial log with timestamp from the moment U-Boot got

loaded until

Quoted 37 lines

the kernel actually boots here:
https://paste.opensuse.org/98390849

Regards,
Matthias

Quoted 31 lines

Thanks,
Stefan

Quoted 28 lines

Regards,
Matthias

Quoted 25 lines

Thanks,
Stefan

Quoted 22 lines

---

? ?? board/mediatek/mt7623/mt7623_rfb.c | 8 ++++++++ ? ?? configs/mt7623n_bpir2_defconfig??? | 1 + ? ?? 2 files changed, 9 insertions(+)

board/mediatek/mt7623/mt7623_rfb.c +0 -0
index 984e75ccaf..22120be412 100644
@@ -5,6 +5,7 @@

? ?? ? #include <common.h>
? ?? #include <mmc.h>
+#include <watchdog.h>
? ?? ? DECLARE_GLOBAL_DATA_PTR;
? ?? @@ -40,3 +41,10 @@ int mmc_get_env_dev(void)
? ?????? return mmc_get_boot_dev();
? ?? }
? ?? #endif

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Review

Quoted 8 lines
board/mediatek/mt7623/mt7623_rfb.c +7 -0
+
+#ifdef CONFIG_BOARD_LATE_INIT
+int board_late_init(void)
+{
+??? wdt_stop(gd->watchdog_dev);
+}
+#endif
(quoted diff) +0 -0

b/configs/mt7623n_bpir2_defconfig

Quoted 20 lines
Quoted 20 lines
Quoted 18 lines
Quoted 17 lines
Quoted 4 lines

index 9177c17dff..fe0b6259dd 100644

configs/mt7623n_bpir2_defconfig +0 -0
@@ -14,6 +14,7 @@ CONFIG_FIT_VERBOSE=y
Quoted 8 lines

? ?? CONFIG_BOOTDELAY=3
? ?? CONFIG_SYS_CONSOLE_IS_IN_ENV=y
? ?? CONFIG_DEFAULT_FDT_FILE="mt7623n-bananapi-bpi-r2.dtb" +CONFIG_BOARD_LATE_INIT=y
? ?? # CONFIG_DISPLAY_BOARDINFO is not set
? ?? CONFIG_SYS_PROMPT="U-Boot> "
? ?? CONFIG_CMD_BOOTMENU=y

Viele Gr??e,
Stefan

Quoted 4 lines
Quoted 3 lines

Viele Gr??e,
Stefan

Viele Gr??e,
Stefan

Viele Gr??e,
Stefan