Ingo van Lil | 3eb90ba | 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 | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
Ingo van Lil | 3eb90ba | 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 | c4c9fbe | 2011-10-12 02:31:39 +0000 | [diff] [blame] | 28 | |
| 29 | void mdelay(unsigned long msec) |
| 30 | { |
| 31 | while (msec--) |
| 32 | udelay(1000); |
| 33 | } |