wdenk | 4a55170 | 2003-10-08 23:26:14 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2003, Psyent Corporation <www.psyent.com> |
| 3 | * Scott McNutt <smcnutt@psyent.com> |
| 4 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
wdenk | 4a55170 | 2003-10-08 23:26:14 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include <common.h> |
wdenk | 028ab6b | 2004-02-23 23:54:43 +0000 | [diff] [blame] | 9 | #include <watchdog.h> |
wdenk | 4a55170 | 2003-10-08 23:26:14 +0000 | [diff] [blame] | 10 | |
| 11 | |
| 12 | extern void dly_clks( unsigned long ticks ); |
| 13 | |
Ingo van Lil | 3eb90ba | 2009-11-24 14:09:21 +0100 | [diff] [blame] | 14 | void __udelay(unsigned long usec) |
wdenk | 4a55170 | 2003-10-08 23:26:14 +0000 | [diff] [blame] | 15 | { |
| 16 | /* The Nios core doesn't have a timebase, so we do our |
| 17 | * best for now and call a low-level loop that counts |
| 18 | * cpu clocks. |
| 19 | */ |
| 20 | unsigned long cnt = (CONFIG_SYS_CLK_FREQ/1000000) * usec; |
wdenk | 4a55170 | 2003-10-08 23:26:14 +0000 | [diff] [blame] | 21 | dly_clks (cnt); |
| 22 | } |