2008-01-28 18:40:21 +03:00
|
|
|
/*
|
2005-04-17 02:20:36 +04:00
|
|
|
* linux/arch/cris/kernel/time.c
|
|
|
|
*
|
|
|
|
* Copyright (C) 1991, 1992, 1995 Linus Torvalds
|
|
|
|
* Copyright (C) 1999, 2000, 2001 Axis Communications AB
|
|
|
|
*
|
|
|
|
* 1994-07-02 Alan Modra
|
|
|
|
* fixed set_rtc_mmss, fixed time.year for >= 2000, new mktime
|
|
|
|
* 1995-03-26 Markus Kuhn
|
|
|
|
* fixed 500 ms bug at call to set_rtc_mmss, fixed DS12887
|
|
|
|
* precision CMOS clock update
|
|
|
|
* 1996-05-03 Ingo Molnar
|
|
|
|
* fixed time warps in do_[slow|fast]_gettimeoffset()
|
|
|
|
* 1997-09-10 Updated NTP code according to technical memorandum Jan '96
|
|
|
|
* "A Kernel Model for Precision Timekeeping" by Dave Mills
|
|
|
|
*
|
|
|
|
* Linux/CRIS specific code:
|
|
|
|
*
|
|
|
|
* Authors: Bjorn Wesen
|
2008-01-28 18:40:21 +03:00
|
|
|
* Johan Adolfsson
|
2005-04-17 02:20:36 +04:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/param.h>
|
|
|
|
#include <linux/jiffies.h>
|
|
|
|
#include <linux/bcd.h>
|
|
|
|
#include <linux/timex.h>
|
|
|
|
#include <linux/init.h>
|
2005-07-27 22:44:40 +04:00
|
|
|
#include <linux/profile.h>
|
2005-10-31 02:03:48 +03:00
|
|
|
#include <linux/sched.h> /* just for sched_clock() - funny that */
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2012-04-05 13:52:55 +04:00
|
|
|
|
|
|
|
#define D(x)
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
#define TICK_SIZE tick
|
|
|
|
|
|
|
|
extern unsigned long loops_per_jiffy; /* init/main.c */
|
|
|
|
unsigned long loops_per_usec;
|
|
|
|
|
|
|
|
int set_rtc_mmss(unsigned long nowtime)
|
|
|
|
{
|
2012-04-05 13:52:55 +04:00
|
|
|
D(printk(KERN_DEBUG "set_rtc_mmss(%lu)\n", nowtime));
|
|
|
|
return 0;
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* grab the time from the RTC chip */
|
2012-04-05 13:52:55 +04:00
|
|
|
unsigned long get_cmos_time(void)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
2012-04-05 13:52:55 +04:00
|
|
|
return 0;
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-03-04 06:57:28 +03:00
|
|
|
int update_persistent_clock(struct timespec now)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
2010-03-04 06:57:28 +03:00
|
|
|
return set_rtc_mmss(now.tv_sec);
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
2010-03-04 06:57:28 +03:00
|
|
|
void read_persistent_clock(struct timespec *ts)
|
|
|
|
{
|
2012-04-05 13:52:55 +04:00
|
|
|
ts->tv_sec = 0;
|
2010-03-04 06:57:28 +03:00
|
|
|
ts->tv_nsec = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-07-27 22:44:40 +04:00
|
|
|
extern void cris_profile_sample(struct pt_regs* regs);
|
|
|
|
|
|
|
|
void
|
|
|
|
cris_do_profile(struct pt_regs* regs)
|
|
|
|
{
|
|
|
|
|
2007-11-15 04:01:00 +03:00
|
|
|
#ifdef CONFIG_SYSTEM_PROFILER
|
2005-07-27 22:44:40 +04:00
|
|
|
cris_profile_sample(regs);
|
|
|
|
#endif
|
|
|
|
|
2007-11-15 04:01:00 +03:00
|
|
|
#ifdef CONFIG_PROFILING
|
2008-01-31 19:56:24 +03:00
|
|
|
profile_tick(CPU_PROFILING);
|
2005-07-27 22:44:40 +04:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2008-01-28 18:40:21 +03:00
|
|
|
unsigned long long sched_clock(void)
|
|
|
|
{
|
2010-07-30 19:33:07 +04:00
|
|
|
return (unsigned long long)jiffies * (NSEC_PER_SEC / HZ) +
|
2008-01-28 18:40:21 +03:00
|
|
|
get_ns_in_jiffie();
|
|
|
|
}
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
static int
|
|
|
|
__init init_udelay(void)
|
|
|
|
{
|
|
|
|
loops_per_usec = (loops_per_jiffy * HZ) / 1000000;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
__initcall(init_udelay);
|