License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[sfrench/cifs-2.6.git] / arch / cris / kernel / time.c
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  *  linux/arch/cris/kernel/time.c
4  *
5  *  Copyright (C) 1991, 1992, 1995  Linus Torvalds
6  *  Copyright (C) 1999, 2000, 2001 Axis Communications AB
7  *
8  * 1994-07-02    Alan Modra
9  *      fixed set_rtc_mmss, fixed time.year for >= 2000, new mktime
10  * 1995-03-26    Markus Kuhn
11  *      fixed 500 ms bug at call to set_rtc_mmss, fixed DS12887
12  *      precision CMOS clock update
13  * 1996-05-03    Ingo Molnar
14  *      fixed time warps in do_[slow|fast]_gettimeoffset()
15  * 1997-09-10   Updated NTP code according to technical memorandum Jan '96
16  *              "A Kernel Model for Precision Timekeeping" by Dave Mills
17  *
18  * Linux/CRIS specific code:
19  *
20  * Authors:    Bjorn Wesen
21  *             Johan Adolfsson
22  *
23  */
24
25 #include <linux/errno.h>
26 #include <linux/module.h>
27 #include <linux/param.h>
28 #include <linux/jiffies.h>
29 #include <linux/bcd.h>
30 #include <linux/timex.h>
31 #include <linux/init.h>
32 #include <linux/profile.h>
33 #include <linux/sched/clock.h>
34
35
36 #define D(x)
37
38 #define TICK_SIZE tick
39
40 extern unsigned long loops_per_jiffy; /* init/main.c */
41 unsigned long loops_per_usec;
42
43 extern void cris_profile_sample(struct pt_regs* regs);
44
45 void
46 cris_do_profile(struct pt_regs* regs)
47 {
48
49 #ifdef CONFIG_SYSTEM_PROFILER
50         cris_profile_sample(regs);
51 #endif
52
53 #ifdef CONFIG_PROFILING
54         profile_tick(CPU_PROFILING);
55 #endif
56 }
57
58 #ifndef CONFIG_GENERIC_SCHED_CLOCK
59 unsigned long long sched_clock(void)
60 {
61         return (unsigned long long)jiffies * (NSEC_PER_SEC / HZ) +
62                 get_ns_in_jiffie();
63 }
64 #endif
65
66 static int
67 __init init_udelay(void)
68 {
69         loops_per_usec = (loops_per_jiffy * HZ) / 1000000;
70         return 0;
71 }
72
73 __initcall(init_udelay);