On 8/23/23 14:00, Oleksandr Suvorov wrote:
Add SPL_HW_WATCHDOG Kconfig symbol which can be used to enable
non-WDT hardware watchdog in SPL.

Hmmm, my hope / plan was to completely drop HW_WATCHDOG at some point.
It's some old relict and if I don't miss something completely, it's more
a "normal" watchdog that needs to get triggered very early in most
cases (PowerPC etc). So adding some more *_HW_WATCHDOG stuff does not
sound appealing to me.

Could you perhaps investigate a bit, if your HW_WATCHDOG use case can
be converted to the "normal" watchdog support instead?

Thanks,
Stefan

Co-developed-by: Igor Opaniuk <[email protected]>
Signed-off-by: Igor Opaniuk <[email protected]>
Signed-off-by: Oleksandr Suvorov <[email protected]>
---

Changes in v2:
- remove mistakenly included unwanted changes

  common/spl/Kconfig        | 1 -
  drivers/Makefile          | 1 +
  drivers/sysreset/Kconfig  | 6 ++++++
  drivers/sysreset/Makefile | 2 +-
  drivers/watchdog/Kconfig  | 4 ++++
  5 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index c5dd476db58..07d9dac29bd 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -1351,7 +1351,6 @@ config SPL_THERMAL
config SPL_WATCHDOG
        bool "Support watchdog drivers"
-       imply SPL_WDT if !HW_WATCHDOG
        help
          Enable support for watchdog drivers in SPL. A watchdog is
          typically a hardware peripheral which can reset the system when it
diff --git a/drivers/Makefile b/drivers/Makefile
index efc2a4afb24..2eb8ec0a894 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -62,6 +62,7 @@ obj-$(CONFIG_SPL_USB_GADGET) += usb/gadget/
  obj-$(CONFIG_SPL_USB_GADGET) += usb/common/
  obj-$(CONFIG_SPL_USB_GADGET) += usb/gadget/udc/
  obj-$(CONFIG_SPL_WATCHDOG) += watchdog/
+obj-$(CONFIG_SPL_HW_WATCHDOG) += watchdog/
  obj-$(CONFIG_SPL_USB_HOST) += usb/host/
  obj-$(CONFIG_SPL_SATA) += ata/ scsi/
  obj-$(CONFIG_SPL_LEGACY_BLOCK) += block/
diff --git a/drivers/sysreset/Kconfig b/drivers/sysreset/Kconfig
index bdbe2a95364..0d21673e402 100644
--- a/drivers/sysreset/Kconfig
+++ b/drivers/sysreset/Kconfig
@@ -157,6 +157,12 @@ config SYSRESET_WATCHDOG
        help
          Reboot support for generic watchdog reset.
+config SPL_SYSRESET_WATCHDOG
+       bool "Enable support for watchdog reboot driver in SPL mode"
+       select SPL_WDT
+       help
+         Reboot support for generic watchdog reset in SPL mode.
+
  config SYSRESET_WATCHDOG_AUTO
        bool "Automatically register first watchdog with sysreset"
        depends on SYSRESET_WATCHDOG
diff --git a/drivers/sysreset/Makefile b/drivers/sysreset/Makefile
index 40c876764af..e5a7fc07a81 100644
--- a/drivers/sysreset/Makefile
+++ b/drivers/sysreset/Makefile
@@ -18,7 +18,7 @@ obj-$(CONFIG_SYSRESET_SOCFPGA) += sysreset_socfpga.o
  obj-$(CONFIG_SYSRESET_SOCFPGA_SOC64) += sysreset_socfpga_soc64.o
  obj-$(CONFIG_SYSRESET_TI_SCI) += sysreset-ti-sci.o
  obj-$(CONFIG_SYSRESET_SYSCON) += sysreset_syscon.o
-obj-$(CONFIG_SYSRESET_WATCHDOG) += sysreset_watchdog.o
+obj-$(CONFIG_$(SPL_)SYSRESET_WATCHDOG) += sysreset_watchdog.o
  obj-$(CONFIG_SYSRESET_RESETCTL) += sysreset_resetctl.o
  obj-$(CONFIG_$(SPL_TPL_)SYSRESET_AT91) += sysreset_at91.o
  obj-$(CONFIG_$(SPL_TPL_)SYSRESET_X86) += sysreset_x86.o
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 07fc4940e91..d696a04fc18 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -39,9 +39,13 @@ config WATCHDOG_TIMEOUT_MSECS
  config HW_WATCHDOG
        bool
+config SPL_HW_WATCHDOG
+       bool
+
  config IMX_WATCHDOG
        bool "Enable Watchdog Timer support for IMX and LSCH2 of NXP"
        select HW_WATCHDOG if !WDT
+       select SPL_HW_WATCHDOG if !SPL_WDT
        help
          Select this to enable the IMX and LSCH2 of Layerscape watchdog
          driver.

Viele Grüße,
Stefan Roese

--
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]

Reply via email to