xref: /openbmc/u-boot/lib/time.c (revision cb3761ea)
1 /*
2  * (C) Copyright 2000-2009
3  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4  *
5  * SPDX-License-Identifier:	GPL-2.0+
6  */
7 
8 #include <common.h>
9 #include <watchdog.h>
10 
11 #ifndef CONFIG_WD_PERIOD
12 # define CONFIG_WD_PERIOD	(10 * 1000 * 1000)	/* 10 seconds default*/
13 #endif
14 
15 /* ------------------------------------------------------------------------- */
16 
17 void udelay(unsigned long usec)
18 {
19 	ulong kv;
20 
21 	do {
22 		WATCHDOG_RESET();
23 		kv = usec > CONFIG_WD_PERIOD ? CONFIG_WD_PERIOD : usec;
24 		__udelay (kv);
25 		usec -= kv;
26 	} while(usec);
27 }
28 
29 void mdelay(unsigned long msec)
30 {
31 	while (msec--)
32 		udelay(1000);
33 }
34