Skip to content

Commit

Permalink
watchdog: Split WDT from SPL_WDT
Browse files Browse the repository at this point in the history
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.

This commit also introduces new CONFIG_SPL_WDT Kconfig define to
allow re-using of wdt-uclass in SPL by some boards.

In other words some boards by defining CONFIG_WDT also re-use
some WDT API in SPL and hence, after the split, they need to
explicitly define CONFIG_SPL_WDT.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Lukasz Majewski <lukma@denx.de>
Cc: Peng Fan <Peng.Fan@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
  • Loading branch information
Marek Vasut authored and Lukasz Majewski committed Jun 6, 2019
1 parent 2253e40 commit 98c9579
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion common/board_r.c
Expand Up @@ -678,7 +678,7 @@ static init_fnc_t init_sequence_r[] = {
#ifdef CONFIG_DM
initr_dm,
#endif
#if defined(CONFIG_WDT)
#if CONFIG_IS_ENABLED(WDT)
initr_watchdog,
#endif
#if defined(CONFIG_ARM) || defined(CONFIG_NDS32) || defined(CONFIG_RISCV) || \
Expand Down
2 changes: 1 addition & 1 deletion common/spl/spl.c
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions configs/mt7629_rfb_defconfig
Expand Up @@ -70,6 +70,7 @@ CONFIG_SYSRESET_WATCHDOG=y
CONFIG_TIMER=y
CONFIG_SPL_TIMER=y
CONFIG_MTK_TIMER=y
CONFIG_SPL_WDT=y
CONFIG_WDT_MTK=y
CONFIG_LZMA=y
# CONFIG_EFI_LOADER is not set
1 change: 1 addition & 0 deletions configs/picosam9g45_defconfig
Expand Up @@ -43,5 +43,6 @@ CONFIG_USB_EHCI_HCD=y
CONFIG_USB_STORAGE=y
CONFIG_LCD=y
CONFIG_WDT=y
CONFIG_SPL_WDT=y
CONFIG_WDT_AT91=y
CONFIG_OF_LIBFDT=y
1 change: 1 addition & 0 deletions configs/x530_defconfig
Expand Up @@ -75,5 +75,6 @@ CONFIG_USB_STORAGE=y
CONFIG_USB_HOST_ETHER=y
CONFIG_USB_ETHER_ASIX=y
CONFIG_USB_ETHER_ASIX88179=y
CONFIG_SPL_WDT=y
CONFIG_WDT=y
CONFIG_WDT_ORION=y
10 changes: 10 additions & 0 deletions drivers/watchdog/Kconfig
Expand Up @@ -48,6 +48,16 @@ config ULP_WATCHDOG
help
Say Y here to enable i.MX7ULP watchdog driver.

config SPL_WDT
bool "Enable driver model for watchdog timer drivers in SPL"
imply WATCHDOG
help
Enable driver model for watchdog timer in SPL. At the moment the API
is very simple and only supports four operations:
start, stop, reset and expire_now (expire immediately).
What exactly happens when the timer expires is up to a particular
device/driver.

config WDT
bool "Enable driver model for watchdog timer drivers"
depends on DM
Expand Down
2 changes: 1 addition & 1 deletion drivers/watchdog/Makefile
Expand Up @@ -16,7 +16,7 @@ obj-$(CONFIG_OMAP_WATCHDOG) += omap_wdt.o
obj-$(CONFIG_DESIGNWARE_WATCHDOG) += designware_wdt.o
obj-$(CONFIG_TANGIER_WATCHDOG) += tangier_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
Expand Down
2 changes: 1 addition & 1 deletion include/asm-generic/global_data.h
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion include/wdt.h
Expand Up @@ -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
Expand Down

0 comments on commit 98c9579

Please sign in to comment.