watchdog: Fix watchdog enablement in SPL and TPL
PATCH 1/1 watchdog: Fix watchdog enablement in SPL and TPL
Commit 830d29ac372 ("watchdog: Allow to use CONFIG_WDT without starting watchdog") completely broke WDT operation in both SPL and TPL, in either case those WDTs are never enabled. Fix it by filling in the missing Kconfig options for SPL and TPL.
--- drivers/watchdog/Kconfig | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
drivers/watchdog/Kconfig +20 -0
@@ -273,4 +273,24 @@ config SPL_WDT Enable driver model for watchdog timer in SPL. This is similar to CONFIG_WDT in U-Boot. +config SPL_WATCHDOG_AUTOSTART + bool "Automatically start watchdog timer in SPL" + depends on SPL && WDT + default y + help + Automatically start watchdog timer and start servicing it during + SPL phase. Enabled by default. Disable this option if you want + to compile U-Boot with CONFIG_WDT support but do not want to + activate watchdog, like when CONFIG_WDT option is disabled. + +config TPL_WATCHDOG_AUTOSTART + bool "Automatically start watchdog timer in TPL" + depends on TPL && WDT + default y + help + Automatically start watchdog timer and start servicing it during + TPL phase. Enabled by default. Disable this option if you want + to compile U-Boot with CONFIG_WDT support but do not want to + activate watchdog, like when CONFIG_WDT option is disabled. + endmenu
Signature · 1 line
2.33.0
Hi Marek
Quoted 41 lines · Marek Vasut
Commit
830d29ac372("watchdog: Allow to useCONFIG_WDTwithout starting watchdog") completely broke WDT operation in both SPL and TPL, in either case those WDTs are never enabled. Fix it by filling in the missingKconfigoptions for SPL and TPL.Fixes 830d29ac372 ("watchdog: Allow to use CONFIG_WDT without starting watchdog")Signed-off-by Marek Vasut <[email protected]>Cc Pali Rohar <[email protected]>Cc Stefan Roese <[email protected]>---
drivers/watchdog/Kconfig | 20 ++++++++++++++++++++1 file changed, 20 insertions(+)drivers/watchdog/Kconfig +0
-0@@ -273,4 +273,24 @@ config SPL_WDTEnable driver model for watchdog timer in SPL. This is similar to
CONFIG_WDTin U-Boot.drivers/watchdog/Kconfig +20
-0+config SPL_WATCHDOG_AUTOSTART + bool "Automatically start watchdog timer in SPL" + depends on SPL && WDT + default y + help + Automatically start watchdog timer and start servicing it during + SPL phase. Enabled by default. Disable this option if you want + to compile U-Boot with CONFIG_WDT support but do not want to + activate watchdog, like when CONFIG_WDT option is disabled. + +config TPL_WATCHDOG_AUTOSTART + bool "Automatically start watchdog timer in TPL" + depends on TPL && WDT + default y + help + Automatically start watchdog timer and start servicing it during + TPL phase. Enabled by default. Disable this option if you want + to compile U-Boot with CONFIG_WDT support but do not want to + activate watchdog, like when CONFIG_WDT option is disabled. +
Quoted 1 line
endmenu
Those Kconfig entries look fine. However, I am wondering where exactly they get used. Am I missing anything?
Cheers
Marcel
Quoted 39 lines · Marcel Ziswiler
Hi Marek
Quoted 36 lines · Marek Vasut
Commit
830d29ac372("watchdog: Allow to useCONFIG_WDTwithout starting watchdog") completely broke WDT operation in both SPL and TPL, in either case those WDTs are never enabled. Fix it by filling in the missingKconfigoptions for SPL and TPL.Fixes 830d29ac372 ("watchdog: Allow to use CONFIG_WDT without starting watchdog")Signed-off-by Marek Vasut <[email protected]>Cc Pali Rohar <[email protected]>Cc Stefan Roese <[email protected]>--- drivers/watchdog/Kconfig | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)drivers/watchdog/Kconfig +15
-0@@ -273,4 +273,24 @@ config SPL_WDT Enable driver model for watchdog timer in SPL. This is similar to CONFIG_WDT in U-Boot. +config SPL_WATCHDOG_AUTOSTART + bool "Automatically start watchdog timer in SPL" + depends on SPL && WDT + default y + help + Automatically start watchdog timer and start servicing it during + SPL phase. Enabled by default. Disable this option if you want + to compile U-Boot with CONFIG_WDT support but do not want to + activate watchdog, like when CONFIG_WDT option is disabled. + +config TPL_WATCHDOG_AUTOSTART + bool "Automatically start watchdog timer in TPL" + depends on TPL && WDT + default y + help
Quoted 8 lines
drivers/watchdog/Kconfig config SPL_WDT · line 296
Quoted 6 lines
drivers/watchdog/Kconfig +5
-0+ Automatically start watchdog timer and start servicing it during + TPL phase. Enabled by default. Disable this option if you want + to compile U-Boot with CONFIG_WDT support but do not want to + activate watchdog, like when CONFIG_WDT option is disabled. + endmenuThose
Kconfigentries look fine. However, I am wondering where exactly they get used. Am I missing anything?
Have a look at the patch this Fixes:, if those Kconfig entries are not present, the WDT is disabled in SPL and TPL unconditionally.
It could be that if you're using some non-free or proprietary preloader instead of SPL, you won't run into this problem.
Quoted 50 lines · Marek Vasut
Quoted 40 lines · Marcel Ziswiler
Hi Marek
Quoted 37 lines · Marek Vasut
Commit
830d29ac372("watchdog: Allow to useCONFIG_WDTwithout starting watchdog") completely broke WDT operation in both SPL and TPL, in either case those WDTs are never enabled. Fix it by filling in the missingKconfigoptions for SPL and TPL.Fixes 830d29ac372 ("watchdog: Allow to use CONFIG_WDT without starting watchdog")Signed-off-by Marek Vasut <[email protected]>Cc Pali Rohar <[email protected]>Cc Stefan Roese <[email protected]>---
drivers/watchdog/Kconfig | 20 ++++++++++++++++++++1 file changed, 20 insertions(+)drivers/watchdog/Kconfig +0
-0@@ -273,4 +273,24 @@ config SPL_WDTEnable driver model for watchdog timer in SPL. This is similar to
CONFIG_WDTin U-Boot.drivers/watchdog/Kconfig +16
-0+config SPL_WATCHDOG_AUTOSTART + bool "Automatically start watchdog timer in SPL" + depends on SPL && WDT + default y + help + Automatically start watchdog timer and start servicing it during + SPL phase. Enabled by default. Disable this option if you want + to compile U-Boot with CONFIG_WDT support but do not want to + activate watchdog, like when CONFIG_WDT option is disabled. + +config TPL_WATCHDOG_AUTOSTART + bool "Automatically start watchdog timer in TPL" + depends on TPL && WDT + default y + help + Automatically start watchdog timer and start servicing it duringQuoted 8 lines
Quoted 5 lines
+ TPL phase. Enabled by default. Disable this option if you want + to compile U-Boot with
CONFIG_WDTsupport but do not want to + activate watchdog, like whenCONFIG_WDToption is disabled. +
endmenuThose
Kconfigentries look fine. However, I am wondering where exactly they get used. Am I missing anything?
Quoted 2 lines
Have a look at the patch this Fixes:, if those
Kconfigentries are not present, the WDT is disabled in SPL and TPL unconditionally.
Yes, I did. But I guess I was not aware of how exactly that CONFIG_IS_ENABLED(WATCHDOG_AUTOSTART) behaves. While I have not really found this documented or the implementation thereof I assume it pre-fixes config stuff with SPL_ resp. TPL_ when building those flavors, correct?
I am wondering how many others are unaware of this (just like the author of the patch this fixes). Maybe we should at least document this properly somewhere, not?
Quoted 2 lines
It could be that if you're using some non-free or proprietary preloader instead of SPL, you won't run into this problem.
No, don't worry. I am not running anything evil (;-p).
Stefan Roese
Reviewed-byQuoted 51 lines · Marcel Ziswiler
Quoted 50 lines · Marek Vasut
Quoted 48 lines · Marcel Ziswiler
Hi Marek
Quoted 32 lines · Marek Vasut
Commit
830d29ac372("watchdog: Allow to useCONFIG_WDTwithout starting watchdog") completely broke WDT operation in both SPL and TPL, in either case those WDTs are never enabled. Fix it by filling in the missingKconfigoptions for SPL and TPL.Fixes 830d29ac372 ("watchdog: Allow to use CONFIG_WDT without starting watchdog")Signed-off-by Marek Vasut <[email protected]>Cc Pali Rohar <[email protected]>Cc Stefan Roese <[email protected]>--- drivers/watchdog/Kconfig | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)drivers/watchdog/Kconfig +11
-0@@ -273,4 +273,24 @@ config SPL_WDT Enable driver model for watchdog timer in SPL. This is similar to CONFIG_WDT in U-Boot. +config SPL_WATCHDOG_AUTOSTART + bool "Automatically start watchdog timer in SPL" + depends on SPL && WDT + default y + help + Automatically start watchdog timer and start servicing it during + SPL phase. Enabled by default. Disable this option if you want + to compile U-Boot with CONFIG_WDT support but do not want to + activate watchdog, like when CONFIG_WDT option is disabled. + +config TPL_WATCHDOG_AUTOSTARTdrivers/watchdog/Kconfig config SPL_WDT · line 296
Quoted 10 lines
drivers/watchdog/Kconfig +9
-0+ bool "Automatically start watchdog timer in TPL" + depends on TPL && WDT + default y + help + Automatically start watchdog timer and start servicing it during + TPL phase. Enabled by default. Disable this option if you want + to compile U-Boot with CONFIG_WDT support but do not want to + activate watchdog, like when CONFIG_WDT option is disabled. + endmenuThose
Kconfigentries look fine. However, I am wondering where exactly they get used. Am I missing anything?
Quoted 8 lines
Quoted 2 lines
Have a look at the patch this Fixes:, if those
Kconfigentries are not present, the WDT is disabled in SPL and TPL unconditionally.Yes, I did. But I guess I was not aware of how exactly that
CONFIG_IS_ENABLED(WATCHDOG_AUTOSTART)behaves.
While I have not really found this documented or the implementation thereof I assume it pre-fixes config stuff
withSPL_resp.TPL_when building those flavors, correct?
Yes.
Quoted 3 lines
I am wondering how many others are unaware of this (just like the author of the patch this fixes). Maybe we
should at least document this properly somewhere, not?
If this is not the case (I did not check this), then yes. A documentation for these CONFIG_IS_ENABLED() and IS_ENABLED() helpers would be very good.
Quoted 4 lines
Quoted 2 lines
It could be that if you're using some non-free or proprietary preloader instead of SPL, you won't run into this problem.
No, don't worry. I am not running anything evil (;-p).
You won't run into any issues with this problem, as it is fixed in a different way in master already, as Rasmus already pointed out:
https://lore.kernel.org/u-boot/[email protected]/
$ git describe --contains 5fc094351381c4254098a25404d8712324b6918e v2021.10-rc1~19^2
commit 5fc094351381c4254098a25404d8712324b6918e
Author: Teresa Remmet <[email protected]> Date: Thu Jul 15 13:26:32 2021 +0200
drivers: watchdog: wdt-uclass: Use IS_ENABLED for WATCHDOG_AUTOSTART
There is no separate SPL/TPL config for WATCHDOG_AUTOSTART. So use IS_ENABLED instead of CONFIG_IS_ENABLED to make watchdog working in SPL again.
starting watchdog")
drivers/watchdog/wdt-uclass.c +1 -1
@@ -53,7 +53,7 @@ int initr_watchdog(void) 4 * reset_period) / 4; } -if (!CONFIG_IS_ENABLED (WATCHDOG_AUTOSTART )) { +if (!IS_ENABLED (CONFIG_WATCHDOG_AUTOSTART )) {printf ("WDT: Not starting\n" );return 0 ; }
Quoted 66 lines · Stefan Roese
Quoted 54 lines · Marcel Ziswiler
Quoted 53 lines · Marek Vasut
Quoted 51 lines · Marcel Ziswiler
Hi Marek
Quoted 38 lines · Marek Vasut
Commit
830d29ac372("watchdog: Allow to useCONFIG_WDTwithout starting watchdog") completely broke WDT operation in both SPL and TPL, in either case those WDTs are never enabled. Fix it by filling in the missingKconfigoptions for SPL and TPL.Fixes 830d29ac372 ("watchdog: Allow to use CONFIG_WDT without starting watchdog")Signed-off-by Marek Vasut <[email protected]>Cc Pali Rohar <[email protected]>Cc Stefan Roese <[email protected]>---
drivers/watchdog/Kconfig | 20 ++++++++++++++++++++1 file changed, 20 insertions(+)drivers/watchdog/Kconfig +0
-0@@ -273,4 +273,24 @@ config SPL_WDTEnable driver model for watchdog timer in SPL. This is similar to
CONFIG_WDTin U-Boot. +configSPL_WATCHDOG_AUTOSTART
+ bool "Automatically start watchdog timer in SPL"
+ depends on SPL && WDT
+ default y
+ help
+ Automatically start watchdog timer and start servicing it during
+ SPL phase. Enabled by default. Disable this option if you want
+ to compile U-Boot withCONFIG_WDTsupport but do not want to + activate watchdog, like whenCONFIG_WDToption is disabled.drivers/watchdog/Kconfig +7
-0+ +config TPL_WATCHDOG_AUTOSTART + bool "Automatically start watchdog timer in TPL" + depends on TPL && WDT + default y + help + Automatically start watchdog timer and start servicing itQuoted 7 lines
during
+ TPL phase. Enabled by default. Disable this option if you want
+ to compile U-Boot withCONFIG_WDTsupport but do not want to + activate watchdog, like whenCONFIG_WDToption is disabled. +
endmenuThose
Kconfigentries look fine. However, I am wondering where exactly they get used. Am I missing anything?Quoted 8 lines
Quoted 2 lines
Have a look at the patch this Fixes:, if those
Kconfigentries are not present, the WDT is disabled in SPL and TPL unconditionally.Yes, I did. But I guess I was not aware of how exactly that
CONFIG_IS_ENABLED(WATCHDOG_AUTOSTART)behaves.
While I have not really found this documented or the implementation thereof I assume it pre-fixes config stuff
withSPL_resp.TPL_when building those flavors, correct?Yes.
Quoted 7 lines
Quoted 3 lines
I am wondering how many others are unaware of this (just like the author of the patch this fixes). Maybe we
should at least document this properly somewhere, not?If this is not the case (I did not check this), then yes. A documentation for these
CONFIG_IS_ENABLED()andIS_ENABLED()helpers would be very good.
You can possibly even auto-lint for CONFIG_IS_ENABLED(...)/IS_ENABLED(...) usage that is missing the Kconfig entries and warn about that, to prevent patches that break SPL/TPL .
Quoted 11 lines
Quoted 4 lines
Quoted 2 lines
It could be that if you're using some non-free or proprietary preloader instead of SPL, you won't run into this problem.
No, don't worry. I am not running anything evil (;-p).
You won't run into any issues with this problem, as it is fixed in a different way in master already, as Rasmus already pointed out:
Quoted 6 lines
$ git describe --contains 5fc094351381c4254098a25404d8712324b6918e v2021.10-rc1~19^2commit
5fc094351381c4254098a25404d8712324b6918e
Author: Teresa Remmet <[email protected]>
Date: Thu Jul 15 13:26:32 2021 +0200
Yes.