From: Marek Vasut Date: Sun, 9 Jun 2019 01:46:21 +0000 (+0200) Subject: watchdog: Split WDT from SPL_WDT X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=6874cb72204ffbdbe4290baae11d0b9b8ed47ed1;p=u-boot.git watchdog: Split WDT from SPL_WDT Use CONFIG_IS_ENABLED(WDT) to permit use of WDT in SPL without DM, while the full U-Boot can use rich DM/DT WDT driver. Signed-off-by: Marek Vasut Cc: Peng Fan Cc: Stefano Babic Tested-by: Heiko Schocher Tested-by: Suniel Mahesh --- diff --git a/common/board_r.c b/common/board_r.c index abc31b17b8..ee4dcedd5f 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -700,7 +700,7 @@ static init_fnc_t init_sequence_r[] = { stdio_init_tables, initr_serial, initr_announce, -#if defined(CONFIG_WDT) +#if CONFIG_IS_ENABLED(WDT) initr_watchdog, #endif INIT_FUNC_WATCHDOG_RESET diff --git a/common/spl/Kconfig b/common/spl/Kconfig index 5978fb2934..81bd908f9b 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -1061,6 +1061,7 @@ endif config SPL_WATCHDOG_SUPPORT 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/common/spl/spl.c b/common/spl/spl.c index d5e3f680f4..c182705b3f 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -603,7 +603,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2) spl_board_init(); #endif -#if defined(CONFIG_SPL_WATCHDOG_SUPPORT) && defined(CONFIG_WDT) +#if defined(CONFIG_SPL_WATCHDOG_SUPPORT) && CONFIG_IS_ENABLED(WDT) initr_watchdog(); #endif diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index ee0ddffe73..de9bd87236 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -169,4 +169,11 @@ config WDT_TANGIER Intel Tangier SoC. If you're using a board with Intel Tangier SoC, say Y here. +config SPL_WDT + bool "Enable driver model for watchdog timer drivers in SPL" + depends on SPL_DM + help + Enable driver model for watchdog timer in SPL. + This is similar to CONFIG_WDT in U-Boot. + endmenu diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index 68c989aa0b..97aa6a836c 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile @@ -15,7 +15,7 @@ obj-$(CONFIG_XILINX_TB_WATCHDOG) += xilinx_tb_wdt.o obj-$(CONFIG_OMAP_WATCHDOG) += omap_wdt.o obj-$(CONFIG_DESIGNWARE_WATCHDOG) += designware_wdt.o obj-$(CONFIG_ULP_WATCHDOG) += ulp_wdog.o -obj-$(CONFIG_WDT) += wdt-uclass.o +obj-$(CONFIG_$(SPL_TPL_)WDT) += wdt-uclass.o obj-$(CONFIG_WDT_SANDBOX) += sandbox_wdt.o obj-$(CONFIG_WDT_ARMADA_37XX) += armada-37xx-wdt.o obj-$(CONFIG_WDT_ASPEED) += ast_wdt.o diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h index 02a3ed6838..7c2220643b 100644 --- a/include/asm-generic/global_data.h +++ b/include/asm-generic/global_data.h @@ -137,7 +137,7 @@ typedef struct global_data { #if defined(CONFIG_TRANSLATION_OFFSET) fdt_addr_t translation_offset; /* optional translation offset */ #endif -#if defined(CONFIG_WDT) +#if CONFIG_IS_ENABLED(WDT) struct udevice *watchdog_dev; #endif } gd_t; diff --git a/include/wdt.h b/include/wdt.h index aa77d3e9b4..5bcff24ab3 100644 --- a/include/wdt.h +++ b/include/wdt.h @@ -106,7 +106,7 @@ struct wdt_ops { int (*expire_now)(struct udevice *dev, ulong flags); }; -#if defined(CONFIG_WDT) +#if CONFIG_IS_ENABLED(WDT) #ifndef CONFIG_WATCHDOG_TIMEOUT_MSECS #define CONFIG_WATCHDOG_TIMEOUT_MSECS (60 * 1000) #endif