All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] board: mediatek: disable watchdog on BananaPi R2
@ 2021-01-07 15:36 matthias.bgg at kernel.org
  2021-01-08  7:39 ` Stefan Roese
  0 siblings, 1 reply; 13+ messages in thread
From: matthias.bgg at kernel.org @ 2021-01-07 15:36 UTC (permalink / raw)
  To: u-boot

From: Matthias Brugger <mbrugger@suse.com>

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.

Signed-off-by: Matthias Brugger <mbrugger@suse.com>

---

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

diff --git a/board/mediatek/mt7623/mt7623_rfb.c b/board/mediatek/mt7623/mt7623_rfb.c
index 984e75ccaf..22120be412 100644
--- a/board/mediatek/mt7623/mt7623_rfb.c
+++ b/board/mediatek/mt7623/mt7623_rfb.c
@@ -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
diff --git a/configs/mt7623n_bpir2_defconfig b/configs/mt7623n_bpir2_defconfig
index 9177c17dff..fe0b6259dd 100644
--- a/configs/mt7623n_bpir2_defconfig
+++ b/configs/mt7623n_bpir2_defconfig
@@ -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
-- 
2.29.2

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH] board: mediatek: disable watchdog on BananaPi R2
  2021-01-07 15:36 [PATCH] board: mediatek: disable watchdog on BananaPi R2 matthias.bgg at kernel.org
@ 2021-01-08  7:39 ` Stefan Roese
  2021-01-09  2:32   ` Matthias Brugger
  0 siblings, 1 reply; 13+ messages in thread
From: Stefan Roese @ 2021-01-08  7:39 UTC (permalink / raw)
  To: u-boot

On 07.01.21 16:36, matthias.bgg at kernel.org wrote:
> From: Matthias Brugger <mbrugger@suse.com>
> 
> 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

> Signed-off-by: Matthias Brugger <mbrugger@suse.com>
> 
> ---
> 
>   board/mediatek/mt7623/mt7623_rfb.c | 8 ++++++++
>   configs/mt7623n_bpir2_defconfig    | 1 +
>   2 files changed, 9 insertions(+)
> 
> diff --git a/board/mediatek/mt7623/mt7623_rfb.c b/board/mediatek/mt7623/mt7623_rfb.c
> index 984e75ccaf..22120be412 100644
> --- a/board/mediatek/mt7623/mt7623_rfb.c
> +++ b/board/mediatek/mt7623/mt7623_rfb.c
> @@ -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
> diff --git a/configs/mt7623n_bpir2_defconfig b/configs/mt7623n_bpir2_defconfig
> index 9177c17dff..fe0b6259dd 100644
> --- a/configs/mt7623n_bpir2_defconfig
> +++ b/configs/mt7623n_bpir2_defconfig
> @@ -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

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] board: mediatek: disable watchdog on BananaPi R2
  2021-01-08  7:39 ` Stefan Roese
@ 2021-01-09  2:32   ` Matthias Brugger
  2021-01-09 14:57     ` Stefan Roese
  0 siblings, 1 reply; 13+ messages in thread
From: Matthias Brugger @ 2021-01-09  2:32 UTC (permalink / raw)
  To: u-boot



On 08/01/2021 08:39, Stefan Roese wrote:
> On 07.01.21 16:36, matthias.bgg at kernel.org wrote:
>> From: Matthias Brugger <mbrugger@suse.com>
>>
>> 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

