66eb1ce7dfabcfcb5f7229d111f379f229f64ce1
[openwrt.git] / target / linux / adm5120 / files / arch / mips / adm5120 / time.c
1 /*
2  *  $Id$
3  *
4  *  ADM5120 specific hooks for MIPS CPU Counter/Compare timer
5  *
6  *  Copyright (C) 2007 OpenWrt.org
7  *  Copyright (C) 2007 Gabor Juhos <juhosg at openwrt.org>
8  *
9  *  This file was based on: arch/mips/gt64120/wrppmc/time.c
10  *      Original author: Mark.Zhan
11  *      Copyright (C) 1996, 1997, 2004 by Ralf Baechle
12  *      Copyright (C) 2006, Wind River System Inc.
13  *
14  *  This program is free software; you can redistribute it and/or modify it
15  *  under the terms of the GNU General Public License version 2 as published
16  *  by the Free Software Foundation.
17  *
18  */
19
20 #include <linux/types.h>
21 #include <linux/init.h>
22 #include <linux/interrupt.h>
23 #include <linux/timex.h>
24 #include <linux/version.h>
25
26 #include <asm/irq.h>
27 #include <asm/cpu.h>
28 #include <asm/time.h>
29
30 #include <adm5120_info.h>
31 #include <adm5120_irq.h>
32
33 void __init plat_time_init(void)
34 {
35         mips_hpt_frequency = adm5120_speed / 2;
36 }
37
38 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
39 void __init plat_timer_setup(struct irqaction *irq)
40 {
41         clear_c0_status(ST0_BEV);
42
43         /* Install ISR for CPU Counter interrupt */
44         setup_irq(ADM5120_IRQ_COUNTER, irq);
45 }
46 #endif