original_kernel/arch/sh/boards/renesas/hs7751rvoip/irq.c

116 lines
2.6 KiB
C
Raw Normal View History

/*
* linux/arch/sh/boards/renesas/hs7751rvoip/irq.c
*
* Copyright (C) 2000 Kazumoto Kojima
*
* Renesas Technology Sales HS7751RVoIP Support.
*
* Modified for HS7751RVoIP by
* Atom Create Engineering Co., Ltd. 2002.
* Lineo uSolutions, Inc. 2003.
*/
#include <linux/init.h>
#include <linux/irq.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/hs7751rvoip.h>
static int mask_pos[] = {8, 9, 10, 11, 12, 13, 0, 1, 2, 3, 4, 5, 6, 7};
static void enable_hs7751rvoip_irq(unsigned int irq);
static void disable_hs7751rvoip_irq(unsigned int irq);
/* shutdown is same as "disable" */
#define shutdown_hs7751rvoip_irq disable_hs7751rvoip_irq
static void ack_hs7751rvoip_irq(unsigned int irq);
static void end_hs7751rvoip_irq(unsigned int irq);
static unsigned int startup_hs7751rvoip_irq(unsigned int irq)
{
enable_hs7751rvoip_irq(irq);
return 0; /* never anything pending */
}
static void disable_hs7751rvoip_irq(unsigned int irq)
{
unsigned short val;
unsigned short mask = 0xffff ^ (0x0001 << mask_pos[irq]);
/* Set the priority in IPR to 0 */
val = ctrl_inw(IRLCNTR3);
val &= mask;
ctrl_outw(val, IRLCNTR3);
}
static void enable_hs7751rvoip_irq(unsigned int irq)
{
unsigned short val;
unsigned short value = (0x0001 << mask_pos[irq]);
/* Set priority in IPR back to original value */
val = ctrl_inw(IRLCNTR3);
val |= value;
ctrl_outw(val, IRLCNTR3);
}
static void ack_hs7751rvoip_irq(unsigned int irq)
{
disable_hs7751rvoip_irq(irq);
}
static void end_hs7751rvoip_irq(unsigned int irq)
{
if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
enable_hs7751rvoip_irq(irq);
}
static struct hw_interrupt_type hs7751rvoip_irq_type = {
.typename = "HS7751RVoIP IRQ",
.startup = startup_hs7751rvoip_irq,
.shutdown = shutdown_hs7751rvoip_irq,
.enable = enable_hs7751rvoip_irq,
.disable = disable_hs7751rvoip_irq,
.ack = ack_hs7751rvoip_irq,
.end = end_hs7751rvoip_irq,
};
static void make_hs7751rvoip_irq(unsigned int irq)
{
disable_irq_nosync(irq);
[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 17:24:36 +08:00
irq_desc[irq].chip = &hs7751rvoip_irq_type;
disable_hs7751rvoip_irq(irq);
}
/*
* Initialize IRQ setting
*/
void __init init_hs7751rvoip_IRQ(void)
{
int i;
/* IRL0=ON HOOK1
* IRL1=OFF HOOK1
* IRL2=ON HOOK2
* IRL3=OFF HOOK2
* IRL4=Ringing Detection
* IRL5=CODEC
* IRL6=Ethernet
* IRL7=Ethernet Hub
* IRL8=USB Communication
* IRL9=USB Connection
* IRL10=USB DMA
* IRL11=CF Card
* IRL12=PCMCIA
* IRL13=PCI Slot
*/
ctrl_outw(0x9876, IRLCNTR1);
ctrl_outw(0xdcba, IRLCNTR2);
ctrl_outw(0x0050, IRLCNTR4);
ctrl_outw(0x4321, IRLCNTR5);
for (i=0; i<14; i++)
make_hs7751rvoip_irq(i);
}