]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | // SPDX-License-Identifier: GPL-2.0 |
daa00b9c | 2 | /* |
1da177e4 LT |
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 | |
daa00b9c | 21 | * Johan Adolfsson |
1da177e4 LT |
22 | * |
23 | */ | |
24 | ||
1da177e4 LT |
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> | |
21783c97 | 32 | #include <linux/profile.h> |
e6017571 | 33 | #include <linux/sched/clock.h> |
1da177e4 | 34 | |
9c75fc8c JN |
35 | |
36 | #define D(x) | |
1da177e4 LT |
37 | |
38 | #define TICK_SIZE tick | |
39 | ||
1da177e4 LT |
40 | extern unsigned long loops_per_jiffy; /* init/main.c */ |
41 | unsigned long loops_per_usec; | |
42 | ||
21783c97 MS |
43 | extern void cris_profile_sample(struct pt_regs* regs); |
44 | ||
45 | void | |
46 | cris_do_profile(struct pt_regs* regs) | |
47 | { | |
48 | ||
0188e603 | 49 | #ifdef CONFIG_SYSTEM_PROFILER |
21783c97 MS |
50 | cris_profile_sample(regs); |
51 | #endif | |
52 | ||
0188e603 | 53 | #ifdef CONFIG_PROFILING |
c2610381 | 54 | profile_tick(CPU_PROFILING); |
21783c97 MS |
55 | #endif |
56 | } | |
57 | ||
d3dad475 | 58 | #ifndef CONFIG_GENERIC_SCHED_CLOCK |
daa00b9c JN |
59 | unsigned long long sched_clock(void) |
60 | { | |
60dbd663 | 61 | return (unsigned long long)jiffies * (NSEC_PER_SEC / HZ) + |
daa00b9c JN |
62 | get_ns_in_jiffie(); |
63 | } | |
d3dad475 | 64 | #endif |
daa00b9c | 65 | |
1da177e4 LT |
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); |