d1bef4ed5f
This patch-queue improves the generic IRQ layer to be truly generic, by adding various abstractions and features to it, without impacting existing functionality. While the queue can be best described as "fix and improve everything in the generic IRQ layer that we could think of", and thus it consists of many smaller features and lots of cleanups, the one feature that stands out most is the new 'irq chip' abstraction. The irq-chip abstraction is about describing and coding and IRQ controller driver by mapping its raw hardware capabilities [and quirks, if needed] in a straightforward way, without having to think about "IRQ flow" (level/edge/etc.) type of details. This stands in contrast with the current 'irq-type' model of genirq architectures, which 'mixes' raw hardware capabilities with 'flow' details. The patchset supports both types of irq controller designs at once, and converts i386 and x86_64 to the new irq-chip design. As a bonus side-effect of the irq-chip approach, chained interrupt controllers (master/slave PIC constructs, etc.) are now supported by design as well. The end result of this patchset intends to be simpler architecture-level code and more consolidation between architectures. We reused many bits of code and many concepts from Russell King's ARM IRQ layer, the merging of which was one of the motivations for this patchset. This patch: rename desc->handler to desc->chip. Originally i did not want to do this, because it's a big patch. But having both "desc->handler", "desc->handle_irq" and "action->handler" caused a large degree of confusion and made the code appear alot less clean than it truly is. I have also attempted a dual approach as well by introducing a desc->chip alias - but that just wasnt robust enough and broke frequently. So lets get over with this quickly. The conversion was done automatically via scripts and converts all the code in the kernel. This renaming patch is the first one amongst the patches, so that the remaining patches can stay flexible and can be merged and split up without having some big monolithic patch act as a merge barrier. [akpm@osdl.org: build fix] [akpm@osdl.org: another build fix] Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
136 lines
2.9 KiB
C
136 lines
2.9 KiB
C
/*
|
|
* linux/arch/sh/boards/renesas/rts7751r2d/irq.c
|
|
*
|
|
* Copyright (C) 2000 Kazumoto Kojima
|
|
*
|
|
* Renesas Technology Sales RTS7751R2D Support.
|
|
*
|
|
* Modified for RTS7751R2D by
|
|
* Atom Create Engineering Co., Ltd. 2002.
|
|
*/
|
|
|
|
#include <linux/config.h>
|
|
#include <linux/init.h>
|
|
#include <linux/irq.h>
|
|
#include <asm/io.h>
|
|
#include <asm/irq.h>
|
|
#include <asm/rts7751r2d/rts7751r2d.h>
|
|
|
|
#if defined(CONFIG_RTS7751R2D_REV11)
|
|
static int mask_pos[] = {11, 9, 8, 12, 10, 6, 5, 4, 7, 14, 13, 0, 0, 0, 0};
|
|
#else
|
|
static int mask_pos[] = {6, 11, 9, 8, 12, 10, 5, 4, 7, 14, 13, 0, 0, 0, 0};
|
|
#endif
|
|
|
|
extern int voyagergx_irq_demux(int irq);
|
|
extern void setup_voyagergx_irq(void);
|
|
|
|
static void enable_rts7751r2d_irq(unsigned int irq);
|
|
static void disable_rts7751r2d_irq(unsigned int irq);
|
|
|
|
/* shutdown is same as "disable" */
|
|
#define shutdown_rts7751r2d_irq disable_rts7751r2d_irq
|
|
|
|
static void ack_rts7751r2d_irq(unsigned int irq);
|
|
static void end_rts7751r2d_irq(unsigned int irq);
|
|
|
|
static unsigned int startup_rts7751r2d_irq(unsigned int irq)
|
|
{
|
|
enable_rts7751r2d_irq(irq);
|
|
return 0; /* never anything pending */
|
|
}
|
|
|
|
static void disable_rts7751r2d_irq(unsigned int irq)
|
|
{
|
|
unsigned long flags;
|
|
unsigned short val;
|
|
unsigned short mask = 0xffff ^ (0x0001 << mask_pos[irq]);
|
|
|
|
/* Set the priority in IPR to 0 */
|
|
local_irq_save(flags);
|
|
val = ctrl_inw(IRLCNTR1);
|
|
val &= mask;
|
|
ctrl_outw(val, IRLCNTR1);
|
|
local_irq_restore(flags);
|
|
}
|
|
|
|
static void enable_rts7751r2d_irq(unsigned int irq)
|
|
{
|
|
unsigned long flags;
|
|
unsigned short val;
|
|
unsigned short value = (0x0001 << mask_pos[irq]);
|
|
|
|
/* Set priority in IPR back to original value */
|
|
local_irq_save(flags);
|
|
val = ctrl_inw(IRLCNTR1);
|
|
val |= value;
|
|
ctrl_outw(val, IRLCNTR1);
|
|
local_irq_restore(flags);
|
|
}
|
|
|
|
int rts7751r2d_irq_demux(int irq)
|
|
{
|
|
int demux_irq;
|
|
|
|
demux_irq = voyagergx_irq_demux(irq);
|
|
return demux_irq;
|
|
}
|
|
|
|
static void ack_rts7751r2d_irq(unsigned int irq)
|
|
{
|
|
disable_rts7751r2d_irq(irq);
|
|
}
|
|
|
|
static void end_rts7751r2d_irq(unsigned int irq)
|
|
{
|
|
if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
|
|
enable_rts7751r2d_irq(irq);
|
|
}
|
|
|
|
static struct hw_interrupt_type rts7751r2d_irq_type = {
|
|
.typename = "RTS7751R2D IRQ",
|
|
.startup = startup_rts7751r2d_irq,
|
|
.shutdown = shutdown_rts7751r2d_irq,
|
|
.enable = enable_rts7751r2d_irq,
|
|
.disable = disable_rts7751r2d_irq,
|
|
.ack = ack_rts7751r2d_irq,
|
|
.end = end_rts7751r2d_irq,
|
|
};
|
|
|
|
static void make_rts7751r2d_irq(unsigned int irq)
|
|
{
|
|
disable_irq_nosync(irq);
|
|
irq_desc[irq].chip = &rts7751r2d_irq_type;
|
|
disable_rts7751r2d_irq(irq);
|
|
}
|
|
|
|
/*
|
|
* Initialize IRQ setting
|
|
*/
|
|
void __init init_rts7751r2d_IRQ(void)
|
|
{
|
|
int i;
|
|
|
|
/* IRL0=KEY Input
|
|
* IRL1=Ethernet
|
|
* IRL2=CF Card
|
|
* IRL3=CF Card Insert
|
|
* IRL4=PCMCIA
|
|
* IRL5=VOYAGER
|
|
* IRL6=RTC Alarm
|
|
* IRL7=RTC Timer
|
|
* IRL8=SD Card
|
|
* IRL9=PCI Slot #1
|
|
* IRL10=PCI Slot #2
|
|
* IRL11=Extention #0
|
|
* IRL12=Extention #1
|
|
* IRL13=Extention #2
|
|
* IRL14=Extention #3
|
|
*/
|
|
|
|
for (i=0; i<15; i++)
|
|
make_rts7751r2d_irq(i);
|
|
|
|
setup_voyagergx_irq();
|
|
}
|