> Thanks,
> Stefan
> 
>> Signed-off-by: Matthias Brugger <mbrugger@suse.com>
>>
>> ---
>>
>> ? board/mediatek/mt7623/mt7623_rfb.c | 8 ++++++++
>> ? configs/mt7623n_bpir2_defconfig??? | 1 +
>> ? 2 files changed, 9 insertions(+)
>>
>> diff --git a/board/mediatek/mt7623/mt7623_rfb.c
>> b/board/mediatek/mt7623/mt7623_rfb.c
>> index 984e75ccaf..22120be412 100644
>> --- a/board/mediatek/mt7623/mt7623_rfb.c
>> +++ b/board/mediatek/mt7623/mt7623_rfb.c
>> @@ -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
>> diff --git a/configs/mt7623n_bpir2_defconfig b/configs/mt7623n_bpir2_defconfig
>> index 9177c17dff..fe0b6259dd 100644
>> --- a/configs/mt7623n_bpir2_defconfig
>> +++ b/configs/mt7623n_bpir2_defconfig
>> @@ -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
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] board: mediatek: disable watchdog on BananaPi R2
  2021-01-09  2:32   ` Matthias Brugger
@ 2021-01-09 14:57     ` Stefan Roese
  2021-01-10 18:44       ` Matthias Brugger
  0 siblings, 1 reply; 13+ messages in thread
From: Stefan Roese @ 2021-01-09 14:57 UTC (permalink / raw)
  To: u-boot

On 09.01.21 03:32, Matthias Brugger wrote:
> On 08/01/2021 08:39, Stefan Roese wrote:
>> On 07.01.21 16:36, matthias.bgg at kernel.org wrote:
>>> From: Matthias Brugger <mbrugger@suse.com>
>>>
>>> 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.

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

Thanks,
Stefan

> Regards,
> Matthias
> 
>> Thanks,
>> Stefan
>>
>>> Signed-off-by: Matthias Brugger <mbrugger@suse.com>
>>>
>>> ---
>>>
>>>  ? board/mediatek/mt7623/mt7623_rfb.c | 8 ++++++++
>>>  ? configs/mt7623n_bpir2_defconfig??? | 1 +
>>>  ? 2 files changed, 9 insertions(+)
>>>
>>> diff --git a/board/mediatek/mt7623/mt7623_rfb.c
>>> b/board/mediatek/mt7623/mt7623_rfb.c
>>> index 984e75ccaf..22120be412 100644
>>> --- a/board/mediatek/mt7623/mt7623_rfb.c
>>> +++ b/board/mediatek/mt7623/mt7623_rfb.c
>>> @@ -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
>>> diff --git a/configs/mt7623n_bpir2_defconfig b/configs/mt7623n_bpir2_defconfig
>>> index 9177c17dff..fe0b6259dd 100644
>>> --- a/configs/mt7623n_bpir2_defconfig
>>> +++ b/configs/mt7623n_bpir2_defconfig
>>> @@ -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

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] board: mediatek: disable watchdog on BananaPi R2
  2021-01-09 14:57     ` Stefan Roese
@ 2021-01-10 18:44       ` Matthias Brugger
  2021-01-10 18:55         ` Matthias Brugger
  2021-01-11  7:02         ` Stefan Roese
  0 siblings, 2 replies; 13+ messages in thread
From: Matthias Brugger @ 2021-01-10 18:44 UTC (permalink / raw)
  To: u-boot



On 09/01/2021 15:57, Stefan Roese wrote:
> On 09.01.21 03:32, Matthias Brugger wrote:
>> On 08/01/2021 08:39, Stefan Roese wrote:
>>> On 07.01.21 16:36, matthias.bgg at kernel.org wrote:
>>>> From: Matthias Brugger <mbrugger@suse.com>
>>>>
>>>> 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.
> 
> 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

> Thanks,
> Stefan
> 
>> Regards,
>> Matthias
>>
>>> Thanks,
>>> Stefan
>>>
>>>> Signed-off-by: Matthias Brugger <mbrugger@suse.com>
>>>>
>>>> ---
>>>>
>>>> ?? board/mediatek/mt7623/mt7623_rfb.c | 8 ++++++++
>>>> ?? configs/mt7623n_bpir2_defconfig??? | 1 +
>>>> ?? 2 files changed, 9 insertions(+)
>>>>
>>>> diff --git a/board/mediatek/mt7623/mt7623_rfb.c
>>>> b/board/mediatek/mt7623/mt7623_rfb.c
>>>> index 984e75ccaf..22120be412 100644
>>>> --- a/board/mediatek/mt7623/mt7623_rfb.c
>>>> +++ b/board/mediatek/mt7623/mt7623_rfb.c
>>>> @@ -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
>>>> diff --git a/configs/mt7623n_bpir2_defconfig b/configs/mt7623n_bpir2_defconfig
>>>> index 9177c17dff..fe0b6259dd 100644
>>>> --- a/configs/mt7623n_bpir2_defconfig
>>>> +++ b/configs/mt7623n_bpir2_defconfig
>>>> @@ -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
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] board: mediatek: disable watchdog on BananaPi R2
  2021-01-10 18:44       ` Matthias Brugger
