2008-03-28 02:51:40 +08:00
|
|
|
/*
|
|
|
|
* 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>
|
2008-08-09 19:44:58 +08:00
|
|
|
#include <plat/irq.h>
|
2008-03-28 02:51:40 +08:00
|
|
|
|
2010-11-29 18:17:38 +08:00
|
|
|
static void orion_irq_mask(struct irq_data *d)
|
2008-03-28 02:51:40 +08:00
|
|
|
{
|
2010-11-29 18:17:38 +08:00
|
|
|
void __iomem *maskaddr = irq_data_get_irq_chip_data(d);
|
2008-03-28 02:51:40 +08:00
|
|
|
u32 mask;
|
|
|
|
|
|
|
|
mask = readl(maskaddr);
|
2010-11-29 18:17:38 +08:00
|
|
|
mask &= ~(1 << (d->irq & 31));
|
2008-03-28 02:51:40 +08:00
|
|
|
writel(mask, maskaddr);
|
|
|
|
}
|
|
|
|
|
2010-11-29 18:17:38 +08:00
|
|
|
static void orion_irq_unmask(struct irq_data *d)
|
2008-03-28 02:51:40 +08:00
|
|
|
{
|
2010-11-29 18:17:38 +08:00
|
|
|
void __iomem *maskaddr = irq_data_get_irq_chip_data(d);
|
2008-03-28 02:51:40 +08:00
|
|
|
u32 mask;
|
|
|
|
|
|
|
|
mask = readl(maskaddr);
|
2010-11-29 18:17:38 +08:00
|
|
|
mask |= 1 << (d->irq & 31);
|
2008-03-28 02:51:40 +08:00
|
|
|
writel(mask, maskaddr);
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct irq_chip orion_irq_chip = {
|
|
|
|
.name = "orion_irq",
|
2010-11-29 18:17:38 +08:00
|
|
|
.irq_mask = orion_irq_mask,
|
|
|
|
.irq_mask_ack = orion_irq_mask,
|
|
|
|
.irq_unmask = orion_irq_unmask,
|
2008-03-28 02:51:40 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
2011-03-24 20:35:09 +08:00
|
|
|
irq_set_chip_and_handler(irq, &orion_irq_chip,
|
|
|
|
handle_level_irq);
|
2011-03-24 20:29:39 +08:00
|
|
|
irq_set_chip_data(irq, maskaddr);
|
2011-03-24 19:35:19 +08:00
|
|
|
irq_set_status_flags(irq, IRQ_LEVEL);
|
2008-03-28 02:51:40 +08:00
|
|
|
set_irq_flags(irq, IRQF_VALID);
|
|
|
|
}
|
|
|
|
}
|