]> git.ipfire.org Git - people/ms/u-boot.git/blame - post/cpu/ppc4xx/watchdog.c
drivers, block: remove sil680 driver
[people/ms/u-boot.git] / post / cpu / ppc4xx / watchdog.c
CommitLineData
a11e0696
IL
1/*
2 * (C) Copyright 2007
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
b4489621
SP
5 * Author: Igor Lisitsin <igor@emcraft.com>
6 *
1a459660 7 * SPDX-License-Identifier: GPL-2.0+
a11e0696
IL
8 */
9
10#include <common.h>
11
12/*
13 * Watchdog test
14 *
15 * The test verifies the watchdog timer operation.
16 * On the first iteration, the test routine disables interrupts and
17 * makes a 10-second delay. If the system does not reboot during this delay,
18 * the watchdog timer is not operational and the test fails. If the system
19 * reboots, on the second iteration the test routine reports a success.
20 */
21
a11e0696 22#include <post.h>
a11e0696 23
6d0f6bcf 24#if CONFIG_POST & CONFIG_SYS_POST_WATCHDOG
a11e0696 25
b4489621
SP
26#include <watchdog.h>
27
a11e0696
IL
28int watchdog_post_test (int flags)
29{
30 if (flags & POST_REBOOT) {
31 /* Test passed */
a11e0696 32 return 0;
b4489621
SP
33 }
34 else {
a11e0696
IL
35 /* 10-second delay */
36 int ints = disable_interrupts ();
37 ulong base = post_time_ms (0);
38
39 while (post_time_ms (base) < 10000)
40 ;
41 if (ints)
42 enable_interrupts ();
43
44 /*
45 * If we have reached this point, the watchdog timer
46 * does not work
47 */
48 return -1;
49 }
50}
51
6d0f6bcf 52#endif /* CONFIG_POST & CONFIG_SYS_POST_WATCHDOG */