patch-2.1.82 linux/drivers/misc/parport_arc.c

Next file: linux/drivers/misc/parport_ax.c
Previous file: linux/drivers/misc/TODO-parport
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.81/linux/drivers/misc/parport_arc.c linux/drivers/misc/parport_arc.c
@@ -1,24 +1,32 @@
-/* Parallel-port routines for ARC onboard hardware.
+/* Low-level parallel port routines for Archimedes onboard hardware
  *
  * Author: Phil Blundell <Philip.Blundell@pobox.com>
  */
 
-#include <linux/tasks.h>
-
-#include <asm/ptrace.h>
-#include <asm/io.h>
-#include <asm/dma.h>
+/* This driver is for the parallel port hardware found on Acorn's old
+ * range of Archimedes machines.  The A5000 and newer systems have PC-style
+ * I/O hardware and should use the parport_pc driver instead.
+ *
+ * The Acorn printer port hardware is very simple.  There is a single 8-bit
+ * write-only latch for the data port and control/status bits are handled
+ * with various auxilliary input and output lines.  The port is not
+ * bidirectional, does not support any modes other than SPP, and has only
+ * a subset of the standard printer control lines connected.
+ */
 
+#include <linux/tasks.h>
 #include <linux/delay.h>
 #include <linux/errno.h>
 #include <linux/interrupt.h>
 #include <linux/ioport.h>
 #include <linux/kernel.h>
 #include <linux/malloc.h>
-
 #include <linux/parport.h>
 
-#include <linux/arch/oldlatches.h>
+#include <asm/ptrace.h>
+#include <asm/io.h>
+#include <asm/arch/oldlatches.h>
+#include <asm/arch/irqs.h>
 
 #define DATA_LATCH    0x3350010
 
@@ -50,7 +58,7 @@
 #endif
 }
 
-static struct parport_operations arc_ops = 
+static struct parport_operations parport_arc_ops = 
 {
 	arc_write_data,
 	arc_read_data,
@@ -90,3 +98,31 @@
 	arc_inc_use_count,
 	arc_dec_use_count
 };
+
+/* --- Initialisation code -------------------------------- */
+
+int parport_arc_init(void)
+{
+	/* Archimedes hardware provides only one port, at a fixed address */
+	struct parport *p;
+
+	if (check_region(DATA_LATCH, 4))
+		return 0;
+	
+       	if (!(p = parport_register_port(base, IRQ_PRINTERACK, 
+					PARPORT_DMA_NONE, &parport_arc_ops))) 
+		return 0;
+
+	p->modes = PARPORT_MODE_ARCSPP;
+	p->size = 4;
+
+	printk(KERN_INFO "%s: Archimedes on-board port, using irq %d\n",
+	       p->irq);
+	parport_proc_register(p);
+	p->flags |= PARPORT_FLAG_COMA;
+
+	if (parport_probe_hook)
+		(*parport_probe_hook)(p);
+
+	return 1;
+}

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