]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/m68k/mac/via.c
Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-omap-h63xx.git] / arch / m68k / mac / via.c
index 1bdb03c73c0f4d2c70d9e4251eb6b3280ed8ae9f..7d97ba54536e6997a5143942737653f8188ee361 100644 (file)
 #include <asm/bootinfo.h>
 #include <asm/macintosh.h>
 #include <asm/macints.h>
-#include <asm/machw.h>
 #include <asm/mac_via.h>
 #include <asm/mac_psc.h>
+#include <asm/mac_oss.h>
 
 volatile __u8 *via1, *via2;
-#if 0
-/* See note in mac_via.h about how this is possibly not useful */
-volatile long *via_memory_bogon=(long *)&via_memory_bogon;
-#endif
 int rbv_present;
 int via_alt_mapping;
 EXPORT_SYMBOL(via_alt_mapping);
@@ -66,7 +62,7 @@ static int gIER,gIFR,gBufA,gBufB;
 #define MAC_CLOCK_LOW          (MAC_CLOCK_TICK&0xFF)
 #define MAC_CLOCK_HIGH         (MAC_CLOCK_TICK>>8)
 
-/* To disable a NuBus slot on Quadras we make the slot IRQ lines outputs, set
+/* To disable a NuBus slot on Quadras we make that slot IRQ line an output set
  * high. On RBV we just use the slot interrupt enable register. On Macs with
  * genuine VIA chips we must use nubus_disabled to keep track of disabled slot
  * interrupts. When any slot IRQ is disabled we mask the (edge triggered) CA1
@@ -89,7 +85,6 @@ void via_irq_disable(int irq);
 void via_irq_clear(int irq);
 
 extern irqreturn_t mac_scc_dispatch(int, void *);
-extern int oss_present;
 
 /*
  * Initialize the VIAs
@@ -180,7 +175,7 @@ void __init via_init(void)
        via1[vT1CH] = 0;
        via1[vT2CL] = 0;
        via1[vT2CH] = 0;
-       via1[vACR] &= 0x3F;
+       via1[vACR] &= ~0xC0; /* setup T1 timer with no PB7 output */
        via1[vACR] &= ~0x03; /* disable port A & B latches */
 
        /*
@@ -203,40 +198,41 @@ void __init via_init(void)
 
        /* Everything below this point is VIA2/RBV only... */
 
-       if (oss_present) return;
+       if (oss_present)
+               return;
 
-#if 1
        /* Some machines support an alternate IRQ mapping that spreads  */
        /* Ethernet and Sound out to their own autolevel IRQs and moves */
        /* VIA1 to level 6. A/UX uses this mapping and we do too.  Note */
        /* that the IIfx emulates this alternate mapping using the OSS. */
 
