blob: c208e4366c033d5bc5d1c40b6d055b7c722656d4 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001The `parport' code provides parallel-port support under Linux. This
2includes the ability to share one port between multiple device
3drivers.
4
5You can pass parameters to the parport code to override its automatic
6detection of your hardware. This is particularly useful if you want
7to use IRQs, since in general these can't be autoprobed successfully.
8By default IRQs are not used even if they _can_ be probed. This is
9because there are a lot of people using the same IRQ for their
10parallel port and a sound card or network card.
11
12The parport code is split into two parts: generic (which deals with
13port-sharing) and architecture-dependent (which deals with actually
14using the port).
15
16
17Parport as modules
18==================
19
20If you load the parport code as a module, say
21
22 # insmod parport
23
24to load the generic parport code. You then must load the
25architecture-dependent code with (for example):
26
27 # insmod parport_pc io=0x3bc,0x378,0x278 irq=none,7,auto
28
29to tell the parport code that you want three PC-style ports, one at
300x3bc with no IRQ, one at 0x378 using IRQ 7, and one at 0x278 with an
31auto-detected IRQ. Currently, PC-style (parport_pc), Sun `bpp',
32Amiga, Atari, and MFC3 hardware is supported.
33
34PCI parallel I/O card support comes from parport_pc. Base I/O
35addresses should not be specified for supported PCI cards since they
36are automatically detected.
37
38
Lucas De Marchi970e2482012-03-30 13:37:16 -070039modprobe
40--------
Linus Torvalds1da177e2005-04-16 15:20:36 -070041
Lucas De Marchi970e2482012-03-30 13:37:16 -070042If you use modprobe , you will find it useful to add lines as below to a
43configuration file in /etc/modprobe.d/ directory:.
Linus Torvalds1da177e2005-04-16 15:20:36 -070044
45 alias parport_lowlevel parport_pc
46 options parport_pc io=0x378,0x278 irq=7,auto
47
Lucas De Marchi970e2482012-03-30 13:37:16 -070048modprobe will load parport_pc (with the options "io=0x378,0x278 irq=7,auto")
49whenever a parallel port device driver (such as lp) is loaded.
Linus Torvalds1da177e2005-04-16 15:20:36 -070050
51Note that these are example lines only! You shouldn't in general need
52to specify any options to parport_pc in order to be able to use a
53parallel port.
54
55
56Parport probe [optional]
57-------------
58
59In 2.2 kernels there was a module called parport_probe, which was used
60for collecting IEEE 1284 device ID information. This has now been
61enhanced and now lives with the IEEE 1284 support. When a parallel
62port is detected, the devices that are connected to it are analysed,
63and information is logged like this:
64
65 parport0: Printer, BJC-210 (Canon)
66
67The probe information is available from files in /proc/sys/dev/parport/.
68
69
70Parport linked into the kernel statically
71=========================================
72
73If you compile the parport code into the kernel, then you can use
74kernel boot parameters to get the same effect. Add something like the
75following to your LILO command line:
76
77 parport=0x3bc parport=0x378,7 parport=0x278,auto,nofifo
78
79You can have many `parport=...' statements, one for each port you want
80to add. Adding `parport=0' to the kernel command-line will disable
81parport support entirely. Adding `parport=auto' to the kernel
82command-line will make parport use any IRQ lines or DMA channels that
83it auto-detects.
84
85
86Files in /proc
87==============
88
89If you have configured the /proc filesystem into your kernel, you will
90see a new directory entry: /proc/sys/dev/parport. In there will be a
91directory entry for each parallel port for which parport is
92configured. In each of those directories are a collection of files
93describing that parallel port.
94
95The /proc/sys/dev/parport directory tree looks like:
96
97parport
98|-- default
99| |-- spintime
100| `-- timeslice
101|-- parport0
102| |-- autoprobe
103| |-- autoprobe0
104| |-- autoprobe1
105| |-- autoprobe2
106| |-- autoprobe3
107| |-- devices
108| | |-- active
109| | `-- lp
110| | `-- timeslice
111| |-- base-addr
112| |-- irq
113| |-- dma
114| |-- modes
115| `-- spintime
116`-- parport1
117 |-- autoprobe
118 |-- autoprobe0
119 |-- autoprobe1
120 |-- autoprobe2
121 |-- autoprobe3
122 |-- devices
123 | |-- active
124 | `-- ppa
125 | `-- timeslice
126 |-- base-addr
127 |-- irq
128 |-- dma
129 |-- modes
130 `-- spintime
131
132
133File: Contents:
134
135devices/active A list of the device drivers using that port. A "+"
136 will appear by the name of the device currently using
137 the port (it might not appear against any). The
138 string "none" means that there are no device drivers
139 using that port.
140
141base-addr Parallel port's base address, or addresses if the port
142 has more than one in which case they are separated
143 with tabs. These values might not have any sensible
144 meaning for some ports.
145
146irq Parallel port's IRQ, or -1 if none is being used.
147
148dma Parallel port's DMA channel, or -1 if none is being
149 used.
150
151modes Parallel port's hardware modes, comma-separated,
152 meaning:
153
154 PCSPP PC-style SPP registers are available.
155 TRISTATE Port is bidirectional.
156 COMPAT Hardware acceleration for printers is
157 available and will be used.
158 EPP Hardware acceleration for EPP protocol
159 is available and will be used.
160 ECP Hardware acceleration for ECP protocol
161 is available and will be used.
162 DMA DMA is available and will be used.
163
164 Note that the current implementation will only take
165 advantage of COMPAT and ECP modes if it has an IRQ
166 line to use.
167
168autoprobe Any IEEE-1284 device ID information that has been
169 acquired from the (non-IEEE 1284.3) device.
170
171autoprobe[0-3] IEEE 1284 device ID information retrieved from
172 daisy-chain devices that conform to IEEE 1284.3.
173
174spintime The number of microseconds to busy-loop while waiting
175 for the peripheral to respond. You might find that
176 adjusting this improves performance, depending on your
177 peripherals. This is a port-wide setting, i.e. it
178 applies to all devices on a particular port.
179
180timeslice The number of milliseconds that a device driver is
181 allowed to keep a port claimed for. This is advisory,
182 and driver can ignore it if it must.
183
184default/* The defaults for spintime and timeslice. When a new
185 port is registered, it picks up the default spintime.
186 When a new device is registered, it picks up the
187 default timeslice.
188
189Device drivers
190==============
191
192Once the parport code is initialised, you can attach device drivers to
193specific ports. Normally this happens automatically; if the lp driver
194is loaded it will create one lp device for each port found. You can
195override this, though, by using parameters either when you load the lp
196driver:
197
198 # insmod lp parport=0,2
199
200or on the LILO command line:
201
202 lp=parport0 lp=parport2
203
204Both the above examples would inform lp that you want /dev/lp0 to be
205the first parallel port, and /dev/lp1 to be the _third_ parallel port,
206with no lp device associated with the second port (parport1). Note
207that this is different to the way older kernels worked; there used to
208be a static association between the I/O port address and the device
209name, so /dev/lp0 was always the port at 0x3bc. This is no longer the
210case - if you only have one port, it will default to being /dev/lp0,
211regardless of base address.
212
213Also:
214
215 * If you selected the IEEE 1284 support at compile time, you can say
216 `lp=auto' on the kernel command line, and lp will create devices
217 only for those ports that seem to have printers attached.
218
219 * If you give PLIP the `timid' parameter, either with `plip=timid' on
220 the command line, or with `insmod plip timid=1' when using modules,
221 it will avoid any ports that seem to be in use by other devices.
222
223 * IRQ autoprobing works only for a few port types at the moment.
224
225Reporting printer problems with parport
226=======================================
227
228If you are having problems printing, please go through these steps to
229try to narrow down where the problem area is.
230
231When reporting problems with parport, really you need to give all of
232the messages that parport_pc spits out when it initialises. There are
233several code paths:
234
235o polling
236o interrupt-driven, protocol in software
237o interrupt-driven, protocol in hardware using PIO
238o interrupt-driven, protocol in hardware using DMA
239
240The kernel messages that parport_pc logs give an indication of which
241code path is being used. (They could be a lot better actually..)
242
243For normal printer protocol, having IEEE 1284 modes enabled or not
244should not make a difference.
245
246To turn off the 'protocol in hardware' code paths, disable
247CONFIG_PARPORT_PC_FIFO. Note that when they are enabled they are not
248necessarily _used_; it depends on whether the hardware is available,
249enabled by the BIOS, and detected by the driver.
250
251So, to start with, disable CONFIG_PARPORT_PC_FIFO, and load parport_pc
252with 'irq=none'. See if printing works then. It really should,
253because this is the simplest code path.
254
255If that works fine, try with 'io=0x378 irq=7' (adjust for your
256hardware), to make it use interrupt-driven in-software protocol.
257
258If _that_ works fine, then one of the hardware modes isn't working
259right. Enable CONFIG_PARPORT_PC_FIFO (no, it isn't a module option,
260and yes, it should be), set the port to ECP mode in the BIOS and note
261the DMA channel, and try with:
262
263 io=0x378 irq=7 dma=none (for PIO)
264 io=0x378 irq=7 dma=3 (for DMA)
265--
266philb@gnu.org
267tim@cyberelk.net