diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2020-07-01 11:11:02 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2020-07-11 06:14:04 +0200 |
commit | 0dbd1a8bd5399ee81a657e69da04b64d9d6756ef (patch) | |
tree | eb51e452185bece3e058081a528ce0861407f2f4 | |
parent | 823d4400f244296c73a77cd9b83e9de96b6af9c2 (diff) | |
download | barebox-0dbd1a8bd5399ee81a657e69da04b64d9d6756ef.tar.gz barebox-0dbd1a8bd5399ee81a657e69da04b64d9d6756ef.tar.xz |
ARM: at91: watchdog: implement at91_wdt_disable
Board code might want to disable the watchdog in PBL and enable it later
prior to boot. Provide a helper to do so.
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | arch/arm/mach-at91/include/mach/at91_wdt.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/arch/arm/mach-at91/include/mach/at91_wdt.h b/arch/arm/mach-at91/include/mach/at91_wdt.h index 36d37b9d2d..d295d35d1b 100644 --- a/arch/arm/mach-at91/include/mach/at91_wdt.h +++ b/arch/arm/mach-at91/include/mach/at91_wdt.h @@ -35,4 +35,20 @@ #define AT91_WDT_WDUNF (1 << 0) /* Watchdog Underflow */ #define AT91_WDT_WDERR (1 << 1) /* Watchdog Error */ +#ifndef __ASSEMBLY__ +// SPDX-License-Identifier: BSD-1-Clause +/* + * Copyright (c) 2006, Atmel Corporation + */ + +#include <asm-generic/io.h> + +static inline void at91_wdt_disable(void __iomem *wdt_base) +{ + u32 reg = readl(wdt_base + AT91_WDT_MR); + reg |= AT91_WDT_WDDIS; + writel(reg, wdt_base + AT91_WDT_MR); +} + +#endif /* __ASSEMBLY__ */ #endif |