@ 2021-01-10 18:55         ` Matthias Brugger
  2021-01-11  7:02         ` Stefan Roese
  1 sibling, 0 replies; 13+ messages in thread
From: Matthias Brugger @ 2021-01-10 18:55 UTC (permalink / raw)
  To: u-boot

On 10/01/2021 19:44, Matthias Brugger wrote:
> 
> 
> On 09/01/2021 15:57, Stefan Roese wrote:
>> On 09.01.21 03:32, Matthias Brugger wrote:
>>> On 08/01/2021 08:39, Stefan Roese wrote:
>>>> On 07.01.21 16:36, matthias.bgg at kernel.org wrote:
>>>>> From: Matthias Brugger <mbrugger@suse.com>
>>>>>
>>>>> 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.
>>
>> 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.

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

> 
> 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
> 
>> Thanks,
>> Stefan
>>
>>> Regards,
>>> Matthias
>>>
>>>> Thanks,
>>>> Stefan
>>>>
>>>>> Signed-off-by: Matthias Brugger <mbrugger@suse.com>
>>>>>
>>>>> ---
>>>>>
>>>>> ?? board/mediatek/mt7623/mt7623_rfb.c | 8 ++++++++
>>>>> ?? configs/mt7623n_bpir2_defconfig??? | 1 +
>>>>> ?? 2 files changed, 9 insertions(+)
>>>>>
>>>>> diff --git a/board/mediatek/mt7623/mt7623_rfb.c
>>>>> b/board/mediatek/mt7623/mt7623_rfb.c
>>>>> index 984e75ccaf..22120be412 100644
>>>>> --- a/board/mediatek/mt7623/mt7623_rfb.c
>>>>> +++ b/board/mediatek/mt7623/mt7623_rfb.c
>>>>> @@ -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
>>>>> diff --git a/configs/mt7623n_bpir2_defconfig b/configs/mt7623n_bpir2_defconfig
>>>>> index 9177c17dff..fe0b6259dd 100644
>>>>> --- a/configs/mt7623n_bpir2_defconfig
>>>>> +++ b/configs/mt7623n_bpir2_defconfig
>>>>> @@ -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
>>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] board: mediatek: disable watchdog on BananaPi R2
  2021-01-10 18:44       ` Matthias Brugger
  2021-01-10 18:55         ` Matthias Brugger
@ 2021-01-11  7:02         ` Stefan Roese
  2021-01-11  7:17           ` Heinrich Schuchardt
  1 sibling, 1 reply; 13+ messages in thread
From: Stefan Roese @ 2021-01-11  7:02 UTC (permalink / raw)
  To: u-boot

Added Heinrich to Cc.

On 10.01.21 19:44, Matthias Brugger wrote:
> On 09/01/2021 15:57, Stefan Roese wrote:
>> On 09.01.21 03:32, Matthias Brugger wrote:
>>> On 08/01/2021 08:39, Stefan Roese wrote:
>>>> On 07.01.21 16:36, matthias.bgg at kernel.org wrote:
>>>>> From: Matthias Brugger <mbrugger@suse.com>
>>>>>
>>>>> 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.
>>
>> 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

