3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * SPDX-License-Identifier: GPL-2.0+
13 * The test verifies the watchdog timer operation.
14 * On the first iteration, the test routine disables interrupts and
15 * makes a 10-second delay. If the system does not reboot during this delay,
16 * the watchdog timer is not operational and the test fails. If the system
17 * reboots, on the second iteration the test routine reports a success.
23 #if CONFIG_POST & CONFIG_SYS_POST_WATCHDOG
25 static ulong gettbl (void)
29 asm ("mftbl %0":"=r" (r));
34 int watchdog_post_test (int flags)
36 if (flags & POST_REBOOT) {
42 int ints = disable_interrupts ();
43 ulong base = gettbl ();
44 ulong clk = get_tbclk ();
46 while ((gettbl () - base) / 10 < clk);
52 * If we have reached this point, the watchdog timer
59 #endif /* CONFIG_POST & CONFIG_SYS_POST_WATCHDOG */