diff options
Diffstat (limited to 'arch/mips/mips-boards/generic/time.c')
-rw-r--r-- | arch/mips/mips-boards/generic/time.c | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/arch/mips/mips-boards/generic/time.c b/arch/mips/mips-boards/generic/time.c index b50e0fc406ac..4fe62fca994e 100644 --- a/arch/mips/mips-boards/generic/time.c +++ b/arch/mips/mips-boards/generic/time.c | |||
@@ -55,16 +55,36 @@ | |||
55 | unsigned long cpu_khz; | 55 | unsigned long cpu_khz; |
56 | 56 | ||
57 | static int mips_cpu_timer_irq; | 57 | static int mips_cpu_timer_irq; |
58 | static int mips_cpu_perf_irq; | ||
58 | extern int cp0_perfcount_irq; | 59 | extern int cp0_perfcount_irq; |
59 | 60 | ||
61 | DEFINE_PER_CPU(unsigned int, tickcount); | ||
62 | #define tickcount_this_cpu __get_cpu_var(tickcount) | ||
63 | static unsigned long ledbitmask; | ||
64 | |||
60 | static void mips_timer_dispatch(void) | 65 | static void mips_timer_dispatch(void) |
61 | { | 66 | { |
67 | #if defined(CONFIG_MIPS_MALTA) || defined(CONFIG_MIPS_ATLAS) | ||
68 | /* | ||
69 | * Yes, this is very tacky, won't work as expected with SMTC and | ||
70 | * dyntick will break it, | ||
71 | * but it gives me a nice warm feeling during debug | ||
72 | */ | ||
73 | #define LEDBAR 0xbf000408 | ||
74 | if (tickcount_this_cpu++ >= HZ) { | ||
75 | tickcount_this_cpu = 0; | ||
76 | change_bit(smp_processor_id(), &ledbitmask); | ||
77 | smp_wmb(); /* Make sure every one else sees the change */ | ||
78 | /* This will pick up any recent changes made by other CPU's */ | ||
79 | *(unsigned int *)LEDBAR = ledbitmask; | ||
80 | } | ||
81 | #endif | ||
62 | do_IRQ(mips_cpu_timer_irq); | 82 | do_IRQ(mips_cpu_timer_irq); |
63 | } | 83 | } |
64 | 84 | ||
65 | static void mips_perf_dispatch(void) | 85 | static void mips_perf_dispatch(void) |
66 | { | 86 | { |
67 | do_IRQ(cp0_perfcount_irq); | 87 | do_IRQ(mips_cpu_perf_irq); |
68 | } | 88 | } |
69 | 89 | ||
70 | /* | 90 | /* |
@@ -129,19 +149,18 @@ unsigned long read_persistent_clock(void) | |||
129 | 149 | ||
130 | void __init plat_perf_setup(void) | 150 | void __init plat_perf_setup(void) |
131 | { | 151 | { |
132 | cp0_perfcount_irq = -1; | ||
133 | |||
134 | #ifdef MSC01E_INT_BASE | 152 | #ifdef MSC01E_INT_BASE |
135 | if (cpu_has_veic) { | 153 | if (cpu_has_veic) { |
136 | set_vi_handler(MSC01E_INT_PERFCTR, mips_perf_dispatch); | 154 | set_vi_handler(MSC01E_INT_PERFCTR, mips_perf_dispatch); |
137 | cp0_perfcount_irq = MSC01E_INT_BASE + MSC01E_INT_PERFCTR; | 155 | mips_cpu_perf_irq = MSC01E_INT_BASE + MSC01E_INT_PERFCTR; |
138 | } else | 156 | } else |
139 | #endif | 157 | #endif |
140 | if (cp0_perfcount_irq >= 0) { | 158 | if (cp0_perfcount_irq >= 0) { |
141 | if (cpu_has_vint) | 159 | if (cpu_has_vint) |
142 | set_vi_handler(cp0_perfcount_irq, mips_perf_dispatch); | 160 | set_vi_handler(cp0_perfcount_irq, mips_perf_dispatch); |
161 | mips_cpu_perf_irq = MIPS_CPU_IRQ_BASE + cp0_perfcount_irq; | ||
143 | #ifdef CONFIG_SMP | 162 | #ifdef CONFIG_SMP |
144 | set_irq_handler(cp0_perfcount_irq, handle_percpu_irq); | 163 | set_irq_handler(mips_cpu_perf_irq, handle_percpu_irq); |
145 | #endif | 164 | #endif |
146 | } | 165 | } |
147 | } | 166 | } |