aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68k/mac/macints.c
diff options
context:
space:
mode:
authorFinn Thain <fthain@telegraphics.com.au>2009-11-17 04:06:48 -0500
committerGeert Uytterhoeven <geert@linux-m68k.org>2010-02-27 12:31:09 -0500
commit80614e5ab1458ff3ccced4d6ba2fa386575c8d5c (patch)
treee34007d1ce2abb0c8c451764107973909798cac3 /arch/m68k/mac/macints.c
parentec9cbe09899e36b5f216c3232215520dcf0320ab (diff)
mac68k: replace mac68k SCC code with platform device
Remove the old 68k Mac serial port code and a lot of related cruft. Add new SCC platform devices to mac 68k platform. Signed-off-by: Finn Thain <fthain@telegraphics.com.au> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Diffstat (limited to 'arch/m68k/mac/macints.c')
-rw-r--r--arch/m68k/mac/macints.c101
1 files changed, 18 insertions, 83 deletions
diff --git a/arch/m68k/mac/macints.c b/arch/m68k/mac/macints.c
index 23711074e0e2..900d899f3323 100644
--- a/arch/m68k/mac/macints.c
+++ b/arch/m68k/mac/macints.c
@@ -34,9 +34,7 @@
34 * 34 *
35 * 3 - unused (?) 35 * 3 - unused (?)
36 * 36 *
37 * 4 - SCC (slot number determined by reading RR3 on the SSC itself) 37 * 4 - SCC
38 * - slot 1: SCC channel A
39 * - slot 2: SCC channel B
40 * 38 *
41 * 5 - unused (?) 39 * 5 - unused (?)
42 * [serial errors or special conditions seem to raise level 6 40 * [serial errors or special conditions seem to raise level 6
@@ -55,8 +53,6 @@
55 * - slot 5: Slot $E 53 * - slot 5: Slot $E
56 * 54 *
57 * 4 - SCC IOP 55 * 4 - SCC IOP
58 * - slot 1: SCC channel A
59 * - slot 2: SCC channel B
60 * 56 *
61 * 5 - ISM IOP (ADB?) 57 * 5 - ISM IOP (ADB?)
62 * 58 *
@@ -136,13 +132,8 @@
136#include <asm/irq_regs.h> 132#include <asm/irq_regs.h>
137#include <asm/mac_oss.h> 133#include <asm/mac_oss.h>
138 134
139#define DEBUG_SPURIOUS
140#define SHUTUP_SONIC 135#define SHUTUP_SONIC
141 136
142/* SCC interrupt mask */
143
144static int scc_mask;
145
146/* 137/*
147 * VIA/RBV hooks 138 * VIA/RBV hooks
148 */ 139 */
@@ -191,13 +182,6 @@ extern void baboon_irq_disable(int);
191extern void baboon_irq_clear(int); 182extern void baboon_irq_clear(int);
192 183
193/* 184/*
194 * SCC interrupt routines
195 */
196
197static void scc_irq_enable(unsigned int);
198static void scc_irq_disable(unsigned int);
199
200/*
201 * console_loglevel determines NMI handler function 185 * console_loglevel determines NMI handler function
202 */ 186 */
203 187
@@ -221,8 +205,6 @@ void __init mac_init_IRQ(void)
221#ifdef DEBUG_MACINTS 205#ifdef DEBUG_MACINTS
222 printk("mac_init_IRQ(): Setting things up...\n"); 206 printk("mac_init_IRQ(): Setting things up...\n");
223#endif 207#endif
224 scc_mask = 0;
225
226 m68k_setup_irq_controller(&mac_irq_controller, IRQ_USER, 208 m68k_setup_irq_controller(&mac_irq_controller, IRQ_USER,
227 NUM_MAC_SOURCES - IRQ_USER); 209 NUM_MAC_SOURCES - IRQ_USER);
228 /* Make sure the SONIC interrupt is cleared or things get ugly */ 210 /* Make sure the SONIC interrupt is cleared or things get ugly */
@@ -283,15 +265,16 @@ void mac_enable_irq(unsigned int irq)
283 via_irq_enable(irq); 265 via_irq_enable(irq);
284 break; 266 break;
285 case 3: 267 case 3:
286 case 4:
287 case 5: 268 case 5:
288 case 6: 269 case 6:
289 if (psc_present) 270 if (psc_present)
290 psc_irq_enable(irq); 271 psc_irq_enable(irq);
291 else if (oss_present) 272 else if (oss_present)
292 oss_irq_enable(irq); 273 oss_irq_enable(irq);
293 else if (irq_src == 4) 274 break;
294 scc_irq_enable(irq); 275 case 4:
276 if (psc_present)
277 psc_irq_enable(irq);
295 break; 278 break;
296 case 8: 279 case 8:
297 if (baboon_present) 280 if (baboon_present)
@@ -316,15 +299,16 @@ void mac_disable_irq(unsigned int irq)
316 via_irq_disable(irq); 299 via_irq_disable(irq);
317 break; 300 break;
318 case 3: 301 case 3:
319 case 4:
320 case 5: 302 case 5:
321 case 6: 303 case 6:
322 if (psc_present) 304 if (psc_present)
323 psc_irq_disable(irq); 305 psc_irq_disable(irq);
324 else if (oss_present) 306 else if (oss_present)
325 oss_irq_disable(irq); 307 oss_irq_disable(irq);
326 else if (irq_src == 4) 308 break;
327 scc_irq_disable(irq); 309 case 4:
310 if (psc_present)
311 psc_irq_disable(irq);
328 break; 312 break;
329 case 8: 313 case 8:
330 if (baboon_present) 314 if (baboon_present)
@@ -347,7 +331,6 @@ void mac_clear_irq(unsigned int irq)
347 via_irq_clear(irq); 331 via_irq_clear(irq);
348 break; 332 break;
349 case 3: 333 case 3:
350 case 4:
351 case 5: 334 case 5:
352 case 6: 335 case 6:
353 if (psc_present) 336 if (psc_present)
@@ -355,6 +338,10 @@ void mac_clear_irq(unsigned int irq)
355 else if (oss_present) 338 else if (oss_present)
356 oss_irq_clear(irq); 339 oss_irq_clear(irq);
357 break; 340 break;
341 case 4:
342 if (psc_present)
343 psc_irq_clear(irq);
344 break;
358 case 8: 345 case 8:
359 if (baboon_present) 346 if (baboon_present)
360 baboon_irq_clear(irq); 347 baboon_irq_clear(irq);
@@ -374,13 +361,17 @@ int mac_irq_pending(unsigned int irq)
374 else 361 else
375 return via_irq_pending(irq); 362 return via_irq_pending(irq);
376 case 3: 363 case 3:
377 case 4:
378 case 5: 364 case 5:
379 case 6: 365 case 6:
380 if (psc_present) 366 if (psc_present)
381 return psc_irq_pending(irq); 367 return psc_irq_pending(irq);
382 else if (oss_present) 368 else if (oss_present)
383 return oss_irq_pending(irq); 369 return oss_irq_pending(irq);
370 break;
371 case 4:
372 if (psc_present)
373 psc_irq_pending(irq);
374 break;
384 } 375 }
385 return 0; 376 return 0;
386} 377}
@@ -448,59 +439,3 @@ irqreturn_t mac_nmi_handler(int irq, void *dev_id)
448 in_nmi--; 439 in_nmi--;
449 return IRQ_HANDLED; 440 return IRQ_HANDLED;
450} 441}
451
452/*
453 * Simple routines for masking and unmasking
454 * SCC interrupts in cases where this can't be
455 * done in hardware (only the PSC can do that.)
456 */
457
458static void scc_irq_enable(unsigned int irq)
459{
460 int irq_idx = IRQ_IDX(irq);
461
462 scc_mask |= (1 << irq_idx);
463}
464
465static void scc_irq_disable(unsigned int irq)
466{
467 int irq_idx = IRQ_IDX(irq);
468
469 scc_mask &= ~(1 << irq_idx);
470}
471
472/*
473 * SCC master interrupt handler. We have to do a bit of magic here
474 * to figure out what channel gave us the interrupt; putting this
475 * here is cleaner than hacking it into drivers/char/macserial.c.
476 */
477
478void mac_scc_dispatch(int irq, void *dev_id)
479{
480 volatile unsigned char *scc = (unsigned char *) mac_bi_data.sccbase + 2;
481 unsigned char reg;
482 unsigned long flags;
483
484 /* Read RR3 from the chip. Always do this on channel A */
485 /* This must be an atomic operation so disable irqs. */
486
487 local_irq_save(flags);
488 *scc = 3;
489 reg = *scc;
490 local_irq_restore(flags);
491
492 /* Now dispatch. Bits 0-2 are for channel B and */
493 /* bits 3-5 are for channel A. We can safely */
494 /* ignore the remaining bits here. */
495 /* */
496 /* Note that we're ignoring scc_mask for now. */
497 /* If we actually mask the ints then we tend to */
498 /* get hammered by very persistent SCC irqs, */
499 /* and since they're autovector interrupts they */
500 /* pretty much kill the system. */
501
502 if (reg & 0x38)
503 m68k_handle_int(IRQ_SCCA);
504 if (reg & 0x07)
505 m68k_handle_int(IRQ_SCCB);
506}