1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * (C) Copyright 2000, 2001
4 * Erik Theisen, Wave 7 Optics, etheisen@mindspring.com.
6 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
9 #include <ppc_asm.tmpl>
15 * unsigned long long get_ticks(void);
17 * read timebase as "long long"
29 * Delay for a number of ticks
34 mflr r0 /* save link register */
35 stw r0, 20(r1) /* Use r0 or GDB will be unhappy */
36 stw r14, 12(r1) /* save used registers */
38 mr r14, r3 /* save tick count */
39 bl get_ticks /* Get start time */
41 /* Calculate end time */
42 addc r14, r4, r14 /* Compute end time lower */
43 addze r15, r3 /* and end time upper */
45 WATCHDOG_RESET /* Trigger watchdog, if needed */
46 1: bl get_ticks /* Get current time */
47 subfc r4, r4, r14 /* Subtract current time from end time */
49 bge 1b /* Loop until time expired */
51 lwz r15, 8(r1) /* restore saved registers */