sh: build fixes for defconfigs.
[linux-2.6/kvm.git] / arch / sh / boards / renesas / r7780rp / irq.c
blob769ae6b6512337963c23fd9486b4fb4942499254
1 /*
2 * linux/arch/sh/boards/renesas/r7780rp/irq.c
4 * Copyright (C) 2000 Kazumoto Kojima
6 * Renesas Solutions Highlander R7780RP-1 Support.
8 * Modified for R7780RP-1 by
9 * Atom Create Engineering Co., Ltd. 2002.
12 #include <linux/config.h>
13 #include <linux/init.h>
14 #include <linux/irq.h>
15 #include <asm/io.h>
16 #include <asm/irq.h>
17 #include <asm/r7780rp/r7780rp.h>
19 #ifdef CONFIG_SH_R7780MP
20 static int mask_pos[] = {12, 11, 9, 14, 15, 8, 13, 6, 5, 4, 3, 2, 0, 0, 1, 0};
21 #else
22 static int mask_pos[] = {15, 14, 13, 12, 11, 10, 9, 8, 7, 5, 6, 4, 0, 1, 2, 0};
23 #endif
25 static void enable_r7780rp_irq(unsigned int irq);
26 static void disable_r7780rp_irq(unsigned int irq);
28 /* shutdown is same as "disable" */
29 #define shutdown_r7780rp_irq disable_r7780rp_irq
31 static void ack_r7780rp_irq(unsigned int irq);
32 static void end_r7780rp_irq(unsigned int irq);
34 static unsigned int startup_r7780rp_irq(unsigned int irq)
36 enable_r7780rp_irq(irq);
37 return 0; /* never anything pending */
40 static void disable_r7780rp_irq(unsigned int irq)
42 unsigned short val;
43 unsigned short mask = 0xffff ^ (0x0001 << mask_pos[irq]);
45 /* Set the priority in IPR to 0 */
46 val = ctrl_inw(IRLCNTR1);
47 val &= mask;
48 ctrl_outw(val, IRLCNTR1);
51 static void enable_r7780rp_irq(unsigned int irq)
53 unsigned short val;
54 unsigned short value = (0x0001 << mask_pos[irq]);
56 /* Set priority in IPR back to original value */
57 val = ctrl_inw(IRLCNTR1);
58 val |= value;
59 ctrl_outw(val, IRLCNTR1);
62 static void ack_r7780rp_irq(unsigned int irq)
64 disable_r7780rp_irq(irq);
67 static void end_r7780rp_irq(unsigned int irq)
69 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
70 enable_r7780rp_irq(irq);
73 static struct hw_interrupt_type r7780rp_irq_type = {
74 .typename = "R7780RP-IRQ",
75 .startup = startup_r7780rp_irq,
76 .shutdown = shutdown_r7780rp_irq,
77 .enable = enable_r7780rp_irq,
78 .disable = disable_r7780rp_irq,
79 .ack = ack_r7780rp_irq,
80 .end = end_r7780rp_irq,
83 static void make_r7780rp_irq(unsigned int irq)
85 disable_irq_nosync(irq);
86 irq_desc[irq].chip = &r7780rp_irq_type;
87 disable_r7780rp_irq(irq);
91 * Initialize IRQ setting
93 void __init init_r7780rp_IRQ(void)
95 int i;
97 /* IRL0=PCI Slot #A
98 * IRL1=PCI Slot #B
99 * IRL2=PCI Slot #C
100 * IRL3=PCI Slot #D
101 * IRL4=CF Card
102 * IRL5=CF Card Insert
103 * IRL6=M66596
104 * IRL7=SD Card
105 * IRL8=Touch Panel
106 * IRL9=SCI
107 * IRL10=Serial
108 * IRL11=Extention #A
109 * IRL11=Extention #B
110 * IRL12=Debug LAN
111 * IRL13=Push Switch
112 * IRL14=ZiggBee IO
115 for (i=0; i<15; i++)
116 make_r7780rp_irq(i);