irq.c 1.4 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
/*
 * arch/arm/plat-orion/irq.c
 *
 * Marvell Orion SoC IRQ handling.
 *
 * This file is licensed under the terms of the GNU General Public
 * License version 2.  This program is licensed "as is" without any
 * warranty of any kind, whether express or implied.
 */

#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/irq.h>
#include <linux/io.h>
15
#include <plat/irq.h>
16

17
static void orion_irq_mask(struct irq_data *d)
18
{
19
	void __iomem *maskaddr = irq_data_get_irq_chip_data(d);
20 21 22
	u32 mask;

	mask = readl(maskaddr);
23
	mask &= ~(1 << (d->irq & 31));
24 25 26
	writel(mask, maskaddr);
}

27
static void orion_irq_unmask(struct irq_data *d)
28
{
29
	void __iomem *maskaddr = irq_data_get_irq_chip_data(d);
30 31 32
	u32 mask;

	mask = readl(maskaddr);
33
	mask |= 1 << (d->irq & 31);
34 35 36 37 38
	writel(mask, maskaddr);
}

static struct irq_chip orion_irq_chip = {
	.name		= "orion_irq",
39 40 41
	.irq_mask	= orion_irq_mask,
	.irq_mask_ack	= orion_irq_mask,
	.irq_unmask	= orion_irq_unmask,
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
};

void __init orion_irq_init(unsigned int irq_start, void __iomem *maskaddr)
{
	unsigned int i;

	/*
	 * Mask all interrupts initially.
	 */
	writel(0, maskaddr);

	/*
	 * Register IRQ sources.
	 */
	for (i = 0; i < 32; i++) {
		unsigned int irq = irq_start + i;

T
Thomas Gleixner 已提交
59 60 61
		irq_set_chip(irq, &orion_irq_chip);
		irq_set_chip_data(irq, maskaddr);
		irq_set_handler(irq, handle_level_irq);
T
Thomas Gleixner 已提交
62
		irq_set_status_flags(irq, IRQ_LEVEL);
63 64 65
		set_irq_flags(irq, IRQF_VALID);
	}
}