> 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
> 
>> Thanks,
>> Stefan
>>
>>> Regards,
>>> Matthias
>>>
>>>> Thanks,
>>>> Stefan
>>>>
>>>>> Signed-off-by: Matthias Brugger <mbrugger@suse.com>
>>>>>
>>>>> ---
>>>>>
>>>>>  ?? board/mediatek/mt7623/mt7623_rfb.c | 8 ++++++++
>>>>>  ?? configs/mt7623n_bpir2_defconfig??? | 1 +
>>>>>  ?? 2 files changed, 9 insertions(+)
>>>>>
>>>>> diff --git a/board/mediatek/mt7623/mt7623_rfb.c
>>>>> b/board/mediatek/mt7623/mt7623_rfb.c
>>>>> index 984e75ccaf..22120be412 100644
>>>>> --- a/board/mediatek/mt7623/mt7623_rfb.c
>>>>> +++ b/board/mediatek/mt7623/mt7623_rfb.c
>>>>> @@ -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
>>>>> diff --git a/configs/mt7623n_bpir2_defconfig b/configs/mt7623n_bpir2_defconfig
>>>>> index 9177c17dff..fe0b6259dd 100644
>>>>> --- a/configs/mt7623n_bpir2_defconfig
>>>>> +++ b/configs/mt7623n_bpir2_defconfig
>>>>> @@ -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

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] board: mediatek: disable watchdog on BananaPi R2
  2021-01-11  7:02         ` Stefan Roese
@ 2021-01-11  7:17           ` Heinrich Schuchardt
  2021-01-11  7:48             ` Stefan Roese
  0 siblings, 1 reply; 13+ messages in thread
From: Heinrich Schuchardt @ 2021-01-11  7:17 UTC (permalink / raw)
  To: u-boot

Am 11. Januar 2021 08:02:12 MEZ schrieb Stefan Roese <sr@denx.de>:
>Added Heinrich to Cc.
>
>On 10.01.21 19:44, Matthias Brugger wrote:
>> On 09/01/2021 15:57, Stefan Roese wrote:
>>> On 09.01.21 03:32, Matthias Brugger wrote:
>>>> On 08/01/2021 08:39, Stefan Roese wrote:
>>>>> On 07.01.21 16:36, matthias.bgg at kernel.org wrote:
>>>>>> From: Matthias Brugger <mbrugger@suse.com>
>>>>>>
>>>>>> 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.
>>>
>>> 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?

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


>
>Thanks,
>Stefan
>
>> 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
>> 
>>> Thanks,
>>> Stefan
>>>
>>>> Regards,
>>>> Matthias
>>>>
>>>>> Thanks,
>>>>> Stefan
>>>>>
>>>>>> Signed-off-by: Matthias Brugger <mbrugger@suse.com>
>>>>>>
>>>>>> ---
>>>>>>
>>>>>>  ?? board/mediatek/mt7623/mt7623_rfb.c | 8 ++++++++
>>>>>>  ?? configs/mt7623n_bpir2_defconfig??? | 1 +
>>>>>>  ?? 2 files changed, 9 insertions(+)
>>>>>>
>>>>>> diff --git a/board/mediatek/mt7623/mt7623_rfb.c
>>>>>> b/board/mediatek/mt7623/mt7623_rfb.c
>>>>>> index 984e75ccaf..22120be412 100644
>>>>>> --- a/board/mediatek/mt7623/mt7623_rfb.c
>>>>>> +++ b/board/mediatek/mt7623/mt7623_rfb.c
>>>>>> @@ -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
>>>>>> diff --git a/configs/mt7623n_bpir2_defconfig
>b/configs/mt7623n_bpir2_defconfig
>>>>>> index 9177c17dff..fe0b6259dd 100644
>>>>>> --- a/configs/mt7623n_bpir2_defconfig
>>>>>> +++ b/configs/mt7623n_bpir2_defconfig
>>>>>> @@ -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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] board: mediatek: disable watchdog on BananaPi R2
  2021-01-11  7:17           ` Heinrich Schuchardt
@ 2021-01-11  7:48             ` Stefan Roese
  2021-01-11  8:57               ` Heinrich Schuchardt
  0 siblings, 1 reply; 13+ messages in thread
