diff options
author | Mark.Zhan <rongkai.zhan@windriver.com> | 2006-05-06 05:04:20 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2006-06-19 12:39:18 -0400 |
commit | a240a469649eaab03f0c4c7fbb21ea5041bf5572 (patch) | |
tree | 71801adbf35a8a449a76398a4a5d7c34066313b4 /arch/mips/gt64120/wrppmc/time.c | |
parent | a643d2b57403dc943fd4d9a3c803addd1c6b0ddc (diff) |
[MIPS] Wind River 4KC PPMC Eval Board Support
Support for the GT-64120-based Wind River 4KC PPMC Evaluation board.
Signed-off-by: Rongkai.Zhan <Rongkai.zhan@windriver.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/gt64120/wrppmc/time.c')
-rw-r--r-- | arch/mips/gt64120/wrppmc/time.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/arch/mips/gt64120/wrppmc/time.c b/arch/mips/gt64120/wrppmc/time.c new file mode 100644 index 000000000000..175d22adb450 --- /dev/null +++ b/arch/mips/gt64120/wrppmc/time.c | |||
@@ -0,0 +1,57 @@ | |||
1 | /* | ||
2 | * time.c: MIPS CPU Count/Compare timer hookup | ||
3 | * | ||
4 | * Author: Mark.Zhan, <rongkai.zhan@windriver.com> | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | * | ||
10 | * Copyright (C) 1996, 1997, 2004 by Ralf Baechle (ralf@linux-mips.org) | ||
11 | * Copyright (C) 2006, Wind River System Inc. | ||
12 | */ | ||
13 | #include <linux/config.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/string.h> | ||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/param.h> /* for HZ */ | ||
18 | #include <linux/irq.h> | ||
19 | #include <linux/timex.h> | ||
20 | #include <linux/interrupt.h> | ||
21 | |||
22 | #include <asm/reboot.h> | ||
23 | #include <asm/time.h> | ||
24 | #include <asm/io.h> | ||
25 | #include <asm/bootinfo.h> | ||
26 | #include <asm/gt64120.h> | ||
27 | |||
28 | #define WRPPMC_CPU_CLK_FREQ 40000000 /* 40MHZ */ | ||
29 | |||
30 | void __init wrppmc_timer_setup(struct irqaction *irq) | ||
31 | { | ||
32 | /* Install ISR for timer interrupt */ | ||
33 | setup_irq(WRPPMC_MIPS_TIMER_IRQ, irq); | ||
34 | |||
35 | /* to generate the first timer interrupt */ | ||
36 | write_c0_compare(mips_hpt_frequency/HZ); | ||
37 | write_c0_count(0); | ||
38 | } | ||
39 | |||
40 | /* | ||
41 | * Estimate CPU frequency. Sets mips_hpt_frequency as a side-effect | ||
42 | * | ||
43 | * NOTE: We disable all GT64120 timers, and use MIPS processor internal | ||
44 | * timer as the source of kernel clock tick. | ||
45 | */ | ||
46 | void __init wrppmc_time_init(void) | ||
47 | { | ||
48 | /* Disable GT64120 timers */ | ||
49 | GT_WRITE(GT_TC_CONTROL_OFS, 0x00); | ||
50 | GT_WRITE(GT_TC0_OFS, 0x00); | ||
51 | GT_WRITE(GT_TC1_OFS, 0x00); | ||
52 | GT_WRITE(GT_TC2_OFS, 0x00); | ||
53 | GT_WRITE(GT_TC3_OFS, 0x00); | ||
54 | |||
55 | /* Use MIPS compare/count internal timer */ | ||
56 | mips_hpt_frequency = WRPPMC_CPU_CLK_FREQ; | ||
57 | } | ||