2005-04-16 22:20:36 +00:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Copyright (c) 1999 Grant Erickson <grant@lcse.umn.edu>
|
|
|
|
*
|
|
|
|
* Module name: ppc403_pic.c
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Interrupt controller driver for PowerPC 403-based processors.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The PowerPC 403 cores' Asynchronous Interrupt Controller (AIC) has
|
|
|
|
* 32 possible interrupts, a majority of which are not implemented on
|
|
|
|
* all cores. There are six configurable, external interrupt pins and
|
|
|
|
* there are eight internal interrupts for the on-chip serial port
|
|
|
|
* (SPU), DMA controller, and JTAG controller.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/sched.h>
|
|
|
|
#include <linux/signal.h>
|
|
|
|
#include <linux/stddef.h>
|
|
|
|
|
|
|
|
#include <asm/processor.h>
|
|
|
|
#include <asm/system.h>
|
|
|
|
#include <asm/irq.h>
|
|
|
|
#include <asm/ppc4xx_pic.h>
|
2005-10-11 12:08:12 +00:00
|
|
|
#include <asm/machdep.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Function Prototypes */
|
|
|
|
|
|
|
|
static void ppc403_aic_enable(unsigned int irq);
|
|
|
|
static void ppc403_aic_disable(unsigned int irq);
|
|
|
|
static void ppc403_aic_disable_and_ack(unsigned int irq);
|
|
|
|
|
|
|
|
static struct hw_interrupt_type ppc403_aic = {
|
2005-09-10 07:26:40 +00:00
|
|
|
.typename = "403GC AIC",
|
|
|
|
.enable = ppc403_aic_enable,
|
|
|
|
.disable = ppc403_aic_disable,
|
|
|
|
.ack = ppc403_aic_disable_and_ack,
|
2005-04-16 22:20:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
int
|
2006-10-09 11:48:42 +00:00
|
|
|
ppc403_pic_get_irq(void)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
|
|
|
int irq;
|
|
|
|
unsigned long bits;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Only report the status of those interrupts that are actually
|
|
|
|
* enabled.
|
|
|
|
*/
|
|
|
|
|
|
|
|
bits = mfdcr(DCRN_EXISR) & mfdcr(DCRN_EXIER);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Walk through the interrupts from highest priority to lowest, and
|
|
|
|
* report the first pending interrupt found.
|
|
|
|
* We want PPC, not C bit numbering, so just subtract the ffs()
|
|
|
|
* result from 32.
|
|
|
|
*/
|
|
|
|
irq = 32 - ffs(bits);
|
|
|
|
|
|
|
|
if (irq == NR_AIC_IRQS)
|
|
|
|
irq = -1;
|
|
|
|
|
|
|
|
return (irq);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ppc403_aic_enable(unsigned int irq)
|
|
|
|
{
|
|
|
|
int bit, word;
|
|
|
|
|
|
|
|
bit = irq & 0x1f;
|
|
|
|
word = irq >> 5;
|
|
|
|
|
|
|
|
ppc_cached_irq_mask[word] |= (1 << (31 - bit));
|
|
|
|
mtdcr(DCRN_EXIER, ppc_cached_irq_mask[word]);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ppc403_aic_disable(unsigned int irq)
|
|
|
|
{
|
|
|
|
int bit, word;
|
|
|
|
|
|
|
|
bit = irq & 0x1f;
|
|
|
|
word = irq >> 5;
|
|
|
|
|
|
|
|
ppc_cached_irq_mask[word] &= ~(1 << (31 - bit));
|
|
|
|
mtdcr(DCRN_EXIER, ppc_cached_irq_mask[word]);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ppc403_aic_disable_and_ack(unsigned int irq)
|
|
|
|
{
|
|
|
|
int bit, word;
|
|
|
|
|
|
|
|
bit = irq & 0x1f;
|
|
|
|
word = irq >> 5;
|
|
|
|
|
|
|
|
ppc_cached_irq_mask[word] &= ~(1 << (31 - bit));
|
|
|
|
mtdcr(DCRN_EXIER, ppc_cached_irq_mask[word]);
|
|
|
|
mtdcr(DCRN_EXISR, (1 << (31 - bit)));
|
|
|
|
}
|
|
|
|
|
|
|
|
void __init
|
|
|
|
ppc4xx_pic_init(void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Disable all external interrupts until they are
|
2007-05-11 19:42:54 +00:00
|
|
|
* explicitly requested.
|
2005-04-16 22:20:36 +00:00
|
|
|
*/
|
|
|
|
ppc_cached_irq_mask[0] = 0;
|
|
|
|
|
|
|
|
mtdcr(DCRN_EXIER, ppc_cached_irq_mask[0]);
|
|
|
|
|
|
|
|
ppc_md.get_irq = ppc403_pic_get_irq;
|
|
|
|
|
|
|
|
for (i = 0; i < NR_IRQS; i++)
|
[PATCH] genirq: rename desc->handler to desc->chip
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>
2006-06-29 09:24:36 +00:00
|
|
|
irq_desc[i].chip = &ppc403_aic;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|