aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/au1000/common/time.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/au1000/common/time.c')
-rw-r--r--arch/mips/au1000/common/time.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/arch/mips/au1000/common/time.c b/arch/mips/au1000/common/time.c
index 2f81a0c00442..883d3f3d8c53 100644
--- a/arch/mips/au1000/common/time.c
+++ b/arch/mips/au1000/common/time.c
@@ -63,8 +63,11 @@ extern int allow_au1k_wait; /* default off for CP0 Counter */
63static unsigned int timerhi = 0, timerlo = 0; 63static unsigned int timerhi = 0, timerlo = 0;
64 64
65#ifdef CONFIG_PM 65#ifdef CONFIG_PM
66#define MATCH20_INC 328 66#if HZ < 100 || HZ > 1000
67extern void startup_match20_interrupt(void (*handler)(int, void *, struct pt_regs *)); 67#error "unsupported HZ value! Must be in [100,1000]"
68#endif
69#define MATCH20_INC (328*100/HZ) /* magic number 328 is for HZ=100... */
70extern void startup_match20_interrupt(irqreturn_t (*handler)(int, void *, struct pt_regs *));
68static unsigned long last_pc0, last_match20; 71static unsigned long last_pc0, last_match20;
69#endif 72#endif
70 73
@@ -116,17 +119,16 @@ null:
116} 119}
117 120
118#ifdef CONFIG_PM 121#ifdef CONFIG_PM
119void counter0_irq(int irq, void *dev_id, struct pt_regs *regs) 122irqreturn_t counter0_irq(int irq, void *dev_id, struct pt_regs *regs)
120{ 123{
121 unsigned long pc0; 124 unsigned long pc0;
122 int time_elapsed; 125 int time_elapsed;
123 static int jiffie_drift = 0; 126 static int jiffie_drift = 0;
124 127
125 kstat.irqs[0][irq]++;
126 if (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20) { 128 if (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20) {
127 /* should never happen! */ 129 /* should never happen! */
128 printk(KERN_WARNING "counter 0 w status eror\n"); 130 printk(KERN_WARNING "counter 0 w status error\n");
129 return; 131 return IRQ_NONE;
130 } 132 }
131 133
132 pc0 = au_readl(SYS_TOYREAD); 134 pc0 = au_readl(SYS_TOYREAD);
@@ -163,6 +165,8 @@ void counter0_irq(int irq, void *dev_id, struct pt_regs *regs)
163 update_process_times(user_mode(regs)); 165 update_process_times(user_mode(regs));
164#endif 166#endif
165 } 167 }
168
169 return IRQ_HANDLED;
166} 170}
167 171
168/* When we wakeup from sleep, we have to "catch up" on all of the 172/* When we wakeup from sleep, we have to "catch up" on all of the
@@ -439,7 +443,7 @@ void au1xxx_timer_setup(struct irqaction *irq)
439 au_sync(); 443 au_sync();
440 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20); 444 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20);
441 445
442 /* setup match20 to interrupt once every 10ms */ 446 /* setup match20 to interrupt once every HZ */
443 last_pc0 = last_match20 = au_readl(SYS_TOYREAD); 447 last_pc0 = last_match20 = au_readl(SYS_TOYREAD);
444 au_writel(last_match20 + MATCH20_INC, SYS_TOYMATCH2); 448 au_writel(last_match20 + MATCH20_INC, SYS_TOYMATCH2);
445 au_sync(); 449 au_sync();