patch-2.1.113 linux/drivers/char/lp_intern.c

Next file: linux/drivers/char/lp_m68k.c
Previous file: linux/drivers/char/dsp56k.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.112/linux/drivers/char/lp_intern.c linux/drivers/char/lp_intern.c
@@ -32,6 +32,12 @@
 #include <asm/atarihw.h>
 #include <asm/atariints.h>
 #endif
+#ifdef CONFIG_MVME16x
+#include <asm/mvme16xhw.h>
+#endif
+#ifdef CONFIG_BVME6000
+#include<asm/bvme6000hw.h>
+#endif
 #include <linux/lp_intern.h>
 
 static int minor = -1;
@@ -71,6 +77,25 @@
 	 break;
        }
 #endif
+#ifdef CONFIG_MVME16x
+    case MACH_MVME16x:
+      {
+	int wait = 0;
+	while (wait != lp_table[dev]->wait) wait++;
+        mvmelp.data = c;
+        break;
+      }
+#endif
+#ifdef CONFIG_BVME6000
+    case MACH_BVME6000:
+      {
+	int wait = 0;
+	while (wait != lp_table[dev]->wait) wait++;
+        bvmepit.padr = c;
+        bvmepit.pacr |= 0x02;
+        break;
+      }
+#endif
     }
 }
 
@@ -87,6 +112,14 @@
     case MACH_ATARI:
       return mfp.par_dt_reg & 1;
 #endif
+#ifdef CONFIG_MVME16x
+    case MACH_MVME16x:
+      return mvmelp.isr & 1;
+#endif
+#ifdef CONFIG_BVME6000
+    case MACH_BVME6000:
+      return 0 /* !(bvmepit.psr & 0x40) */ ;
+#endif
     default:
       return 0;
     }
@@ -103,6 +136,15 @@
 #endif
 #ifdef CONFIG_ATARI
     case MACH_ATARI:
+      return 0;
+#endif
+#ifdef CONFIG_MVME16x
+    case MACH_MVME16x:
+      return mvmelp.isr & 2;
+#endif
+#ifdef CONFIG_BVME6000
+    case MACH_BVME6000:
+      return 0;
 #endif
     default:
       return 0;
@@ -122,6 +164,14 @@
     case MACH_ATARI:
       return !(mfp.par_dt_reg & 1);
 #endif
+#ifdef CONFIG_MVME16x
+    case MACH_MVME16x:
+      return mvmelp.isr & 4;
+#endif
+#ifdef CONFIG_BVME6000
+    case MACH_BVME6000:
+      return 1;
+#endif
     default:
       return 0;
     }
@@ -129,6 +179,14 @@
 
 static void lp_int_interrupt(int irq, void *data, struct pt_regs *fp)
 {
+#ifdef CONFIG_MVME16x
+  if (MACH_IS_MVME16x)
+    mvmelp.ack_icr |= 0x08;
+#endif
+#ifdef CONFIG_BVME6000
+  if (MACH_IS_BVME6000)
+    bvmepit.pacr &= ~0x02;
+#endif
   lp_interrupt(minor);
 }
 
@@ -193,6 +251,62 @@
       tab.type = LP_ATARI;
     }
 #endif
+#ifdef CONFIG_MAC
+    if (MACH_IS_MAC)
+    	return -ENODEV;
+#endif
+#ifdef CONFIG_MVME16x
+    if (MACH_IS_MVME16x)
+    {
+      unsigned long flags;
+
+      if (!(mvme16x_config & MVME16x_CONFIG_GOT_LP))
+        return -ENODEV;
+
+      save_flags(flags);
+      cli();
+      mvmelp.ack_icr = 0x08;
+      mvmelp.flt_icr = 0x08;
+      mvmelp.sel_icr = 0x08;
+      mvmelp.pe_icr =  0x08;
+      mvmelp.bsy_icr = 0x08;
+      mvmelp.cr =      0x10;
+      mvmelp.ack_icr = 0xd9; /* Int on trailing edge of ACK */
+      restore_flags(flags);
+
+      if (lp_irq)
+        tab.irq = request_irq(MVME167_IRQ_PRN, lp_int_interrupt,
+          0, "builtin printer port", lp_int_interrupt);
+      tab.base = (void *)&mvmelp; /* dummy, not used */
+      tab.type = LP_MVME167;
+    }
+#endif
+#ifdef CONFIG_BVME6000
+    if (MACH_IS_BVME6000)
+    {
+      unsigned long flags;
+
+      save_flags(flags);
+      cli();
+      bvmepit.pgcr =   0x0f;
+      bvmepit.psrr =   0x18;
+      bvmepit.paddr =  0xff;
+      bvmepit.pcdr  =  (bvmepit.pcdr & 0xfc) | 0x02;
+      bvmepit.pcddr |= 0x03;
+      bvmepit.pacr =   0x78;
+      bvmepit.pbcr =   0x00;
+      bvmepit.pivr =   BVME_IRQ_PRN;
+      bvmepit.pgcr =   0x1f;
+      restore_flags(flags);
+
+      if (lp_irq)
+        tab.irq = request_irq(BVME_IRQ_PRN, lp_int_interrupt,
+          0, "builtin printer port", lp_int_interrupt);
+      tab.base = (void *)&bvmepit; /* dummy, not used */
+      tab.type = LP_BVME6000;
+    }
+#endif
+
 
   if ((minor = register_parallel(&tab, minor)) < 0) {
     printk("builtin lp init: cant get a minor\n");
@@ -205,6 +319,14 @@
       if (MACH_IS_ATARI)
 	free_irq(IRQ_MFP_BUSY, lp_int_interrupt);
 #endif
+#ifdef CONFIG_MVME16x
+      if (MACH_IS_MVME16x)
+        free_irq(MVME167_IRQ_PRN, lp_int_interrupt);
+#endif
+#ifdef CONFIG_BVME6000
+      if (MACH_IS_BVME6000)
+        free_irq(BVME_IRQ_PRN, lp_int_interrupt);
+#endif
     }
     return -ENODEV;
   }
@@ -228,6 +350,14 @@
 #ifdef CONFIG_ATARI
   if (MACH_IS_ATARI)
     free_irq(IRQ_MFP_BUSY, lp_int_interrupt);
+#endif
+#ifdef CONFIG_MVME16x
+  if (MACH_IS_MVME16x)
+    free_irq(MVME167_IRQ_PRN, lp_int_interrupt);
+#endif
+#ifdef CONFIG_BVME6000
+  if (MACH_IS_BVME6000)
+    free_irq(BVME_IRQ_PRN, lp_int_interrupt);
 #endif
 }
 unregister_parallel(minor);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov