]> git.ipfire.org Git - people/ms/u-boot.git/blob - drivers/watchdog/bcm2835_wdt.c
arm64: zynqmp: Add reference to pmu firmware node
[people/ms/u-boot.git] / drivers / watchdog / bcm2835_wdt.c
1 /*
2 * Watchdog driver for Broadcom BCM2835
3 *
4 * Copyright (C) 2017 Paolo Pisati <p.pisati@gmail.com>
5 *
6 * SPDX-License-Identifier: GPL-2.0
7 */
8
9 #include <common.h>
10 #include <efi_loader.h>
11 #include <asm/io.h>
12 #include <asm/arch/wdog.h>
13
14 #define SECS_TO_WDOG_TICKS(x) ((x) << 16)
15 #define MAX_TIMEOUT 0xf /* ~15s */
16
17 static __efi_runtime_data bool enabled = true;
18
19 extern void reset_cpu(ulong ticks);
20
21 void hw_watchdog_reset(void)
22 {
23 if (enabled)
24 reset_cpu(SECS_TO_WDOG_TICKS(MAX_TIMEOUT));
25 }
26
27 void hw_watchdog_init(void)
28 {
29 hw_watchdog_reset();
30 }
31
32 void __efi_runtime hw_watchdog_disable(void)
33 {
34 enabled = false;
35 }