sh: Kill off remaining config.h references.
[linux-2.6/linux-loongson.git] / arch / sh / boards / renesas / r7780rp / irq.c
blob2d960e9a3143b5bae8c2061b0c0bd4e4dfd4915e
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.
11 #include <linux/init.h>
12 #include <linux/irq.h>
13 #include <asm/io.h>
14 #include <asm/irq.h>
15 #include <asm/r7780rp/r7780rp.h>
17 #ifdef CONFIG_SH_R7780MP
18 static int mask_pos[] = {12, 11, 9, 14, 15, 8, 13, 6, 5, 4, 3, 2, 0, 0, 1, 0};
19 #else
20 static int mask_pos[] = {15, 14, 13, 12, 11, 10, 9, 8, 7, 5, 6, 4, 0, 1, 2, 0};
21 #endif
23 static void enable_r7780rp_irq(unsigned int irq);
24 static void disable_r7780rp_irq(unsigned int irq);
26 /* shutdown is same as "disable" */
27 #define shutdown_r7780rp_irq disable_r7780rp_irq
29 static void ack_r7780rp_irq(unsigned int irq);
30 static void end_r7780rp_irq(unsigned int irq);
32 static unsigned int startup_r7780rp_irq(unsigned int irq)
34 enable_r7780rp_irq(irq);
35 return 0; /* never anything pending */
38 static void disable_r7780rp_irq(unsigned int irq)
40 unsigned short val;
41 unsigned short mask = 0xffff ^ (0x0001 << mask_pos[irq]);
43 /* Set the priority in IPR to 0 */
44 val = ctrl_inw(IRLCNTR1);
45 val &= mask;
46 ctrl_outw(val, IRLCNTR1);
49 static void enable_r7780rp_irq(unsigned int irq)
51 unsigned short val;
52 unsigned short value = (0x0001 << mask_pos[irq]);
54 /* Set priority in IPR back to original value */
55 val = ctrl_inw(IRLCNTR1);
56 val |= value;
57 ctrl_outw(val, IRLCNTR1);
60 static void ack_r7780rp_irq(unsigned int irq)
62 disable_r7780rp_irq(irq);
65 static void end_r7780rp_irq(unsigned int irq)
67 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
68 enable_r7780rp_irq(irq);
71 static struct hw_interrupt_type r7780rp_irq_type = {
72 .typename = "R7780RP-IRQ",
73 .startup = startup_r7780rp_irq,
74 .shutdown = shutdown_r7780rp_irq,
75 .enable = enable_r7780rp_irq,
76 .disable = disable_r7780rp_irq,
77 .ack = ack_r7780rp_irq,
78 .end = end_r7780rp_irq,
81 static void make_r7780rp_irq(unsigned int irq)
83 disable_irq_nosync(irq);
84 irq_desc[irq].chip = &r7780rp_irq_type;
85 disable_r7780rp_irq(irq);
89 * Initialize IRQ setting
91 void __init init_r7780rp_IRQ(void)
93 int i;
95 /* IRL0=PCI Slot #A
96 * IRL1=PCI Slot #B
97 * IRL2=PCI Slot #C
98 * IRL3=PCI Slot #D
99 * IRL4=CF Card
100 * IRL5=CF Card Insert
101 * IRL6=M66596
102 * IRL7=SD Card
103 * IRL8=Touch Panel
104 * IRL9=SCI
105 * IRL10=Serial
106 * IRL11=Extention #A
107 * IRL11=Extention #B
108 * IRL12=Debug LAN
109 * IRL13=Push Switch
110 * IRL14=ZiggBee IO
113 for (i=0; i<15; i++)
114 make_r7780rp_irq(i);