2017-12-25 19:54:35 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
//
|
|
|
|
// Copyright 2010 Ben Dooks <ben-linux@fluff.org>
|
|
|
|
//
|
|
|
|
// Support for wakeup mask interrupts on newer SoCs
|
2010-05-20 05:05:33 +00:00
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/spinlock.h>
|
2011-12-22 00:26:03 +00:00
|
|
|
#include <linux/device.h>
|
2010-05-20 05:05:33 +00:00
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/irq.h>
|
|
|
|
#include <linux/io.h>
|
|
|
|
|
2019-09-02 16:37:30 +00:00
|
|
|
#include "wakeup-mask.h"
|
|
|
|
#include "pm.h"
|
2010-05-20 05:05:33 +00:00
|
|
|
|
|
|
|
void samsung_sync_wakemask(void __iomem *reg,
|
2016-12-10 13:47:36 +00:00
|
|
|
const struct samsung_wakeup_mask *mask, int nr_mask)
|
2010-05-20 05:05:33 +00:00
|
|
|
{
|
2011-03-24 11:36:46 +00:00
|
|
|
struct irq_data *data;
|
2010-05-20 05:05:33 +00:00
|
|
|
u32 val;
|
|
|
|
|
|
|
|
val = __raw_readl(reg);
|
|
|
|
|
|
|
|
for (; nr_mask > 0; nr_mask--, mask++) {
|
|
|
|
if (mask->irq == NO_WAKEUP_IRQ) {
|
|
|
|
val |= mask->bit;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2011-03-24 11:36:46 +00:00
|
|
|
data = irq_get_irq_data(mask->irq);
|
2010-05-20 05:05:33 +00:00
|
|
|
|
2011-03-24 11:36:46 +00:00
|
|
|
/* bit of a liberty to read this directly from irq_data. */
|
|
|
|
if (irqd_is_wakeup_set(data))
|
2010-05-20 05:05:33 +00:00
|
|
|
val &= ~mask->bit;
|
|
|
|
else
|
|
|
|
val |= mask->bit;
|
|
|
|
}
|
|
|
|
|
|
|
|
printk(KERN_INFO "wakemask %08x => %08x\n", __raw_readl(reg), val);
|
|
|
|
__raw_writel(val, reg);
|
|
|
|
}
|