• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  linux/arch/cris/kernel/time.c
3  *
4  *  Copyright (C) 1991, 1992, 1995  Linus Torvalds
5  *  Copyright (C) 1999, 2000, 2001 Axis Communications AB
6  *
7  * 1994-07-02    Alan Modra
8  *	fixed set_rtc_mmss, fixed time.year for >= 2000, new mktime
9  * 1995-03-26    Markus Kuhn
10  *      fixed 500 ms bug at call to set_rtc_mmss, fixed DS12887
11  *      precision CMOS clock update
12  * 1996-05-03    Ingo Molnar
13  *      fixed time warps in do_[slow|fast]_gettimeoffset()
14  * 1997-09-10	Updated NTP code according to technical memorandum Jan '96
15  *		"A Kernel Model for Precision Timekeeping" by Dave Mills
16  *
17  * Linux/CRIS specific code:
18  *
19  * Authors:    Bjorn Wesen
20  *             Johan Adolfsson
21  *
22  */
23 
24 #include <linux/errno.h>
25 #include <linux/module.h>
26 #include <linux/param.h>
27 #include <linux/jiffies.h>
28 #include <linux/bcd.h>
29 #include <linux/timex.h>
30 #include <linux/init.h>
31 #include <linux/profile.h>
32 #include <linux/sched.h>	/* just for sched_clock() - funny that */
33 
34 
35 #define D(x)
36 
37 #define TICK_SIZE tick
38 
39 extern unsigned long loops_per_jiffy; /* init/main.c */
40 unsigned long loops_per_usec;
41 
set_rtc_mmss(unsigned long nowtime)42 int set_rtc_mmss(unsigned long nowtime)
43 {
44 	D(printk(KERN_DEBUG "set_rtc_mmss(%lu)\n", nowtime));
45 	return 0;
46 }
47 
48 /* grab the time from the RTC chip */
get_cmos_time(void)49 unsigned long get_cmos_time(void)
50 {
51 	return 0;
52 }
53 
54 
update_persistent_clock(struct timespec now)55 int update_persistent_clock(struct timespec now)
56 {
57 	return set_rtc_mmss(now.tv_sec);
58 }
59 
read_persistent_clock(struct timespec * ts)60 void read_persistent_clock(struct timespec *ts)
61 {
62 	ts->tv_sec = 0;
63 	ts->tv_nsec = 0;
64 }
65 
66 
67 extern void cris_profile_sample(struct pt_regs* regs);
68 
69 void
cris_do_profile(struct pt_regs * regs)70 cris_do_profile(struct pt_regs* regs)
71 {
72 
73 #ifdef CONFIG_SYSTEM_PROFILER
74         cris_profile_sample(regs);
75 #endif
76 
77 #ifdef CONFIG_PROFILING
78 	profile_tick(CPU_PROFILING);
79 #endif
80 }
81 
sched_clock(void)82 unsigned long long sched_clock(void)
83 {
84 	return (unsigned long long)jiffies * (NSEC_PER_SEC / HZ) +
85 		get_ns_in_jiffie();
86 }
87 
88 static int
init_udelay(void)89 __init init_udelay(void)
90 {
91 	loops_per_usec = (loops_per_jiffy * HZ) / 1000000;
92 	return 0;
93 }
94 
95 __initcall(init_udelay);
96