diff options
Diffstat (limited to 'arch/mips/tx4938')
-rw-r--r-- | arch/mips/tx4938/common/irq.c | 115 | ||||
-rw-r--r-- | arch/mips/tx4938/common/setup.c | 1 | ||||
-rw-r--r-- | arch/mips/tx4938/toshiba_rbtx4938/irq.c | 54 | ||||
-rw-r--r-- | arch/mips/tx4938/toshiba_rbtx4938/spi_txx9.c | 8 |
4 files changed, 27 insertions, 151 deletions
diff --git a/arch/mips/tx4938/common/irq.c b/arch/mips/tx4938/common/irq.c index 77fe2454f5b..42e127683ae 100644 --- a/arch/mips/tx4938/common/irq.c +++ b/arch/mips/tx4938/common/irq.c | |||
@@ -37,48 +37,36 @@ | |||
37 | /* Forwad definitions for all pic's */ | 37 | /* Forwad definitions for all pic's */ |
38 | /**********************************************************************************/ | 38 | /**********************************************************************************/ |
39 | 39 | ||
40 | static unsigned int tx4938_irq_cp0_startup(unsigned int irq); | ||
41 | static void tx4938_irq_cp0_shutdown(unsigned int irq); | ||
42 | static void tx4938_irq_cp0_enable(unsigned int irq); | 40 | static void tx4938_irq_cp0_enable(unsigned int irq); |
43 | static void tx4938_irq_cp0_disable(unsigned int irq); | 41 | static void tx4938_irq_cp0_disable(unsigned int irq); |
44 | static void tx4938_irq_cp0_mask_and_ack(unsigned int irq); | ||
45 | static void tx4938_irq_cp0_end(unsigned int irq); | 42 | static void tx4938_irq_cp0_end(unsigned int irq); |
46 | 43 | ||
47 | static unsigned int tx4938_irq_pic_startup(unsigned int irq); | ||
48 | static void tx4938_irq_pic_shutdown(unsigned int irq); | ||
49 | static void tx4938_irq_pic_enable(unsigned int irq); | 44 | static void tx4938_irq_pic_enable(unsigned int irq); |
50 | static void tx4938_irq_pic_disable(unsigned int irq); | 45 | static void tx4938_irq_pic_disable(unsigned int irq); |
51 | static void tx4938_irq_pic_mask_and_ack(unsigned int irq); | ||
52 | static void tx4938_irq_pic_end(unsigned int irq); | 46 | static void tx4938_irq_pic_end(unsigned int irq); |
53 | 47 | ||
54 | /**********************************************************************************/ | 48 | /**********************************************************************************/ |
55 | /* Kernel structs for all pic's */ | 49 | /* Kernel structs for all pic's */ |
56 | /**********************************************************************************/ | 50 | /**********************************************************************************/ |
57 | DEFINE_SPINLOCK(tx4938_cp0_lock); | ||
58 | DEFINE_SPINLOCK(tx4938_pic_lock); | ||
59 | 51 | ||
60 | #define TX4938_CP0_NAME "TX4938-CP0" | 52 | #define TX4938_CP0_NAME "TX4938-CP0" |
61 | static struct irq_chip tx4938_irq_cp0_type = { | 53 | static struct irq_chip tx4938_irq_cp0_type = { |
62 | .typename = TX4938_CP0_NAME, | 54 | .typename = TX4938_CP0_NAME, |
63 | .startup = tx4938_irq_cp0_startup, | 55 | .ack = tx4938_irq_cp0_disable, |
64 | .shutdown = tx4938_irq_cp0_shutdown, | 56 | .mask = tx4938_irq_cp0_disable, |
65 | .enable = tx4938_irq_cp0_enable, | 57 | .mask_ack = tx4938_irq_cp0_disable, |
66 | .disable = tx4938_irq_cp0_disable, | 58 | .unmask = tx4938_irq_cp0_enable, |
67 | .ack = tx4938_irq_cp0_mask_and_ack, | ||
68 | .end = tx4938_irq_cp0_end, | 59 | .end = tx4938_irq_cp0_end, |
69 | .set_affinity = NULL | ||
70 | }; | 60 | }; |
71 | 61 | ||
72 | #define TX4938_PIC_NAME "TX4938-PIC" | 62 | #define TX4938_PIC_NAME "TX4938-PIC" |
73 | static struct irq_chip tx4938_irq_pic_type = { | 63 | static struct irq_chip tx4938_irq_pic_type = { |
74 | .typename = TX4938_PIC_NAME, | 64 | .typename = TX4938_PIC_NAME, |
75 | .startup = tx4938_irq_pic_startup, | 65 | .ack = tx4938_irq_pic_disable, |
76 | .shutdown = tx4938_irq_pic_shutdown, | 66 | .mask = tx4938_irq_pic_disable, |
77 | .enable = tx4938_irq_pic_enable, | 67 | .mask_ack = tx4938_irq_pic_disable, |
78 | .disable = tx4938_irq_pic_disable, | 68 | .unmask = tx4938_irq_pic_enable, |
79 | .ack = tx4938_irq_pic_mask_and_ack, | ||
80 | .end = tx4938_irq_pic_end, | 69 | .end = tx4938_irq_pic_end, |
81 | .set_affinity = NULL | ||
82 | }; | 70 | }; |
83 | 71 | ||
84 | static struct irqaction tx4938_irq_pic_action = { | 72 | static struct irqaction tx4938_irq_pic_action = { |
@@ -99,56 +87,21 @@ tx4938_irq_cp0_init(void) | |||
99 | { | 87 | { |
100 | int i; | 88 | int i; |
101 | 89 | ||
102 | for (i = TX4938_IRQ_CP0_BEG; i <= TX4938_IRQ_CP0_END; i++) { | 90 | for (i = TX4938_IRQ_CP0_BEG; i <= TX4938_IRQ_CP0_END; i++) |
103 | irq_desc[i].status = IRQ_DISABLED; | 91 | set_irq_chip_and_handler(i, &tx4938_irq_cp0_type, |
104 | irq_desc[i].action = 0; | 92 | handle_level_irq); |
105 | irq_desc[i].depth = 1; | ||
106 | irq_desc[i].chip = &tx4938_irq_cp0_type; | ||
107 | } | ||
108 | } | ||
109 | |||
110 | static unsigned int | ||
111 | tx4938_irq_cp0_startup(unsigned int irq) | ||
112 | { | ||
113 | tx4938_irq_cp0_enable(irq); | ||
114 | |||
115 | return 0; | ||
116 | } | ||
117 | |||
118 | static void | ||
119 | tx4938_irq_cp0_shutdown(unsigned int irq) | ||
120 | { | ||
121 | tx4938_irq_cp0_disable(irq); | ||
122 | } | 93 | } |
123 | 94 | ||
124 | static void | 95 | static void |
125 | tx4938_irq_cp0_enable(unsigned int irq) | 96 | tx4938_irq_cp0_enable(unsigned int irq) |
126 | { | 97 | { |
127 | unsigned long flags; | ||
128 | |||
129 | spin_lock_irqsave(&tx4938_cp0_lock, flags); | ||
130 | |||
131 | set_c0_status(tx4938_irq_cp0_mask(irq)); | 98 | set_c0_status(tx4938_irq_cp0_mask(irq)); |
132 | |||
133 | spin_unlock_irqrestore(&tx4938_cp0_lock, flags); | ||
134 | } | 99 | } |
135 | 100 | ||
136 | static void | 101 | static void |
137 | tx4938_irq_cp0_disable(unsigned int irq) | 102 | tx4938_irq_cp0_disable(unsigned int irq) |
138 | { | 103 | { |
139 | unsigned long flags; | ||
140 | |||
141 | spin_lock_irqsave(&tx4938_cp0_lock, flags); | ||
142 | |||
143 | clear_c0_status(tx4938_irq_cp0_mask(irq)); | 104 | clear_c0_status(tx4938_irq_cp0_mask(irq)); |
144 | |||
145 | spin_unlock_irqrestore(&tx4938_cp0_lock, flags); | ||
146 | } | ||
147 | |||
148 | static void | ||
149 | tx4938_irq_cp0_mask_and_ack(unsigned int irq) | ||
150 | { | ||
151 | tx4938_irq_cp0_disable(irq); | ||
152 | } | 105 | } |
153 | 106 | ||
154 | static void | 107 | static void |
@@ -290,70 +243,30 @@ tx4938_irq_pic_modify(unsigned pic_reg, unsigned clr_bits, unsigned set_bits) | |||
290 | static void __init | 243 | static void __init |
291 | tx4938_irq_pic_init(void) | 244 | tx4938_irq_pic_init(void) |
292 | { | 245 | { |
293 | unsigned long flags; | ||
294 | int i; | 246 | int i; |
295 | 247 | ||
296 | for (i = TX4938_IRQ_PIC_BEG; i <= TX4938_IRQ_PIC_END; i++) { | 248 | for (i = TX4938_IRQ_PIC_BEG; i <= TX4938_IRQ_PIC_END; i++) |
297 | irq_desc[i].status = IRQ_DISABLED; | 249 | set_irq_chip_and_handler(i, &tx4938_irq_pic_type, |
298 | irq_desc[i].action = 0; | 250 | handle_level_irq); |
299 | irq_desc[i].depth = 2; | ||
300 | irq_desc[i].chip = &tx4938_irq_pic_type; | ||
301 | } | ||
302 | 251 | ||
303 | setup_irq(TX4938_IRQ_NEST_PIC_ON_CP0, &tx4938_irq_pic_action); | 252 | setup_irq(TX4938_IRQ_NEST_PIC_ON_CP0, &tx4938_irq_pic_action); |
304 | 253 | ||
305 | spin_lock_irqsave(&tx4938_pic_lock, flags); | ||
306 | |||
307 | TX4938_WR(0xff1ff640, 0x6); /* irq level mask -- only accept hightest */ | 254 | TX4938_WR(0xff1ff640, 0x6); /* irq level mask -- only accept hightest */ |
308 | TX4938_WR(0xff1ff600, TX4938_RD(0xff1ff600) | 0x1); /* irq enable */ | 255 | TX4938_WR(0xff1ff600, TX4938_RD(0xff1ff600) | 0x1); /* irq enable */ |
309 | |||
310 | spin_unlock_irqrestore(&tx4938_pic_lock, flags); | ||
311 | } | ||
312 | |||
313 | static unsigned int | ||
314 | tx4938_irq_pic_startup(unsigned int irq) | ||
315 | { | ||
316 | tx4938_irq_pic_enable(irq); | ||
317 | |||
318 | return 0; | ||
319 | } | ||
320 | |||
321 | static void | ||
322 | tx4938_irq_pic_shutdown(unsigned int irq) | ||
323 | { | ||
324 | tx4938_irq_pic_disable(irq); | ||
325 | } | 256 | } |
326 | 257 | ||
327 | static void | 258 | static void |
328 | tx4938_irq_pic_enable(unsigned int irq) | 259 | tx4938_irq_pic_enable(unsigned int irq) |
329 | { | 260 | { |
330 | unsigned long flags; | ||
331 | |||
332 | spin_lock_irqsave(&tx4938_pic_lock, flags); | ||
333 | |||
334 | tx4938_irq_pic_modify(tx4938_irq_pic_addr(irq), 0, | 261 | tx4938_irq_pic_modify(tx4938_irq_pic_addr(irq), 0, |
335 | tx4938_irq_pic_mask(irq)); | 262 | tx4938_irq_pic_mask(irq)); |
336 | |||
337 | spin_unlock_irqrestore(&tx4938_pic_lock, flags); | ||
338 | } | 263 | } |
339 | 264 | ||
340 | static void | 265 | static void |
341 | tx4938_irq_pic_disable(unsigned int irq) | 266 | tx4938_irq_pic_disable(unsigned int irq) |
342 | { | 267 | { |
343 | unsigned long flags; | ||
344 | |||
345 | spin_lock_irqsave(&tx4938_pic_lock, flags); | ||
346 | |||
347 | tx4938_irq_pic_modify(tx4938_irq_pic_addr(irq), | 268 | tx4938_irq_pic_modify(tx4938_irq_pic_addr(irq), |
348 | tx4938_irq_pic_mask(irq), 0); | 269 | tx4938_irq_pic_mask(irq), 0); |
349 | |||
350 | spin_unlock_irqrestore(&tx4938_pic_lock, flags); | ||
351 | } | ||
352 | |||
353 | static void | ||
354 | tx4938_irq_pic_mask_and_ack(unsigned int irq) | ||
355 | { | ||
356 | tx4938_irq_pic_disable(irq); | ||
357 | } | 270 | } |
358 | 271 | ||
359 | static void | 272 | static void |
diff --git a/arch/mips/tx4938/common/setup.c b/arch/mips/tx4938/common/setup.c index f415a1f18fb..dc87d92bb08 100644 --- a/arch/mips/tx4938/common/setup.c +++ b/arch/mips/tx4938/common/setup.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <asm/mipsregs.h> | 31 | #include <asm/mipsregs.h> |
32 | #include <asm/system.h> | 32 | #include <asm/system.h> |
33 | #include <asm/time.h> | 33 | #include <asm/time.h> |
34 | #include <asm/time.h> | ||
35 | #include <asm/tx4938/rbtx4938.h> | 34 | #include <asm/tx4938/rbtx4938.h> |
36 | 35 | ||
37 | extern void toshiba_rbtx4938_setup(void); | 36 | extern void toshiba_rbtx4938_setup(void); |
diff --git a/arch/mips/tx4938/toshiba_rbtx4938/irq.c b/arch/mips/tx4938/toshiba_rbtx4938/irq.c index 102e473c10a..8c87a35f306 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,36 @@ 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_and_handler(i, &toshiba_rbtx4938_irq_ioc_type, |
147 | irq_desc[i].action = 0; | 140 | handle_level_irq); |
148 | irq_desc[i].depth = 3; | ||
149 | irq_desc[i].chip = &toshiba_rbtx4938_irq_ioc_type; | ||
150 | } | ||
151 | 141 | ||
152 | setup_irq(RBTX4938_IRQ_IOCINT, | 142 | setup_irq(RBTX4938_IRQ_IOCINT, |
153 | &toshiba_rbtx4938_irq_ioc_action); | 143 | &toshiba_rbtx4938_irq_ioc_action); |
154 | } | 144 | } |
155 | 145 | ||
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 | 146 | static void |
171 | toshiba_rbtx4938_irq_ioc_enable(unsigned int irq) | 147 | toshiba_rbtx4938_irq_ioc_enable(unsigned int irq) |
172 | { | 148 | { |
173 | unsigned long flags; | ||
174 | volatile unsigned char v; | 149 | volatile unsigned char v; |
175 | 150 | ||
176 | spin_lock_irqsave(&toshiba_rbtx4938_ioc_lock, flags); | ||
177 | |||
178 | v = TX4938_RD08(TOSHIBA_RBTX4938_IOC_INTR_ENAB); | 151 | v = TX4938_RD08(TOSHIBA_RBTX4938_IOC_INTR_ENAB); |
179 | v |= (1 << (irq - TOSHIBA_RBTX4938_IRQ_IOC_BEG)); | 152 | v |= (1 << (irq - TOSHIBA_RBTX4938_IRQ_IOC_BEG)); |
180 | TX4938_WR08(TOSHIBA_RBTX4938_IOC_INTR_ENAB, v); | 153 | TX4938_WR08(TOSHIBA_RBTX4938_IOC_INTR_ENAB, v); |
181 | mmiowb(); | 154 | mmiowb(); |
182 | TX4938_RD08(TOSHIBA_RBTX4938_IOC_INTR_ENAB); | 155 | TX4938_RD08(TOSHIBA_RBTX4938_IOC_INTR_ENAB); |
183 | |||
184 | spin_unlock_irqrestore(&toshiba_rbtx4938_ioc_lock, flags); | ||
185 | } | 156 | } |
186 | 157 | ||
187 | static void | 158 | static void |
188 | toshiba_rbtx4938_irq_ioc_disable(unsigned int irq) | 159 | toshiba_rbtx4938_irq_ioc_disable(unsigned int irq) |
189 | { | 160 | { |
190 | unsigned long flags; | ||
191 | volatile unsigned char v; | 161 | volatile unsigned char v; |
192 | 162 | ||
193 | spin_lock_irqsave(&toshiba_rbtx4938_ioc_lock, flags); | ||
194 | |||
195 | v = TX4938_RD08(TOSHIBA_RBTX4938_IOC_INTR_ENAB); | 163 | v = TX4938_RD08(TOSHIBA_RBTX4938_IOC_INTR_ENAB); |
196 | v &= ~(1 << (irq - TOSHIBA_RBTX4938_IRQ_IOC_BEG)); | 164 | v &= ~(1 << (irq - TOSHIBA_RBTX4938_IRQ_IOC_BEG)); |
197 | TX4938_WR08(TOSHIBA_RBTX4938_IOC_INTR_ENAB, v); | 165 | TX4938_WR08(TOSHIBA_RBTX4938_IOC_INTR_ENAB, v); |
198 | mmiowb(); | 166 | mmiowb(); |
199 | TX4938_RD08(TOSHIBA_RBTX4938_IOC_INTR_ENAB); | 167 | 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 | } | 168 | } |
209 | 169 | ||
210 | static void | 170 | static void |
diff --git a/arch/mips/tx4938/toshiba_rbtx4938/spi_txx9.c b/arch/mips/tx4938/toshiba_rbtx4938/spi_txx9.c index b926e6a75c2..08b20cdfd7b 100644 --- a/arch/mips/tx4938/toshiba_rbtx4938/spi_txx9.c +++ b/arch/mips/tx4938/toshiba_rbtx4938/spi_txx9.c | |||
@@ -36,14 +36,18 @@ void __init txx9_spi_init(unsigned long base, int (*cs_func)(int chipid, int on) | |||
36 | 36 | ||
37 | static DECLARE_WAIT_QUEUE_HEAD(txx9_spi_wait); | 37 | static DECLARE_WAIT_QUEUE_HEAD(txx9_spi_wait); |
38 | 38 | ||
39 | static void txx9_spi_interrupt(int irq, void *dev_id) | 39 | static irqreturn_t txx9_spi_interrupt(int irq, void *dev_id) |
40 | { | 40 | { |
41 | /* disable rx intr */ | 41 | /* disable rx intr */ |
42 | tx4938_spiptr->cr0 &= ~TXx9_SPCR0_RBSIE; | 42 | tx4938_spiptr->cr0 &= ~TXx9_SPCR0_RBSIE; |
43 | wake_up(&txx9_spi_wait); | 43 | wake_up(&txx9_spi_wait); |
44 | |||
45 | return IRQ_HANDLED; | ||
44 | } | 46 | } |
47 | |||
45 | static struct irqaction txx9_spi_action = { | 48 | static struct irqaction txx9_spi_action = { |
46 | txx9_spi_interrupt, 0, 0, "spi", NULL, NULL, | 49 | .handler = txx9_spi_interrupt, |
50 | .name = "spi", | ||
47 | }; | 51 | }; |
48 | 52 | ||
49 | void __init txx9_spi_irqinit(int irc_irq) | 53 | void __init txx9_spi_irqinit(int irc_irq) |