aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2007-10-28 19:02:37 -0400
committerRalf Baechle <ralf@linux-mips.org>2007-10-29 15:35:35 -0400
commit725d7b36c3287217e14cea6fec6c0b897f500a10 (patch)
treed3c0cac39d4529095f9b98064ed631a2c924917d
parent84953b39f9b57f89f87b5974c599b8111658f0b6 (diff)
[MIPS] IP27: Fix slice logic to work for arbitrary number of slices.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r--arch/mips/sgi-ip27/ip27-timer.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/arch/mips/sgi-ip27/ip27-timer.c b/arch/mips/sgi-ip27/ip27-timer.c
index f5dccf01da11..dc59c3b708ed 100644
--- a/arch/mips/sgi-ip27/ip27-timer.c
+++ b/arch/mips/sgi-ip27/ip27-timer.c
@@ -131,12 +131,12 @@ static struct irq_chip rt_irq_type = {
131static int rt_next_event(unsigned long delta, struct clock_event_device *evt) 131static int rt_next_event(unsigned long delta, struct clock_event_device *evt)
132{ 132{
133 unsigned int cpu = smp_processor_id(); 133 unsigned int cpu = smp_processor_id();
134 int slice = cputoslice(cpu) == 0; 134 int slice putoslice(cpu);
135 unsigned long cnt; 135 unsigned long cnt;
136 136
137 cnt = LOCAL_HUB_L(PI_RT_COUNT); 137 cnt = LOCAL_HUB_L(PI_RT_COUNT);
138 cnt += delta; 138 cnt += delta;
139 LOCAL_HUB_S(slice ? PI_RT_COMPARE_A : PI_RT_COMPARE_B, cnt); 139 LOCAL_HUB_S(PI_RT_COMPARE_A + PI_COUNT_OFFSET * slice, cnt);
140 140
141 return LOCAL_HUB_L(PI_RT_COUNT) >= cnt ? -ETIME : 0; 141 return LOCAL_HUB_L(PI_RT_COUNT) >= cnt ? -ETIME : 0;
142} 142}
@@ -164,9 +164,12 @@ static irqreturn_t hub_rt_counter_handler(int irq, void *dev_id)
164{ 164{
165 struct clock_event_device *cd = dev_id; 165 struct clock_event_device *cd = dev_id;
166 unsigned int cpu = smp_processor_id(); 166 unsigned int cpu = smp_processor_id();
167 int slice = cputoslice(cpu) == 0; 167 int slice = cputoslice(cpu);
168 168
169 LOCAL_HUB_S(slice ? PI_RT_PEND_A : PI_RT_PEND_B, 0); /* Ack */ 169 /*
170 * Ack
171 */
172 LOCAL_HUB_S(PI_RT_PEND_A + PI_COUNT_OFFSET * slice, cnt);
170 cd->event_handler(cd); 173 cd->event_handler(cd);
171 174
172 return IRQ_HANDLED; 175 return IRQ_HANDLED;