Merge branch 'urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/rric/oprofile...
[linux-2.6.git] / arch / arm / plat-samsung / wakeup-mask.c
blob2e09b6ad84ca4af1e9f0caaa55556e4ce86af919
1 /* arch/arm/plat-samsung/wakeup-mask.c
3 * Copyright 2010 Ben Dooks <ben-linux@fluff.org>
5 * Support for wakeup mask interrupts on newer SoCs
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
12 #include <linux/kernel.h>
13 #include <linux/spinlock.h>
14 #include <linux/sysdev.h>
15 #include <linux/types.h>
16 #include <linux/irq.h>
17 #include <linux/io.h>
19 #include <plat/wakeup-mask.h>
20 #include <plat/pm.h>
22 void samsung_sync_wakemask(void __iomem *reg,
23 struct samsung_wakeup_mask *mask, int nr_mask)
25 struct irq_desc *desc;
26 u32 val;
28 val = __raw_readl(reg);
30 for (; nr_mask > 0; nr_mask--, mask++) {
31 if (mask->irq == NO_WAKEUP_IRQ) {
32 val |= mask->bit;
33 continue;
36 desc = irq_to_desc(mask->irq);
38 /* bit of a liberty to read this directly from irq_desc. */
39 if (desc->wake_depth > 0)
40 val &= ~mask->bit;
41 else
42 val |= mask->bit;
45 printk(KERN_INFO "wakemask %08x => %08x\n", __raw_readl(reg), val);
46 __raw_writel(val, reg);