-       switch(macintosh_config->ident) {
-               case MAC_MODEL_P475:
-               case MAC_MODEL_P475F:
-               case MAC_MODEL_P575:
-               case MAC_MODEL_Q605:
-               case MAC_MODEL_Q605_ACC:
-               case MAC_MODEL_C610:
-               case MAC_MODEL_Q610:
-               case MAC_MODEL_Q630:
-               case MAC_MODEL_C650:
-               case MAC_MODEL_Q650:
-               case MAC_MODEL_Q700:
-               case MAC_MODEL_Q800:
-               case MAC_MODEL_Q900:
-               case MAC_MODEL_Q950:
+       via_alt_mapping = 0;
+       if (macintosh_config->via_type == MAC_VIA_QUADRA)
+               switch (macintosh_config->ident) {
+               case MAC_MODEL_C660:
+               case MAC_MODEL_Q840:
+                       /* not applicable */
+                       break;
+               case MAC_MODEL_P588:
+               case MAC_MODEL_TV:
+               case MAC_MODEL_PB140:
+               case MAC_MODEL_PB145:
+               case MAC_MODEL_PB160:
+               case MAC_MODEL_PB165:
+               case MAC_MODEL_PB165C:
+               case MAC_MODEL_PB170:
+               case MAC_MODEL_PB180:
+               case MAC_MODEL_PB180C:
+               case MAC_MODEL_PB190:
+               case MAC_MODEL_PB520:
+                       /* not yet tested */
+                       break;
+               default:
                        via_alt_mapping = 1;
                        via1[vDirB] |= 0x40;
                        via1[vBufB] &= ~0x40;
                        break;
-               default:
-                       via_alt_mapping = 0;
-                       break;
-       }
-#else
-       via_alt_mapping = 0;
-#endif
+               }
 
        /*
         * Now initialize VIA2. For RBV we just kill all interrupts;
@@ -252,14 +248,17 @@ void __init via_init(void)
                via2[vT1CH] = 0;
                via2[vT2CL] = 0;
                via2[vT2CH] = 0;
-               via2[vACR] &= 0x3F;
+               via2[vACR] &= ~0xC0; /* setup T1 timer with no PB7 output */
                via2[vACR] &= ~0x03; /* disable port A & B latches */
        }
 
        /*
-        * Set vPCR for SCSI interrupts (but not on RBV)
+        * Set vPCR for control line interrupts (but not on RBV)
         */
        if (!rbv_present) {
+               /* For all VIA types, CA1 (SLOTS IRQ) and CB1 (ASC IRQ)
+                * are made negative edge triggered here.
+                */
                if (macintosh_config->scsi_type == MAC_SCSI_OLD) {
                        /* CB2 (IRQ) indep. input, positive edge */
                        /* CA2 (DRQ) indep. input, positive edge */
@@ -284,7 +283,8 @@ void __init via_init_clock(irq_handler_t func)
        via1[vT1CL] = MAC_CLOCK_LOW;
        via1[vT1CH] = MAC_CLOCK_HIGH;
 
-       request_irq(IRQ_MAC_TIMER_1, func, IRQ_FLG_LOCK, "timer", func);
+       if (request_irq(IRQ_MAC_TIMER_1, func, IRQ_FLG_LOCK, "timer", func))
+               pr_err("Couldn't register %s interrupt\n", "timer");
 }
 
 /*
@@ -294,25 +294,31 @@ void __init via_init_clock(irq_handler_t func)
 void __init via_register_interrupts(void)
 {
        if (via_alt_mapping) {
-               request_irq(IRQ_AUTO_1, via1_irq,
+               if (request_irq(IRQ_AUTO_1, via1_irq,
                                IRQ_FLG_LOCK|IRQ_FLG_FAST, "software",
-                               (void *) via1);
-               request_irq(IRQ_AUTO_6, via1_irq,
+                               (void *) via1))
+                       pr_err("Couldn't register %s interrupt\n", "software");
+               if (request_irq(IRQ_AUTO_6, via1_irq,
                                IRQ_FLG_LOCK|IRQ_FLG_FAST, "via1",
-                               (void *) via1);
+                               (void *) via1))
+                       pr_err("Couldn't register %s interrupt\n", "via1");
        } else {
-               request_irq(IRQ_AUTO_1, via1_irq,
+               if (request_irq(IRQ_AUTO_1, via1_irq,
                                IRQ_FLG_LOCK|IRQ_FLG_FAST, "via1",
-                               (void *) via1);
+                               (void *) via1))
+                       pr_err("Couldn't register %s interrupt\n", "via1");
        }
-       request_irq(IRQ_AUTO_2, via2_irq, IRQ_FLG_LOCK|IRQ_FLG_FAST,
-                       "via2", (void *) via2);
+       if (request_irq(IRQ_AUTO_2, via2_irq, IRQ_FLG_LOCK|IRQ_FLG_FAST,
+                       "via2", (void *) via2))
+               pr_err("Couldn't register %s interrupt\n", "via2");
        if (!psc_present) {
-               request_irq(IRQ_AUTO_4, mac_scc_dispatch, IRQ_FLG_LOCK,
-                               "scc", mac_scc_dispatch);
+               if (request_irq(IRQ_AUTO_4, mac_scc_dispatch, IRQ_FLG_LOCK,
+                               "scc", mac_scc_dispatch))
+                       pr_err("Couldn't register %s interrupt\n", "scc");
        }
-       request_irq(IRQ_MAC_NUBUS, via_nubus_irq, IRQ_FLG_LOCK|IRQ_FLG_FAST,
-                       "nubus", (void *) via2);
+       if (request_irq(IRQ_MAC_NUBUS, via_nubus_irq,
+                       IRQ_FLG_LOCK|IRQ_FLG_FAST, "nubus", (void *) via2))
+               pr_err("Couldn't register %s interrupt\n", "nubus");
 }
 
 /*
@@ -466,21 +472,6 @@ irqreturn_t via1_irq(int irq, void *dev_id)
                ++irq_num;
                irq_bit <<= 1;
        } while (events >= irq_bit);
-
-#if 0 /* freakin' pmu is doing weird stuff */
-       if (!oss_present) {
-               /* This (still) seems to be necessary to get IDE
-                  working.  However, if you enable VBL interrupts,
-                  you're screwed... */
-               /* FIXME: should we check the SLOTIRQ bit before
-                   pulling this stunt? */
-               /* No, it won't be set. that's why we're doing this. */
-               via_irq_disable(IRQ_MAC_NUBUS);
-               via_irq_clear(IRQ_MAC_NUBUS);
-               m68k_handle_int(IRQ_MAC_NUBUS);
-               via_irq_enable(IRQ_MAC_NUBUS);
-       }
-#endif
        return IRQ_HANDLED;
 }