From: Stefan Roese @ 2021-01-11  7:48 UTC (permalink / raw)
  To: u-boot



On 11.01.21 08:17, Heinrich Schuchardt wrote:
> Am 11. Januar 2021 08:02:12 MEZ schrieb Stefan Roese <sr@denx.de>:
>> Added Heinrich to Cc.
>>
>> On 10.01.21 19:44, Matthias Brugger wrote:
>>> On 09/01/2021 15:57, Stefan Roese wrote:
>>>> On 09.01.21 03:32, Matthias Brugger wrote:
>>>>> On 08/01/2021 08:39, Stefan Roese wrote:
>>>>>> On 07.01.21 16:36, matthias.bgg at kernel.org wrote:
>>>>>>> From: Matthias Brugger <mbrugger@suse.com>
>>>>>>>
>>>>>>> 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.
>>>>
>>>> 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?
> 
> 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.

> 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

> Best regards
> 
> Heinrich
> 
> 
>>
>> Thanks,
>> Stefan
>>
>>> 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
>>>
>>>> Thanks,
>>>> Stefan
>>>>
>>>>> Regards,
>>>>> Matthias
>>>>>
>>>>>> Thanks,
>>>>>> Stefan
>>>>>>
>>>>>>> Signed-off-by: Matthias Brugger <mbrugger@suse.com>
>>>>>>>
>>>>>>> ---
>>>>>>>
>>>>>>>   ?? board/mediatek/mt7623/mt7623_rfb.c | 8 ++++++++
>>>>>>>   ?? configs/mt7623n_bpir2_defconfig??? | 1 +
>>>>>>>   ?? 2 files changed, 9 insertions(+)
>>>>>>>
>>>>>>> diff --git a/board/mediatek/mt7623/mt7623_rfb.c
>>>>>>> b/board/mediatek/mt7623/mt7623_rfb.c
>>>>>>> index 984e75ccaf..22120be412 100644
>>>>>>> --- a/board/mediatek/mt7623/mt7623_rfb.c
>>>>>>> +++ b/board/mediatek/mt7623/mt7623_rfb.c
>>>>>>> @@ -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
>>>>>>> diff --git a/configs/mt7623n_bpir2_defconfig
>> b/configs/mt7623n_bpir2_defconfig
>>>>>>> index 9177c17dff..fe0b6259dd 100644
>>>>>>> --- a/configs/mt7623n_bpir2_defconfig
>>>>>>> +++ b/configs/mt7623n_bpir2_defconfig
>>>>>>> @@ -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
> 


Viele Gr??e,
Stefan

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] board: mediatek: disable watchdog on BananaPi R2
  2021-01-11  7:48             ` Stefan Roese
@ 2021-01-11  8:57               ` Heinrich Schuchardt
  2021-01-11 10:24                 ` Aw: " Frank Wunderlich
  2021-01-11 15:44                 ` Matthias Brugger
  0 siblings, 2 replies; 13+ messages in thread
From: Heinrich Schuchardt @ 2021-01-11  8:57 UTC (permalink / raw)
  To: u-boot

On 11.01.21 08:48, Stefan Roese wrote:
>
>
> On 11.01.21 08:17, Heinrich Schuchardt wrote:
>> Am 11. Januar 2021 08:02:12 MEZ schrieb Stefan Roese <sr@denx.de>:
>>> Added Heinrich to Cc.
>>>
>>> On 10.01.21 19:44, Matthias Brugger wrote:
>>>> On 09/01/2021 15:57, Stefan Roese wrote:
>>>>> On 09.01.21 03:32, Matthias Brugger wrote:
>>>>>> On 08/01/2021 08:39, Stefan Roese wrote:
>>>>>>> On 07.01.21 16:36, matthias.bgg at kernel.org wrote:
>>>>>>>> From: Matthias Brugger <mbrugger@suse.com>
>>>>>>>>
>>>>>>>> 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.
>>>>>
>>>>> 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.

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?

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

>
>> 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);

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

