-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ARM: integrator/versatile: consolidate FPGA IRQ handling code
Consolidate the FPGA IRQ handling code. Integrator/AP and Versatile have one FPGA-based IRQ handler each. Integrator/CP has three. Acked-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
- Loading branch information
Russell King
committed
Feb 19, 2011
1 parent
dc37c31
commit c41b16f
Showing
9 changed files
with
140 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
obj-y := clock.o | ||
obj-$(CONFIG_PLAT_VERSATILE_CLCD) += clcd.o | ||
obj-$(CONFIG_PLAT_VERSATILE_FPGA_IRQ) += fpga-irq.o | ||
obj-$(CONFIG_PLAT_VERSATILE_LEDS) += leds.o | ||
obj-$(CONFIG_PLAT_VERSATILE_SCHED_CLOCK) += sched-clock.o | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* Support for Versatile FPGA-based IRQ controllers | ||
*/ | ||
#include <linux/irq.h> | ||
#include <linux/io.h> | ||
|
||
#include <asm/mach/irq.h> | ||
#include <plat/fpga-irq.h> | ||
|
||
#define IRQ_STATUS 0x00 | ||
#define IRQ_RAW_STATUS 0x04 | ||
#define IRQ_ENABLE_SET 0x08 | ||
#define IRQ_ENABLE_CLEAR 0x0c | ||
|
||
static void fpga_irq_mask(struct irq_data *d) | ||
{ | ||
struct fpga_irq_data *f = irq_data_get_irq_chip_data(d); | ||
u32 mask = 1 << (d->irq - f->irq_start); | ||
|
||
writel(mask, f->base + IRQ_ENABLE_CLEAR); | ||
} | ||
|
||
static void fpga_irq_unmask(struct irq_data *d) | ||
{ | ||
struct fpga_irq_data *f = irq_data_get_irq_chip_data(d); | ||
u32 mask = 1 << (d->irq - f->irq_start); | ||
|
||
writel(mask, f->base + IRQ_ENABLE_SET); | ||
} | ||
|
||
static void fpga_irq_handle(unsigned int irq, struct irq_desc *desc) | ||
{ | ||
struct fpga_irq_data *f = get_irq_desc_data(desc); | ||
u32 status = readl(f->base + IRQ_STATUS); | ||
|
||
if (status == 0) { | ||
do_bad_IRQ(irq, desc); | ||
return; | ||
} | ||
|
||
do { | ||
irq = ffs(status) - 1; | ||
status &= ~(1 << irq); | ||
|
||
generic_handle_irq(irq + f->irq_start); | ||
} while (status); | ||
} | ||
|
||
void __init fpga_irq_init(int parent_irq, u32 valid, struct fpga_irq_data *f) | ||
{ | ||
unsigned int i; | ||
|
||
f->chip.irq_ack = fpga_irq_mask; | ||
f->chip.irq_mask = fpga_irq_mask; | ||
f->chip.irq_unmask = fpga_irq_unmask; | ||
|
||
if (parent_irq != -1) { | ||
set_irq_data(parent_irq, f); | ||
set_irq_chained_handler(parent_irq, fpga_irq_handle); | ||
} | ||
|
||
for (i = 0; i < 32; i++) { | ||
if (valid & (1 << i)) { | ||
unsigned int irq = f->irq_start + i; | ||
|
||
set_irq_chip_data(irq, f); | ||
set_irq_chip(irq, &f->chip); | ||
set_irq_handler(irq, handle_level_irq); | ||
set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#ifndef PLAT_FPGA_IRQ_H | ||
#define PLAT_FPGA_IRQ_H | ||
|
||
struct fpga_irq_data { | ||
void __iomem *base; | ||
unsigned int irq_start; | ||
struct irq_chip chip; | ||
}; | ||
|
||
void fpga_irq_init(int, u32, struct fpga_irq_data *); | ||
|
||
#endif |