From 0317e52e046f815b4ec4ac7876f63e4eb47696bd Mon Sep 17 00:00:00 2001 From: Ben Dooks Date: Thu, 20 May 2010 14:05:33 +0900 Subject: ARM: SAMSUNG: Add support for interrupt wakeup-sources Add support for wakeup-mask style interrupts that share a single mask register for various different interrupts. This registers a set of interrupt->bit mappings and the register they belong to. Signed-off-by: Ben Dooks --- arch/arm/plat-samsung/wakeup-mask.c | 47 +++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 arch/arm/plat-samsung/wakeup-mask.c (limited to 'arch/arm/plat-samsung/wakeup-mask.c') diff --git a/arch/arm/plat-samsung/wakeup-mask.c b/arch/arm/plat-samsung/wakeup-mask.c new file mode 100644 index 00000000000..2e09b6ad84c --- /dev/null +++ b/arch/arm/plat-samsung/wakeup-mask.c @@ -0,0 +1,47 @@ +/* arch/arm/plat-samsung/wakeup-mask.c + * + * Copyright 2010 Ben Dooks + * + * Support for wakeup mask interrupts on newer SoCs + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. +*/ + +#include +#include +#include +#include +#include +#include + +#include +#include + +void samsung_sync_wakemask(void __iomem *reg, + struct samsung_wakeup_mask *mask, int nr_mask) +{ + struct irq_desc *desc; + u32 val; + + val = __raw_readl(reg); + + for (; nr_mask > 0; nr_mask--, mask++) { + if (mask->irq == NO_WAKEUP_IRQ) { + val |= mask->bit; + continue; + } + + desc = irq_to_desc(mask->irq); + + /* bit of a liberty to read this directly from irq_desc. */ + if (desc->wake_depth > 0) + val &= ~mask->bit; + else + val |= mask->bit; + } + + printk(KERN_INFO "wakemask %08x => %08x\n", __raw_readl(reg), val); + __raw_writel(val, reg); +} -- cgit v1.2.3