aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/mti-sead3/sead3-time.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/mti-sead3/sead3-time.c')
-rw-r--r--arch/mips/mti-sead3/sead3-time.c35
1 files changed, 10 insertions, 25 deletions
diff --git a/arch/mips/mti-sead3/sead3-time.c b/arch/mips/mti-sead3/sead3-time.c
index 678d03d53c60..ec1dd2491f96 100644
--- a/arch/mips/mti-sead3/sead3-time.c
+++ b/arch/mips/mti-sead3/sead3-time.c
@@ -6,6 +6,7 @@
6 * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved. 6 * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.
7 */ 7 */
8#include <linux/init.h> 8#include <linux/init.h>
9#include <linux/irqchip/mips-gic.h>
9 10
10#include <asm/cpu.h> 11#include <asm/cpu.h>
11#include <asm/setup.h> 12#include <asm/setup.h>
@@ -13,19 +14,6 @@
13#include <asm/irq.h> 14#include <asm/irq.h>
14#include <asm/mips-boards/generic.h> 15#include <asm/mips-boards/generic.h>
15 16
16static int mips_cpu_timer_irq;
17static int mips_cpu_perf_irq;
18
19static void mips_timer_dispatch(void)
20{
21 do_IRQ(mips_cpu_timer_irq);
22}
23
24static void mips_perf_dispatch(void)
25{
26 do_IRQ(mips_cpu_perf_irq);
27}
28
29static void __iomem *status_reg = (void __iomem *)0xbf000410; 17static void __iomem *status_reg = (void __iomem *)0xbf000410;
30 18
31/* 19/*
@@ -81,21 +69,20 @@ void read_persistent_clock(struct timespec *ts)
81 ts->tv_nsec = 0; 69 ts->tv_nsec = 0;
82} 70}
83 71
84static void __init plat_perf_setup(void) 72int get_c0_perfcount_int(void)
85{ 73{
86 if (cp0_perfcount_irq >= 0) { 74 if (gic_present)
87 if (cpu_has_vint) 75 return gic_get_c0_compare_int();
88 set_vi_handler(cp0_perfcount_irq, mips_perf_dispatch); 76 if (cp0_perfcount_irq >= 0)
89 mips_cpu_perf_irq = MIPS_CPU_IRQ_BASE + cp0_perfcount_irq; 77 return MIPS_CPU_IRQ_BASE + cp0_perfcount_irq;
90 } 78 return -1;
91} 79}
92 80
93unsigned int get_c0_compare_int(void) 81unsigned int get_c0_compare_int(void)
94{ 82{
95 if (cpu_has_vint) 83 if (gic_present)
96 set_vi_handler(cp0_compare_irq, mips_timer_dispatch); 84 return gic_get_c0_compare_int();
97 mips_cpu_timer_irq = MIPS_CPU_IRQ_BASE + cp0_compare_irq; 85 return MIPS_CPU_IRQ_BASE + cp0_compare_irq;
98 return mips_cpu_timer_irq;
99} 86}
100 87
101void __init plat_time_init(void) 88void __init plat_time_init(void)
@@ -108,6 +95,4 @@ void __init plat_time_init(void)
108 (est_freq % 1000000) * 100 / 1000000); 95 (est_freq % 1000000) * 100 / 1000000);
109 96
110 mips_scroll_message(); 97 mips_scroll_message();
111
112 plat_perf_setup();
113} 98}