blob: dc814037297ba3dfa61d9a214bc4b1781ce9eaf7 [file] [log] [blame]
Ben Dooks0317e522010-05-20 14:05:33 +09001/* arch/arm/plat-samsung/wakeup-mask.c
2 *
3 * Copyright 2010 Ben Dooks <ben-linux@fluff.org>
4 *
5 * Support for wakeup mask interrupts on newer SoCs
6 *
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.
10*/
11
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>
18
19#include <plat/wakeup-mask.h>
20#include <plat/pm.h>
21
22void samsung_sync_wakemask(void __iomem *reg,
23 struct samsung_wakeup_mask *mask, int nr_mask)
24{
Thomas Gleixner7222f392011-03-24 12:36:46 +010025 struct irq_data *data;
Ben Dooks0317e522010-05-20 14:05:33 +090026 u32 val;
27
28 val = __raw_readl(reg);
29
30 for (; nr_mask > 0; nr_mask--, mask++) {
31 if (mask->irq == NO_WAKEUP_IRQ) {
32 val |= mask->bit;
33 continue;
34 }
35
Thomas Gleixner7222f392011-03-24 12:36:46 +010036 data = irq_get_irq_data(mask->irq);
Ben Dooks0317e522010-05-20 14:05:33 +090037
Thomas Gleixner7222f392011-03-24 12:36:46 +010038 /* bit of a liberty to read this directly from irq_data. */
39 if (irqd_is_wakeup_set(data))
Ben Dooks0317e522010-05-20 14:05:33 +090040 val &= ~mask->bit;
41 else
42 val |= mask->bit;
43 }
44
45 printk(KERN_INFO "wakemask %08x => %08x\n", __raw_readl(reg), val);
46 __raw_writel(val, reg);
47}