1 /* Low-level parallel port routines for Archimedes onboard hardware
3 * Author: Phil Blundell <Philip.Blundell@pobox.com>
6 /* This driver is for the parallel port hardware found on Acorn's old
7 * range of Archimedes machines. The A5000 and newer systems have PC-style
8 * I/O hardware and should use the parport_pc driver instead.
10 * The Acorn printer port hardware is very simple. There is a single 8-bit
11 * write-only latch for the data port and control/status bits are handled
12 * with various auxilliary input and output lines. The port is not
13 * bidirectional, does not support any modes other than SPP, and has only
14 * a subset of the standard printer control lines connected.
17 #include <linux/tasks.h>
18 #include <linux/delay.h>
19 #include <linux/errno.h>
20 #include <linux/interrupt.h>
21 #include <linux/ioport.h>
22 #include <linux/kernel.h>
23 #include <linux/malloc.h>
24 #include <linux/parport.h>
26 #include <asm/ptrace.h>
28 #include <asm/arch/oldlatches.h>
29 #include <asm/arch/irqs.h>
31 #define DATA_LATCH 0x3350010
33 /* ARC can't read from the data latch, so we must use a soft copy. */
34 static unsigned char data_copy
;
36 static void arc_interrupt(int irq
, void *dev_id
, struct pt_regs
*regs
)
38 parport_generic_irq(irq
, (struct parport
*) dev_id
, regs
);
41 static void arc_write_data(struct parport
*p
, unsigned char data
)
44 outb(data
, DATA_LATCH
);
47 static unsigned char arc_read_data(struct parport
*p
)
52 static void arc_inc_use_count(void)
59 static void arc_dec_use_count(void)
66 static void arc_fill_inode(struct inode
*inode
, int fill
)
76 static struct parport_operations parport_arc_ops
=
85 NULL
, /* write_econtrol */
86 NULL
, /* read_econtrol */
87 NULL
, /* frob_econtrol */
92 NULL
, /* write_fifo */
95 NULL
, /* change_mode */
97 arc_release_resources
,
100 NULL
, /* epp_write_data */
101 NULL
, /* epp_read_data */
102 NULL
, /* epp_write_addr */
103 NULL
, /* epp_read_addr */
104 NULL
, /* epp_check_timeout */
106 NULL
, /* epp_write_block */
107 NULL
, /* epp_read_block */
109 NULL
, /* ecp_write_block */
110 NULL
, /* epp_write_block */
125 /* --- Initialisation code -------------------------------- */
127 int parport_arc_init(void)
129 /* Archimedes hardware provides only one port, at a fixed address */
132 if (check_region(DATA_LATCH
, 4))
135 if (!(p
= parport_register_port(base
, IRQ_PRINTERACK
,
136 PARPORT_DMA_NONE
, &parport_arc_ops
)))
139 p
->modes
= PARPORT_MODE_ARCSPP
;
142 printk(KERN_INFO
"%s: Archimedes on-board port, using irq %d\n",
144 parport_proc_register(p
);
145 p
->flags
|= PARPORT_FLAG_COMA
;
147 if (parport_probe_hook
)
148 (*parport_probe_hook
)(p
);