···8383void (*board_init_irq)(void);84848585#ifdef CONFIG_PM8686-extern void counter0_irq(int irq, void *dev_id, struct pt_regs *regs);8686+extern irqreturn_t counter0_irq(int irq, void *dev_id, struct pt_regs *regs);8787#endif88888989static DEFINE_SPINLOCK(irq_lock);···293293};294294295295#ifdef CONFIG_PM296296-void startup_match20_interrupt(void (*handler)(int, void *, struct pt_regs *))296296+void startup_match20_interrupt(irqreturn_t (*handler)(int, void *, struct pt_regs *))297297{298298+ struct irq_desc *desc = &irq_desc[AU1000_TOY_MATCH2_INT];299299+298300 static struct irqaction action;301301+ memset(&action, 0, sizeof(struct irqaction));302302+299303 /* This is a big problem.... since we didn't use request_irq300300- when kernel/irq.c calls probe_irq_xxx this interrupt will301301- be probed for usage. This will end up disabling the device :(302302-303303- Give it a bogus "action" pointer -- this will keep it from304304- getting auto-probed!305305-306306- By setting the status to match that of request_irq() we307307- can avoid it. --cgray304304+ * when kernel/irq.c calls probe_irq_xxx this interrupt will305305+ * be probed for usage. This will end up disabling the device :(306306+ * Give it a bogus "action" pointer -- this will keep it from307307+ * getting auto-probed!308308+ *309309+ * By setting the status to match that of request_irq() we310310+ * can avoid it. --cgray308311 */309312 action.dev_id = handler;310310- action.flags = 0;311311- action.mask = 0;313313+ action.flags = SA_INTERRUPT;314314+ cpus_clear(action.mask);312315 action.name = "Au1xxx TOY";313316 action.handler = handler;314317 action.next = NULL;315318316316- irq_desc[AU1000_TOY_MATCH2_INT].action = &action; 317317- irq_desc[AU1000_TOY_MATCH2_INT].status 318318- &= ~(IRQ_DISABLED | IRQ_AUTODETECT | IRQ_WAITING | IRQ_INPROGRESS);319319+ desc->action = &action;320320+ desc->status &= ~(IRQ_DISABLED | IRQ_AUTODETECT | IRQ_WAITING | IRQ_INPROGRESS);319321320322 local_enable_irq(AU1000_TOY_MATCH2_INT);321323}
+9-7
arch/mips/au1000/common/power.c
···3434#include <linux/pm.h>3535#include <linux/slab.h>3636#include <linux/sysctl.h>3737+#include <linux/jiffies.h>37383839#include <asm/string.h>3940#include <asm/uaccess.h>4041#include <asm/io.h>4142#include <asm/system.h>4343+#include <asm/cacheflush.h>4244#include <asm/mach-au1x00/au1000.h>43454446#ifdef CONFIG_PM···5250# define DPRINTK(fmt, args...)5351#endif54525555-static void calibrate_delay(void);5353+static void au1000_calibrate_delay(void);56545755extern void set_au1x00_speed(unsigned int new_freq);5856extern unsigned int get_au1x00_speed(void);···262260}263261264262static int pm_do_sleep(ctl_table * ctl, int write, struct file *file,265265- void *buffer, size_t * len)263263+ void __user *buffer, size_t * len, loff_t *ppos)266264{267265 int retval = 0;268266#ifdef SLEEP_TEST_TIMEOUT···296294}297295298296static int pm_do_suspend(ctl_table * ctl, int write, struct file *file,299299- void *buffer, size_t * len)297297+ void __user *buffer, size_t * len, loff_t *ppos)300298{301299 int retval = 0;302300···315313316314317315static int pm_do_freq(ctl_table * ctl, int write, struct file *file,318318- void *buffer, size_t * len)316316+ void __user *buffer, size_t * len, loff_t *ppos)319317{320318 int retval = 0, i;321319 unsigned long val, pll;···410408411409412410 /* We don't want _any_ interrupts other than413413- * match20. Otherwise our calibrate_delay()411411+ * match20. Otherwise our au1000_calibrate_delay()414412 * calculation will be off, potentially a lot.415413 */416414 intc0_mask = save_local_and_disable(0);417415 intc1_mask = save_local_and_disable(1);418416 local_enable_irq(AU1000_TOY_MATCH2_INT);419417 spin_unlock_irqrestore(&pm_lock, flags);420420- calibrate_delay();418418+ au1000_calibrate_delay();421419 restore_local_and_enable(0, intc0_mask);422420 restore_local_and_enable(1, intc1_mask);423421 return retval;···457455 better than 1% */458456#define LPS_PREC 8459457460460-static void calibrate_delay(void)458458+static void au1000_calibrate_delay(void)461459{462460 unsigned long ticks, loopbit;463461 int lps_precision = LPS_PREC;
+11-7
arch/mips/au1000/common/time.c
···6363static unsigned int timerhi = 0, timerlo = 0;64646565#ifdef CONFIG_PM6666-#define MATCH20_INC 3286767-extern void startup_match20_interrupt(void (*handler)(int, void *, struct pt_regs *));6666+#if HZ < 100 || HZ > 10006767+#error "unsupported HZ value! Must be in [100,1000]"6868+#endif6969+#define MATCH20_INC (328*100/HZ) /* magic number 328 is for HZ=100... */7070+extern void startup_match20_interrupt(irqreturn_t (*handler)(int, void *, struct pt_regs *));6871static unsigned long last_pc0, last_match20;6972#endif7073···119116}120117121118#ifdef CONFIG_PM122122-void counter0_irq(int irq, void *dev_id, struct pt_regs *regs)119119+irqreturn_t counter0_irq(int irq, void *dev_id, struct pt_regs *regs)123120{124121 unsigned long pc0;125122 int time_elapsed;126123 static int jiffie_drift = 0;127124128128- kstat.irqs[0][irq]++;129125 if (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20) {130126 /* should never happen! */131131- printk(KERN_WARNING "counter 0 w status eror\n");132132- return;127127+ printk(KERN_WARNING "counter 0 w status error\n");128128+ return IRQ_NONE;133129 }134130135131 pc0 = au_readl(SYS_TOYREAD);···165163 update_process_times(user_mode(regs));166164#endif167165 }166166+167167+ return IRQ_HANDLED;168168}169169170170/* When we wakeup from sleep, we have to "catch up" on all of the···443439 au_sync();444440 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M20);445441446446- /* setup match20 to interrupt once every 10ms */442442+ /* setup match20 to interrupt once every HZ */447443 last_pc0 = last_match20 = au_readl(SYS_TOYREAD);448444 au_writel(last_match20 + MATCH20_INC, SYS_TOYMATCH2);449445 au_sync();