Commit 88d6e199 authored by David Howells's avatar David Howells Committed by Linus Torvalds

[PATCH] FRV: improve FRV's use of generic IRQ handling

Improve FRV's use of generic IRQ handling:

 (*) Use generic_handle_irq() rather than __do_IRQ() as the latter is obsolete.

 (*) Don't implement enable() and disable() ops as these will fall back to
     using unmask() and mask().

 (*) Provide mask_ack() functions to avoid a call each to mask() and ack().

 (*) Make the cascade handlers always return IRQ_HANDLED.

 (*) Implement the mask() and unmask() functions in the same order as they're
     listed in the ops table.
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 1bcbba30
...@@ -36,41 +36,45 @@ ...@@ -36,41 +36,45 @@
/* /*
* on-motherboard FPGA PIC operations * on-motherboard FPGA PIC operations
*/ */
static void frv_fpga_enable(unsigned int irq) static void frv_fpga_mask(unsigned int irq)
{ {
uint16_t imr = __get_IMR(); uint16_t imr = __get_IMR();
imr &= ~(1 << (irq - IRQ_BASE_FPGA)); imr |= 1 << (irq - IRQ_BASE_FPGA);
__set_IMR(imr); __set_IMR(imr);
} }
static void frv_fpga_disable(unsigned int irq) static void frv_fpga_ack(unsigned int irq)
{
__clr_IFR(1 << (irq - IRQ_BASE_FPGA));
}
static void frv_fpga_mask_ack(unsigned int irq)
{ {
uint16_t imr = __get_IMR(); uint16_t imr = __get_IMR();
imr |= 1 << (irq - IRQ_BASE_FPGA); imr |= 1 << (irq - IRQ_BASE_FPGA);
__set_IMR(imr); __set_IMR(imr);
}
static void frv_fpga_ack(unsigned int irq)
{
__clr_IFR(1 << (irq - IRQ_BASE_FPGA)); __clr_IFR(1 << (irq - IRQ_BASE_FPGA));
} }
static void frv_fpga_end(unsigned int irq) static void frv_fpga_unmask(unsigned int irq)
{ {
uint16_t imr = __get_IMR();
imr &= ~(1 << (irq - IRQ_BASE_FPGA));
__set_IMR(imr);
} }
static struct irq_chip frv_fpga_pic = { static struct irq_chip frv_fpga_pic = {
.name = "mb93091", .name = "mb93091",
.enable = frv_fpga_enable,
.disable = frv_fpga_disable,
.ack = frv_fpga_ack, .ack = frv_fpga_ack,
.mask = frv_fpga_disable, .mask = frv_fpga_mask,
.unmask = frv_fpga_enable, .mask_ack = frv_fpga_mask_ack,
.end = frv_fpga_end, .unmask = frv_fpga_unmask,
}; };
/* /*
...@@ -79,7 +83,6 @@ static struct irq_chip frv_fpga_pic = { ...@@ -79,7 +83,6 @@ static struct irq_chip frv_fpga_pic = {
static irqreturn_t fpga_interrupt(int irq, void *_mask, struct pt_regs *regs) static irqreturn_t fpga_interrupt(int irq, void *_mask, struct pt_regs *regs)
{ {
uint16_t imr, mask = (unsigned long) _mask; uint16_t imr, mask = (unsigned long) _mask;
irqreturn_t iret = 0;
imr = __get_IMR(); imr = __get_IMR();
mask = mask & ~imr & __get_IFR(); mask = mask & ~imr & __get_IFR();
...@@ -92,11 +95,10 @@ static irqreturn_t fpga_interrupt(int irq, void *_mask, struct pt_regs *regs) ...@@ -92,11 +95,10 @@ static irqreturn_t fpga_interrupt(int irq, void *_mask, struct pt_regs *regs)
irq = 31 - irq; irq = 31 - irq;
mask &= ~(1 << irq); mask &= ~(1 << irq);
if (__do_IRQ(IRQ_BASE_FPGA + irq, regs)) generic_handle_irq(IRQ_BASE_FPGA + irq, regs);
iret |= IRQ_HANDLED;
} }
return iret; return IRQ_HANDLED;
} }
/* /*
......
...@@ -35,40 +35,44 @@ ...@@ -35,40 +35,44 @@
/* /*
* off-CPU FPGA PIC operations * off-CPU FPGA PIC operations
*/ */
static void frv_fpga_enable(unsigned int irq) static void frv_fpga_mask(unsigned int irq)
{ {
uint16_t imr = __get_IMR(); uint16_t imr = __get_IMR();
imr &= ~(1 << (irq - IRQ_BASE_FPGA)); imr |= 1 << (irq - IRQ_BASE_FPGA);
__set_IMR(imr); __set_IMR(imr);
} }
static void frv_fpga_disable(unsigned int irq) static void frv_fpga_ack(unsigned int irq)
{
__clr_IFR(1 << (irq - IRQ_BASE_FPGA));
}
static void frv_fpga_mask_ack(unsigned int irq)
{ {
uint16_t imr = __get_IMR(); uint16_t imr = __get_IMR();
imr |= 1 << (irq - IRQ_BASE_FPGA); imr |= 1 << (irq - IRQ_BASE_FPGA);
__set_IMR(imr); __set_IMR(imr);
}
static void frv_fpga_ack(unsigned int irq)
{
__clr_IFR(1 << (irq - IRQ_BASE_FPGA)); __clr_IFR(1 << (irq - IRQ_BASE_FPGA));
} }
static void frv_fpga_end(unsigned int irq) static void frv_fpga_unmask(unsigned int irq)
{ {
uint16_t imr = __get_IMR();
imr &= ~(1 << (irq - IRQ_BASE_FPGA));
__set_IMR(imr);
} }
static struct irq_chip frv_fpga_pic = { static struct irq_chip frv_fpga_pic = {
.name = "mb93093", .name = "mb93093",
.enable = frv_fpga_enable,
.disable = frv_fpga_disable,
.ack = frv_fpga_ack, .ack = frv_fpga_ack,
.mask = frv_fpga_disable, .mask = frv_fpga_mask,
.unmask = frv_fpga_enable, .mask_ack = frv_fpga_mask_ack,
.unmask = frv_fpga_unmask,
.end = frv_fpga_end, .end = frv_fpga_end,
}; };
...@@ -78,7 +82,6 @@ static struct irq_chip frv_fpga_pic = { ...@@ -78,7 +82,6 @@ static struct irq_chip frv_fpga_pic = {
static irqreturn_t fpga_interrupt(int irq, void *_mask, struct pt_regs *regs) static irqreturn_t fpga_interrupt(int irq, void *_mask, struct pt_regs *regs)
{ {
uint16_t imr, mask = (unsigned long) _mask; uint16_t imr, mask = (unsigned long) _mask;
irqreturn_t iret = 0;
imr = __get_IMR(); imr = __get_IMR();
mask = mask & ~imr & __get_IFR(); mask = mask & ~imr & __get_IFR();
...@@ -91,11 +94,10 @@ static irqreturn_t fpga_interrupt(int irq, void *_mask, struct pt_regs *regs) ...@@ -91,11 +94,10 @@ static irqreturn_t fpga_interrupt(int irq, void *_mask, struct pt_regs *regs)
irq = 31 - irq; irq = 31 - irq;
mask &= ~(1 << irq); mask &= ~(1 << irq);
if (__do_IRQ(IRQ_BASE_FPGA + irq, regs)) generic_irq_handle(IRQ_BASE_FPGA + irq, regs);
iret |= IRQ_HANDLED;
} }
return iret; return IRQ_HANDLED;
} }
/* /*
......
...@@ -43,8 +43,9 @@ ...@@ -43,8 +43,9 @@
/* /*
* daughter board PIC operations * daughter board PIC operations
* - there is no way to ACK interrupts in the MB93493 chip
*/ */
static void frv_mb93493_enable(unsigned int irq) static void frv_mb93493_mask(unsigned int irq)
{ {
uint32_t iqsr; uint32_t iqsr;
volatile void *piqsr; volatile void *piqsr;
...@@ -55,11 +56,15 @@ static void frv_mb93493_enable(unsigned int irq) ...@@ -55,11 +56,15 @@ static void frv_mb93493_enable(unsigned int irq)
piqsr = __addr_MB93493_IQSR(0); piqsr = __addr_MB93493_IQSR(0);
iqsr = readl(piqsr); iqsr = readl(piqsr);
iqsr |= 1 << (irq - IRQ_BASE_MB93493 + 16); iqsr &= ~(1 << (irq - IRQ_BASE_MB93493 + 16));
writel(iqsr, piqsr); writel(iqsr, piqsr);
} }
static void frv_mb93493_disable(unsigned int irq) static void frv_mb93493_ack(unsigned int irq)
{
}
static void frv_mb93493_unmask(unsigned int irq)
{ {
uint32_t iqsr; uint32_t iqsr;
volatile void *piqsr; volatile void *piqsr;
...@@ -70,26 +75,16 @@ static void frv_mb93493_disable(unsigned int irq) ...@@ -70,26 +75,16 @@ static void frv_mb93493_disable(unsigned int irq)
piqsr = __addr_MB93493_IQSR(0); piqsr = __addr_MB93493_IQSR(0);
iqsr = readl(piqsr); iqsr = readl(piqsr);
iqsr &= ~(1 << (irq - IRQ_BASE_MB93493 + 16)); iqsr |= 1 << (irq - IRQ_BASE_MB93493 + 16);
writel(iqsr, piqsr); writel(iqsr, piqsr);
} }
static void frv_mb93493_ack(unsigned int irq)
{
}
static void frv_mb93493_end(unsigned int irq)
{
}
static struct irq_chip frv_mb93493_pic = { static struct irq_chip frv_mb93493_pic = {
.name = "mb93093", .name = "mb93093",
.enable = frv_mb93493_enable,
.disable = frv_mb93493_disable,
.ack = frv_mb93493_ack, .ack = frv_mb93493_ack,
.mask = frv_mb93493_disable, .mask = frv_mb93493_mask,
.unmask = frv_mb93493_enable, .mask_ack = frv_mb93493_mask,
.end = frv_mb93493_end, .unmask = frv_mb93493_unmask,
}; };
/* /*
...@@ -98,7 +93,6 @@ static struct irq_chip frv_mb93493_pic = { ...@@ -98,7 +93,6 @@ static struct irq_chip frv_mb93493_pic = {
static irqreturn_t mb93493_interrupt(int irq, void *_piqsr, struct pt_regs *regs) static irqreturn_t mb93493_interrupt(int irq, void *_piqsr, struct pt_regs *regs)
{ {
volatile void *piqsr = _piqsr; volatile void *piqsr = _piqsr;
irqreturn_t iret = 0;
uint32_t iqsr; uint32_t iqsr;
iqsr = readl(piqsr); iqsr = readl(piqsr);
...@@ -112,11 +106,10 @@ static irqreturn_t mb93493_interrupt(int irq, void *_piqsr, struct pt_regs *regs ...@@ -112,11 +106,10 @@ static irqreturn_t mb93493_interrupt(int irq, void *_piqsr, struct pt_regs *regs
irq = 31 - irq; irq = 31 - irq;
iqsr &= ~(1 << irq); iqsr &= ~(1 << irq);
if (__do_IRQ(IRQ_BASE_MB93493 + irq, regs)) generic_handle_irq(IRQ_BASE_MB93493 + irq, regs);
iret |= IRQ_HANDLED;
} }
return iret; return IRQ_HANDLED;
} }
/* /*
......
...@@ -97,19 +97,8 @@ int show_interrupts(struct seq_file *p, void *v) ...@@ -97,19 +97,8 @@ int show_interrupts(struct seq_file *p, void *v)
/* /*
* on-CPU PIC operations * on-CPU PIC operations
*/ */
static void frv_cpupic_enable(unsigned int irqlevel)
{
__clr_MASK(irqlevel);
}
static void frv_cpupic_disable(unsigned int irqlevel)
{
__set_MASK(irqlevel);
}
static void frv_cpupic_ack(unsigned int irqlevel) static void frv_cpupic_ack(unsigned int irqlevel)
{ {
__set_MASK(irqlevel);
__clr_RC(irqlevel); __clr_RC(irqlevel);
__clr_IRL(); __clr_IRL();
} }
...@@ -138,8 +127,6 @@ static void frv_cpupic_end(unsigned int irqlevel) ...@@ -138,8 +127,6 @@ static void frv_cpupic_end(unsigned int irqlevel)
static struct irq_chip frv_cpu_pic = { static struct irq_chip frv_cpu_pic = {
.name = "cpu", .name = "cpu",
.enable = frv_cpupic_enable,
.disable = frv_cpupic_disable,
.ack = frv_cpupic_ack, .ack = frv_cpupic_ack,
.mask = frv_cpupic_mask, .mask = frv_cpupic_mask,
.mask_ack = frv_cpupic_mask_ack, .mask_ack = frv_cpupic_mask_ack,
...@@ -156,7 +143,7 @@ static struct irq_chip frv_cpu_pic = { ...@@ -156,7 +143,7 @@ static struct irq_chip frv_cpu_pic = {
asmlinkage void do_IRQ(void) asmlinkage void do_IRQ(void)
{ {
irq_enter(); irq_enter();
__do_IRQ(__get_IRL(), __frame); generic_handle_irq(__get_IRL(), __frame);
irq_exit(); irq_exit();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment