diff options
author | Michal Simek <michal.simek@xilinx.com> | 2018-04-19 15:43:38 +0200 |
---|---|---|
committer | Michal Simek <michal.simek@xilinx.com> | 2018-05-11 09:23:43 +0200 |
commit | 4490e013ee4f2a4b9b6ca9224221fed2788b6940 (patch) | |
tree | 345d05693bcbabe4e209fe8471bafae85c111bc1 /board/xilinx | |
parent | 5b410deac6023338a658e0085c744b29f9880fbe (diff) | |
download | u-boot-4490e013ee4f2a4b9b6ca9224221fed2788b6940.tar.gz |
arm64: zynqmp: Wire watchdog internals
Enable watchdog in full U-Boot.
Similar changes were done by:
"arm: zynq: Wire watchdog internals"
(sha1: e6cc3b25d721c3001019f8b44bfaae2a57255162)
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Diffstat (limited to 'board/xilinx')
-rw-r--r-- | board/xilinx/zynqmp/zynqmp.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index ce7c050a99..4c6f29995a 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -9,11 +9,13 @@ #include <ahci.h> #include <scsi.h> #include <malloc.h> +#include <wdt.h> #include <asm/arch/clk.h> #include <asm/arch/hardware.h> #include <asm/arch/sys_proto.h> #include <asm/arch/psu_init_gpl.h> #include <asm/io.h> +#include <dm/uclass.h> #include <usb.h> #include <dwc3-uboot.h> #include <zynqmppl.h> @@ -22,6 +24,10 @@ DECLARE_GLOBAL_DATA_PTR; +#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_WDT) +static struct udevice *watchdog_dev; +#endif + #if defined(CONFIG_FPGA) && defined(CONFIG_FPGA_ZYNQMPPL) && \ !defined(CONFIG_SPL_BUILD) static xilinx_desc zynqmppl = XILINX_ZYNQMP_DESC; @@ -281,6 +287,11 @@ int board_early_init_f(void) ret = psu_init(); #endif +#if defined(CONFIG_WDT) && !defined(CONFIG_SPL_BUILD) + /* bss is not cleared at time when watchdog_reset() is called */ + watchdog_dev = NULL; +#endif + return ret; } @@ -299,9 +310,40 @@ int board_init(void) } #endif +#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_WDT) + if (uclass_get_device(UCLASS_WDT, 0, &watchdog_dev)) { + puts("Watchdog: Not found!\n"); + } else { + wdt_start(watchdog_dev, 0, 0); + puts("Watchdog: Started\n"); + } +#endif + return 0; } +#ifdef CONFIG_WATCHDOG +/* Called by macro WATCHDOG_RESET */ +void watchdog_reset(void) +{ +# if !defined(CONFIG_SPL_BUILD) + static ulong next_reset; + ulong now; + + if (!watchdog_dev) + return; + + now = timer_get_us(); + + /* Do not reset the watchdog too often */ + if (now > next_reset) { + wdt_reset(watchdog_dev); + next_reset = now + 1000; + } +# endif +} +#endif + int board_early_init_r(void) { u32 val; |