>
> Thanks,
> Stefan
>
>> Best regards
>>
>> Heinrich
>>
>>
>>>
>>> Thanks,
>>> Stefan
>>>
>>>> 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
>>>>
>>>>> Thanks,
>>>>> Stefan
>>>>>
>>>>>> Regards,
>>>>>> Matthias
>>>>>>
>>>>>>> Thanks,
>>>>>>> Stefan
>>>>>>>
>>>>>>>> Signed-off-by: Matthias Brugger <mbrugger@suse.com>
>>>>>>>>
>>>>>>>> ---
>>>>>>>>
>>>>>>>> ? ?? board/mediatek/mt7623/mt7623_rfb.c | 8 ++++++++
>>>>>>>> ? ?? configs/mt7623n_bpir2_defconfig??? | 1 +
>>>>>>>> ? ?? 2 files changed, 9 insertions(+)
>>>>>>>>
>>>>>>>> diff --git a/board/mediatek/mt7623/mt7623_rfb.c
>>>>>>>> b/board/mediatek/mt7623/mt7623_rfb.c
>>>>>>>> index 984e75ccaf..22120be412 100644
>>>>>>>> --- a/board/mediatek/mt7623/mt7623_rfb.c
>>>>>>>> +++ b/board/mediatek/mt7623/mt7623_rfb.c
>>>>>>>> @@ -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
>>>>>>>> diff --git a/configs/mt7623n_bpir2_defconfig
>>> b/configs/mt7623n_bpir2_defconfig
>>>>>>>> index 9177c17dff..fe0b6259dd 100644
>>>>>>>> --- a/configs/mt7623n_bpir2_defconfig
>>>>>>>> +++ b/configs/mt7623n_bpir2_defconfig
>>>>>>>> @@ -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
>>
>
>
> Viele Gr??e,
> Stefan
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Aw: Re: [PATCH] board: mediatek: disable watchdog on BananaPi R2
  2021-01-11  8:57               ` Heinrich Schuchardt
@ 2021-01-11 10:24                 ` Frank Wunderlich
  2021-01-11 10:50                   ` Heinrich Schuchardt
  2021-01-11 15:44                 ` Matthias Brugger
  1 sibling, 1 reply; 13+ messages in thread
From: Frank Wunderlich @ 2021-01-11 10:24 UTC (permalink / raw)
  To: u-boot


> Gesendet: Montag, 11. Januar 2021 um 09:57 Uhr
> Von: "Heinrich Schuchardt" <xypron.glpk@gmx.de>

> 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'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?

> efi_timer_check() is only invoked, if the UEFI API is invoked.
> Especially if the problem occurs after ExitBootServices() it is not
> called anymore.
>
> >
> >> 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.
>
> 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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Aw: Re: [PATCH] board: mediatek: disable watchdog on BananaPi R2
  2021-01-11 10:24                 ` Aw: " Frank Wunderlich
@ 2021-01-11 10:50                   ` Heinrich Schuchardt
  0 siblings, 0 replies; 13+ messages in thread
From: Heinrich Schuchardt @ 2021-01-11 10:50 UTC (permalink / raw)
  To: u-boot

On 11.01.21 11:24, Frank Wunderlich wrote:
>
>> Gesendet: Montag, 11. Januar 2021 um 09:57 Uhr
>> Von: "Heinrich Schuchardt" <xypron.glpk@gmx.de>
>
>> 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'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?
>
>> efi_timer_check() is only invoked, if the UEFI API is invoked.
>> Especially if the problem occurs after ExitBootServices() it is not
>> called anymore.
>>
>>>
>>>> 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.
>>
>> 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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] board: mediatek: disable watchdog on BananaPi R2
  2021-01-11  8:57               ` Heinrich Schuchardt
  2021-01-11 10:24                 ` Aw: " Frank Wunderlich
