blob: 50a09ad17a952b394af31d782d82c843725bede5 [file] [log] [blame]
Daniel Hellstrom9d7c6b22008-03-28 09:47:00 +01001/*
2 * (C) Copyright 2000, 2001
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
5 * (C) Copyright 2007
6 * Daniel Hellstrom, Gaisler Research, daniel@gaisler.com.
7 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02008 * SPDX-License-Identifier: GPL-2.0+
Daniel Hellstrom9d7c6b22008-03-28 09:47:00 +01009 */
10
11#include <common.h>
12
13/* Implemented by SPARC CPUs */
14extern void cpu_wait_ticks(unsigned long ticks);
15extern unsigned long cpu_usec2ticks(unsigned long usec);
16extern unsigned long cpu_ticks2usec(unsigned long ticks);
17
18/* ------------------------------------------------------------------------- */
19
20void wait_ticks(unsigned long ticks)
21{
22 cpu_wait_ticks(ticks);
23}
24
25/*
26 * This function is intended for SHORT delays only.
27 */
28unsigned long usec2ticks(unsigned long usec)
29{
30 return cpu_usec2ticks(usec);
31}
32
33/* ------------------------------------------------------------------------- */
34
35/*
36 * We implement the delay by converting the delay (the number of
37 * microseconds to wait) into a number of time base ticks; then we
38 * watch the time base until it has incremented by that amount.
39 */
Ingo van Lilf0f778a2009-11-24 14:09:21 +010040void __udelay(unsigned long usec)
Daniel Hellstrom9d7c6b22008-03-28 09:47:00 +010041{
42 ulong ticks = usec2ticks(usec);
43
44 wait_ticks(ticks);
45}
46
47/* ------------------------------------------------------------------------- */
48
49unsigned long ticks2usec(unsigned long ticks)
50{
51 return cpu_ticks2usec(ticks);
52}
53
54/* ------------------------------------------------------------------------- */
55
56int init_timebase(void)
57{
58
59 return (0);
60}
61
62/* ------------------------------------------------------------------------- */