]> git.ipfire.org Git - people/ms/u-boot.git/blame - drivers/watchdog/bcm2835_wdt.c
Remove CONFIG_SYS_BOOTCOUNT_SINGLEWORD
[people/ms/u-boot.git] / drivers / watchdog / bcm2835_wdt.c
CommitLineData
45a6d231
PP
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
17static __efi_runtime_data bool enabled = true;
18
19extern void reset_cpu(ulong ticks);
20
21void hw_watchdog_reset(void)
22{
23 if (enabled)
24 reset_cpu(SECS_TO_WDOG_TICKS(MAX_TIMEOUT));
25}
26
27void hw_watchdog_init(void)
28{
29 hw_watchdog_reset();
30}
31
32void __efi_runtime hw_watchdog_disable(void)
33{
34 enabled = false;
35}