]> git.ipfire.org Git - people/ms/u-boot.git/blob - post/cpu/ppc4xx/watchdog.c
drivers, block: remove sil680 driver
[people/ms/u-boot.git] / post / cpu / ppc4xx / watchdog.c
1 /*
2 * (C) Copyright 2007
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
5 * Author: Igor Lisitsin <igor@emcraft.com>
6 *
7 * SPDX-License-Identifier: GPL-2.0+
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
22 #include <post.h>
23
24 #if CONFIG_POST & CONFIG_SYS_POST_WATCHDOG
25
26 #include <watchdog.h>
27
28 int watchdog_post_test (int flags)
29 {
30 if (flags & POST_REBOOT) {
31 /* Test passed */
32 return 0;
33 }
34 else {
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
52 #endif /* CONFIG_POST & CONFIG_SYS_POST_WATCHDOG */