diff options
author | Atsushi Nemoto <anemo@mba.ocn.ne.jp> | 2006-11-01 12:08:36 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2006-11-29 20:14:46 -0500 |
commit | 1603b5aca4f15b34848fb5594d0c7b6333b99144 (patch) | |
tree | 79272aa41d6510b7256df62e287676885c3960cf /arch/mips/tx4938/toshiba_rbtx4938 | |
parent | c87b6ebaea034c0e0ce86127870cf1511a307b64 (diff) |
[MIPS] IRQ cleanups
This is a big irq cleanup patch.
* Use set_irq_chip() to register irq_chip.
* Initialize .mask, .unmask, .mask_ack field. Functions for these
method are already exist in most case.
* Do not initialize .startup, .shutdown, .enable, .disable fields if
default routines provided by irq_chip_set_defaults() were suitable.
* Remove redundant irq_desc initializations.
* Remove unnecessary local_irq_save/local_irq_restore, spin_lock.
With this cleanup, it would be easy to switch to slightly lightwait
irq flow handlers (handle_level_irq(), etc.) instead of __do_IRQ().
Though whole this patch is quite large, changes in each irq_chip are
not quite simple. Please review and test on your platform. Thanks.
Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/tx4938/toshiba_rbtx4938')
-rw-r--r-- | arch/mips/tx4938/toshiba_rbtx4938/irq.c | 53 |
1 files changed, 6 insertions, 47 deletions
diff --git a/arch/mips/tx4938/toshiba_rbtx4938/irq.c b/arch/mips/tx4938/toshiba_rbtx4938/irq.c index 102e473c10a2..2735ffe9ec28 100644 --- a/arch/mips/tx4938/toshiba_rbtx4938/irq.c +++ b/arch/mips/tx4938/toshiba_rbtx4938/irq.c | |||
@@ -87,25 +87,18 @@ IRQ Device | |||
87 | #include <linux/bootmem.h> | 87 | #include <linux/bootmem.h> |
88 | #include <asm/tx4938/rbtx4938.h> | 88 | #include <asm/tx4938/rbtx4938.h> |
89 | 89 | ||
90 | static unsigned int toshiba_rbtx4938_irq_ioc_startup(unsigned int irq); | ||
91 | static void toshiba_rbtx4938_irq_ioc_shutdown(unsigned int irq); | ||
92 | static void toshiba_rbtx4938_irq_ioc_enable(unsigned int irq); | 90 | static void toshiba_rbtx4938_irq_ioc_enable(unsigned int irq); |
93 | static void toshiba_rbtx4938_irq_ioc_disable(unsigned int irq); | 91 | static void toshiba_rbtx4938_irq_ioc_disable(unsigned int irq); |
94 | static void toshiba_rbtx4938_irq_ioc_mask_and_ack(unsigned int irq); | ||
95 | static void toshiba_rbtx4938_irq_ioc_end(unsigned int irq); | 92 | static void toshiba_rbtx4938_irq_ioc_end(unsigned int irq); |
96 | 93 | ||
97 | DEFINE_SPINLOCK(toshiba_rbtx4938_ioc_lock); | ||
98 | |||
99 | #define TOSHIBA_RBTX4938_IOC_NAME "RBTX4938-IOC" | 94 | #define TOSHIBA_RBTX4938_IOC_NAME "RBTX4938-IOC" |
100 | static struct irq_chip toshiba_rbtx4938_irq_ioc_type = { | 95 | static struct irq_chip toshiba_rbtx4938_irq_ioc_type = { |
101 | .typename = TOSHIBA_RBTX4938_IOC_NAME, | 96 | .typename = TOSHIBA_RBTX4938_IOC_NAME, |
102 | .startup = toshiba_rbtx4938_irq_ioc_startup, | 97 | .ack = toshiba_rbtx4938_irq_ioc_disable, |
103 | .shutdown = toshiba_rbtx4938_irq_ioc_shutdown, | 98 | .mask = toshiba_rbtx4938_irq_ioc_disable, |
104 | .enable = toshiba_rbtx4938_irq_ioc_enable, | 99 | .mask_ack = toshiba_rbtx4938_irq_ioc_disable, |
105 | .disable = toshiba_rbtx4938_irq_ioc_disable, | 100 | .unmask = toshiba_rbtx4938_irq_ioc_enable, |
106 | .ack = toshiba_rbtx4938_irq_ioc_mask_and_ack, | ||
107 | .end = toshiba_rbtx4938_irq_ioc_end, | 101 | .end = toshiba_rbtx4938_irq_ioc_end, |
108 | .set_affinity = NULL | ||
109 | }; | 102 | }; |
110 | 103 | ||
111 | #define TOSHIBA_RBTX4938_IOC_INTR_ENAB 0xb7f02000 | 104 | #define TOSHIBA_RBTX4938_IOC_INTR_ENAB 0xb7f02000 |
@@ -142,69 +135,35 @@ toshiba_rbtx4938_irq_ioc_init(void) | |||
142 | int i; | 135 | int i; |
143 | 136 | ||
144 | for (i = TOSHIBA_RBTX4938_IRQ_IOC_BEG; | 137 | for (i = TOSHIBA_RBTX4938_IRQ_IOC_BEG; |
145 | i <= TOSHIBA_RBTX4938_IRQ_IOC_END; i++) { | 138 | i <= TOSHIBA_RBTX4938_IRQ_IOC_END; i++) |
146 | irq_desc[i].status = IRQ_DISABLED; | 139 | set_irq_chip(i, &toshiba_rbtx4938_irq_ioc_type); |
147 | irq_desc[i].action = 0; | ||
148 | irq_desc[i].depth = 3; | ||
149 | irq_desc[i].chip = &toshiba_rbtx4938_irq_ioc_type; | ||
150 | } | ||
151 | 140 | ||
152 | setup_irq(RBTX4938_IRQ_IOCINT, | 141 | setup_irq(RBTX4938_IRQ_IOCINT, |
153 | &toshiba_rbtx4938_irq_ioc_action); | 142 | &toshiba_rbtx4938_irq_ioc_action); |
154 | } | 143 | } |
155 | 144 | ||
156 | static unsigned int | ||
157 | toshiba_rbtx4938_irq_ioc_startup(unsigned int irq) | ||
158 | { | ||
159 | toshiba_rbtx4938_irq_ioc_enable(irq); | ||
160 | |||
161 | return 0; | ||
162 | } | ||
163 | |||
164 | static void | ||
165 | toshiba_rbtx4938_irq_ioc_shutdown(unsigned int irq) | ||
166 | { | ||
167 | toshiba_rbtx4938_irq_ioc_disable(irq); | ||
168 | } | ||
169 | |||
170 | static void | 145 | static void |
171 | toshiba_rbtx4938_irq_ioc_enable(unsigned int irq) | 146 | toshiba_rbtx4938_irq_ioc_enable(unsigned int irq) |
172 | { | 147 | { |
173 | unsigned long flags; | ||
174 | volatile unsigned char v; | 148 | volatile unsigned char v; |
175 | 149 | ||
176 | spin_lock_irqsave(&toshiba_rbtx4938_ioc_lock, flags); | ||
177 | |||
178 | v = TX4938_RD08(TOSHIBA_RBTX4938_IOC_INTR_ENAB); | 150 | v = TX4938_RD08(TOSHIBA_RBTX4938_IOC_INTR_ENAB); |
179 | v |= (1 << (irq - TOSHIBA_RBTX4938_IRQ_IOC_BEG)); | 151 | v |= (1 << (irq - TOSHIBA_RBTX4938_IRQ_IOC_BEG)); |
180 | TX4938_WR08(TOSHIBA_RBTX4938_IOC_INTR_ENAB, v); | 152 | TX4938_WR08(TOSHIBA_RBTX4938_IOC_INTR_ENAB, v); |
181 | mmiowb(); | 153 | mmiowb(); |
182 | TX4938_RD08(TOSHIBA_RBTX4938_IOC_INTR_ENAB); | 154 | TX4938_RD08(TOSHIBA_RBTX4938_IOC_INTR_ENAB); |
183 | |||
184 | spin_unlock_irqrestore(&toshiba_rbtx4938_ioc_lock, flags); | ||
185 | } | 155 | } |
186 | 156 | ||
187 | static void | 157 | static void |
188 | toshiba_rbtx4938_irq_ioc_disable(unsigned int irq) | 158 | toshiba_rbtx4938_irq_ioc_disable(unsigned int irq) |
189 | { | 159 | { |
190 | unsigned long flags; | ||
191 | volatile unsigned char v; | 160 | volatile unsigned char v; |
192 | 161 | ||
193 | spin_lock_irqsave(&toshiba_rbtx4938_ioc_lock, flags); | ||
194 | |||
195 | v = TX4938_RD08(TOSHIBA_RBTX4938_IOC_INTR_ENAB); | 162 | v = TX4938_RD08(TOSHIBA_RBTX4938_IOC_INTR_ENAB); |
196 | v &= ~(1 << (irq - TOSHIBA_RBTX4938_IRQ_IOC_BEG)); | 163 | v &= ~(1 << (irq - TOSHIBA_RBTX4938_IRQ_IOC_BEG)); |
197 | TX4938_WR08(TOSHIBA_RBTX4938_IOC_INTR_ENAB, v); | 164 | TX4938_WR08(TOSHIBA_RBTX4938_IOC_INTR_ENAB, v); |
198 | mmiowb(); | 165 | mmiowb(); |
199 | TX4938_RD08(TOSHIBA_RBTX4938_IOC_INTR_ENAB); | 166 | TX4938_RD08(TOSHIBA_RBTX4938_IOC_INTR_ENAB); |
200 | |||
201 | spin_unlock_irqrestore(&toshiba_rbtx4938_ioc_lock, flags); | ||
202 | } | ||
203 | |||
204 | static void | ||
205 | toshiba_rbtx4938_irq_ioc_mask_and_ack(unsigned int irq) | ||
206 | { | ||
207 | toshiba_rbtx4938_irq_ioc_disable(irq); | ||
208 | } | 167 | } |
209 | 168 | ||
210 | static void | 169 | static void |