@ 2021-01-11 15:44                 ` Matthias Brugger
  1 sibling, 0 replies; 13+ messages in thread
From: Matthias Brugger @ 2021-01-11 15:44 UTC (permalink / raw)
  To: u-boot



On 11/01/2021 09:57, Heinrich Schuchardt wrote:
> On 11.01.21 08:48, Stefan Roese wrote:
>>
>>
>> On 11.01.21 08:17, Heinrich Schuchardt wrote:
>>> Am 11. Januar 2021 08:02:12 MEZ schrieb Stefan Roese <sr@denx.de>:
>>>> Added Heinrich to Cc.
>>>>
>>>> On 10.01.21 19:44, Matthias Brugger wrote:
>>>>> On 09/01/2021 15:57, Stefan Roese wrote:
>>>>>> On 09.01.21 03:32, Matthias Brugger wrote:
>>>>>>> On 08/01/2021 08:39, Stefan Roese wrote:
>>>>>>>> On 07.01.21 16:36, matthias.bgg at kernel.org wrote:
>>>>>>>>> From: Matthias Brugger <mbrugger@suse.com>
>>>>>>>>>
>>>>>>>>> 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.
>>>>>>
>>>>>> 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.
> 
> Hello Matthias,

Hi Heinrich :)

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

>>>>
>>>> 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.
> 
>>
>>> 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);
> 
> 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.

> 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

> 
> Best regards
> 
> Heinrich
> 
>>
>> Thanks,
>> Stefan
>>
>>> Best regards
>>>
>>> Heinrich
>>>
>>>
>>>>
>>>> Thanks,
>>>> Stefan
>>>>
>>>>> 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
>>>>>
>>>>>> Thanks,
>>>>>> Stefan
>>>>>>
>>>>>>> Regards,
>>>>>>> Matthias
>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> Stefan
>>>>>>>>
>>>>>>>>> Signed-off-by: Matthias Brugger <mbrugger@suse.com>
>>>>>>>>>
>>>>>>>>> ---
>>>>>>>>>
>>>>>>>>> ? ?? board/mediatek/mt7623/mt7623_rfb.c | 8 ++++++++
>>>>>>>>> ? ?? configs/mt7623n_bpir2_defconfig??? | 1 +
>>>>>>>>> ? ?? 2 files changed, 9 insertions(+)
>>>>>>>>>
>>>>>>>>> diff --git a/board/mediatek/mt7623/mt7623_rfb.c
>>>>>>>>> b/board/mediatek/mt7623/mt7623_rfb.c
>>>>>>>>> index 984e75ccaf..22120be412 100644
>>>>>>>>> --- a/board/mediatek/mt7623/mt7623_rfb.c
>>>>>>>>> +++ b/board/mediatek/mt7623/mt7623_rfb.c
>>>>>>>>> @@ -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
>>>>>>>>> diff --git a/configs/mt7623n_bpir2_defconfig
>>>> b/configs/mt7623n_bpir2_defconfig
>>>>>>>>> index 9177c17dff..fe0b6259dd 100644
>>>>>>>>> --- a/configs/mt7623n_bpir2_defconfig
>>>>>>>>> +++ b/configs/mt7623n_bpir2_defconfig
>>>>>>>>> @@ -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
>>>
>>
>>
>> Viele Gr??e,
>> Stefan
>>
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-01-11 15:44 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-07 15:36 [PATCH] board: mediatek: disable watchdog on BananaPi R2 matthias.bgg at kernel.org
2021-01-08  7:39 ` Stefan Roese
2021-01-09  2:32   ` Matthias Brugger
2021-01-09 14:57     ` Stefan Roese
2021-01-10 18:44       ` Matthias Brugger
2021-01-10 18:55         ` Matthias Brugger
2021-01-11  7:02         ` Stefan Roese
2021-01-11  7:17           ` Heinrich Schuchardt
2021-01-11  7:48             ` Stefan Roese
2021-01-11  8:57               ` Heinrich Schuchardt
2021-01-11 10:24                 ` Aw: " Frank Wunderlich
2021-01-11 10:50                   ` Heinrich Schuchardt
2021-01-11 15:44                 ` Matthias Brugger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.