diff options
Diffstat (limited to 'arch/sh/boards/superh/microdev/irq.c')
-rw-r--r-- | arch/sh/boards/superh/microdev/irq.c | 39 |
1 files changed, 11 insertions, 28 deletions
diff --git a/arch/sh/boards/superh/microdev/irq.c b/arch/sh/boards/superh/microdev/irq.c index 236398fbc08..8c64baa3036 100644 --- a/arch/sh/boards/superh/microdev/irq.c +++ b/arch/sh/boards/superh/microdev/irq.c | |||
@@ -11,14 +11,12 @@ | |||
11 | 11 | ||
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/irq.h> | 13 | #include <linux/irq.h> |
14 | |||
15 | #include <asm/system.h> | 14 | #include <asm/system.h> |
16 | #include <asm/io.h> | 15 | #include <asm/io.h> |
17 | #include <asm/microdev.h> | 16 | #include <asm/microdev.h> |
18 | 17 | ||
19 | #define NUM_EXTERNAL_IRQS 16 /* IRL0 .. IRL15 */ | 18 | #define NUM_EXTERNAL_IRQS 16 /* IRL0 .. IRL15 */ |
20 | 19 | ||
21 | |||
22 | static const struct { | 20 | static const struct { |
23 | unsigned char fpgaIrq; | 21 | unsigned char fpgaIrq; |
24 | unsigned char mapped; | 22 | unsigned char mapped; |
@@ -93,53 +91,42 @@ static struct hw_interrupt_type microdev_irq_type = { | |||
93 | 91 | ||
94 | static void disable_microdev_irq(unsigned int irq) | 92 | static void disable_microdev_irq(unsigned int irq) |
95 | { | 93 | { |
96 | unsigned int flags; | ||
97 | unsigned int fpgaIrq; | 94 | unsigned int fpgaIrq; |
98 | 95 | ||
99 | if (irq >= NUM_EXTERNAL_IRQS) return; | 96 | if (irq >= NUM_EXTERNAL_IRQS) |
100 | if (!fpgaIrqTable[irq].mapped) return; | 97 | return; |
98 | if (!fpgaIrqTable[irq].mapped) | ||
99 | return; | ||
101 | 100 | ||
102 | fpgaIrq = fpgaIrqTable[irq].fpgaIrq; | 101 | fpgaIrq = fpgaIrqTable[irq].fpgaIrq; |
103 | 102 | ||
104 | /* disable interrupts */ | 103 | /* disable interupts on the FPGA INTC register */ |
105 | local_irq_save(flags); | ||
106 | |||
107 | /* disable interupts on the FPGA INTC register */ | ||
108 | ctrl_outl(MICRODEV_FPGA_INTC_MASK(fpgaIrq), MICRODEV_FPGA_INTDSB_REG); | 104 | ctrl_outl(MICRODEV_FPGA_INTC_MASK(fpgaIrq), MICRODEV_FPGA_INTDSB_REG); |
109 | |||
110 | /* restore interrupts */ | ||
111 | local_irq_restore(flags); | ||
112 | } | 105 | } |
113 | 106 | ||
114 | static void enable_microdev_irq(unsigned int irq) | 107 | static void enable_microdev_irq(unsigned int irq) |
115 | { | 108 | { |
116 | unsigned long priorityReg, priorities, pri; | 109 | unsigned long priorityReg, priorities, pri; |
117 | unsigned int flags; | ||
118 | unsigned int fpgaIrq; | 110 | unsigned int fpgaIrq; |
119 | 111 | ||
120 | 112 | if (unlikely(irq >= NUM_EXTERNAL_IRQS)) | |
121 | if (irq >= NUM_EXTERNAL_IRQS) return; | 113 | return; |
122 | if (!fpgaIrqTable[irq].mapped) return; | 114 | if (unlikely(!fpgaIrqTable[irq].mapped)) |
115 | return; | ||
123 | 116 | ||
124 | pri = 15 - irq; | 117 | pri = 15 - irq; |
125 | 118 | ||
126 | fpgaIrq = fpgaIrqTable[irq].fpgaIrq; | 119 | fpgaIrq = fpgaIrqTable[irq].fpgaIrq; |
127 | priorityReg = MICRODEV_FPGA_INTPRI_REG(fpgaIrq); | 120 | priorityReg = MICRODEV_FPGA_INTPRI_REG(fpgaIrq); |
128 | 121 | ||
129 | /* disable interrupts */ | 122 | /* set priority for the interrupt */ |
130 | local_irq_save(flags); | ||
131 | |||
132 | /* set priority for the interrupt */ | ||
133 | priorities = ctrl_inl(priorityReg); | 123 | priorities = ctrl_inl(priorityReg); |
134 | priorities &= ~MICRODEV_FPGA_INTPRI_MASK(fpgaIrq); | 124 | priorities &= ~MICRODEV_FPGA_INTPRI_MASK(fpgaIrq); |
135 | priorities |= MICRODEV_FPGA_INTPRI_LEVEL(fpgaIrq, pri); | 125 | priorities |= MICRODEV_FPGA_INTPRI_LEVEL(fpgaIrq, pri); |
136 | ctrl_outl(priorities, priorityReg); | 126 | ctrl_outl(priorities, priorityReg); |
137 | 127 | ||
138 | /* enable interupts on the FPGA INTC register */ | 128 | /* enable interupts on the FPGA INTC register */ |
139 | ctrl_outl(MICRODEV_FPGA_INTC_MASK(fpgaIrq), MICRODEV_FPGA_INTENB_REG); | 129 | ctrl_outl(MICRODEV_FPGA_INTC_MASK(fpgaIrq), MICRODEV_FPGA_INTENB_REG); |
140 | |||
141 | /* restore interrupts */ | ||
142 | local_irq_restore(flags); | ||
143 | } | 130 | } |
144 | 131 | ||
145 | /* This functions sets the desired irq handler to be a MicroDev type */ | 132 | /* This functions sets the desired irq handler to be a MicroDev type */ |
@@ -158,9 +145,7 @@ static void mask_and_ack_microdev(unsigned int irq) | |||
158 | static void end_microdev_irq(unsigned int irq) | 145 | static void end_microdev_irq(unsigned int irq) |
159 | { | 146 | { |
160 | if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) | 147 | if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) |
161 | { | ||
162 | enable_microdev_irq(irq); | 148 | enable_microdev_irq(irq); |
163 | } | ||
164 | } | 149 | } |
165 | 150 | ||
166 | extern void __init init_microdev_irq(void) | 151 | extern void __init init_microdev_irq(void) |
@@ -171,9 +156,7 @@ extern void __init init_microdev_irq(void) | |||
171 | ctrl_outl(~0ul, MICRODEV_FPGA_INTDSB_REG); | 156 | ctrl_outl(~0ul, MICRODEV_FPGA_INTDSB_REG); |
172 | 157 | ||
173 | for (i = 0; i < NUM_EXTERNAL_IRQS; i++) | 158 | for (i = 0; i < NUM_EXTERNAL_IRQS; i++) |
174 | { | ||
175 | make_microdev_irq(i); | 159 | make_microdev_irq(i); |
176 | } | ||
177 | } | 160 | } |
178 | 161 | ||
179 | extern void microdev_print_fpga_intc_status(void) | 162 | extern void microdev_print_fpga_intc_status(void) |