Ingo van Lil | f0f778a | 2009-11-24 14:09:21 +0100 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2000-2009 |
| 3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 4 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
Ingo van Lil | f0f778a | 2009-11-24 14:09:21 +0100 | [diff] [blame] | 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 | } |
Anatolij Gustschin | 589c2ff | 2011-10-12 02:31:39 +0000 | [diff] [blame] | 28 | |
| 29 | void mdelay(unsigned long msec) |
| 30 | { |
| 31 | while (msec--) |
| 32 | udelay(1000); |
| 33 | } |