]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - arch/sparc/lib/time.c
Merge branch 'u-boot-ti/master' into 'u-boot-arm/master'
[karo-tx-uboot.git] / arch / sparc / lib / time.c
1 /*
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  *
8  * SPDX-License-Identifier:     GPL-2.0+
9  */
10
11 #include <common.h>
12
13 /* Implemented by SPARC CPUs */
14 extern void cpu_wait_ticks(unsigned long ticks);
15 extern unsigned long cpu_usec2ticks(unsigned long usec);
16 extern unsigned long cpu_ticks2usec(unsigned long ticks);
17
18 /* ------------------------------------------------------------------------- */
19
20 void wait_ticks(unsigned long ticks)
21 {
22         cpu_wait_ticks(ticks);
23 }
24
25 /*
26  * This function is intended for SHORT delays only.
27  */
28 unsigned 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  */
40 void __udelay(unsigned long usec)
41 {
42         ulong ticks = usec2ticks(usec);
43
44         wait_ticks(ticks);
45 }
46
47 /* ------------------------------------------------------------------------- */
48
49 unsigned long ticks2usec(unsigned long ticks)
50 {
51         return cpu_ticks2usec(ticks);
52 }
53
54 /* ------------------------------------------------------------------------- */
55
56 int init_timebase(void)
57 {
58
59         return (0);
60 }
61
62 /* ------------------------------------------------------------------------- */