1/*
2 * linux/arch/v850/kernel/time.c -- Arch-dependent timer functions
3 *
4 *  Copyright (C) 1991, 1992, 1995, 2001, 2002  Linus Torvalds
5 *
6 * This file contains the v850-specific time handling details.
7 * Most of the stuff is located in the machine specific files.
8 *
9 * 1997-09-10	Updated NTP code according to technical memorandum Jan '96
10 *		"A Kernel Model for Precision Timekeeping" by Dave Mills
11 */
12
13#include <linux/errno.h>
14#include <linux/kernel.h>
15#include <linux/module.h>
16#include <linux/param.h>
17#include <linux/string.h>
18#include <linux/mm.h>
19#include <linux/interrupt.h>
20#include <linux/time.h>
21#include <linux/timex.h>
22#include <linux/profile.h>
23
24#include <asm/io.h>
25
26#include "mach.h"
27
28#define TICK_SIZE	(tick_nsec / 1000)
29
30/*
31 * timer_interrupt() needs to keep up the real-time clock,
32 * as well as call the "do_timer()" routine every clocktick
33 */
34static irqreturn_t timer_interrupt (int irq, void *dummy, struct pt_regs *regs)
35{
36
37	/* may need to kick the hardware timer */
38	if (mach_tick)
39	  mach_tick ();
40
41	do_timer (1);
42#ifndef CONFIG_SMP
43	update_process_times(user_mode(regs));
44#endif
45	profile_tick(CPU_PROFILING, regs);
46
47	return IRQ_HANDLED;
48}
49
50static int timer_dev_id;
51static struct irqaction timer_irqaction = {
52	timer_interrupt,
53	IRQF_DISABLED,
54	CPU_MASK_NONE,
55	"timer",
56	&timer_dev_id,
57	NULL
58};
59
60void time_init (void)
61{
62	mach_gettimeofday (&xtime);
63	mach_sched_init (&timer_irqaction);
64}
65