Blame view

Documentation/admin-guide/parport.rst 9.28 KB
e095f0711   Mauro Carvalho Chehab   Documentation/par...
1
2
3
4
  Parport
  +++++++
  
  The ``parport`` code provides parallel-port support under Linux.  This
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
5
6
  includes the ability to share one port between multiple device
  drivers.
e095f0711   Mauro Carvalho Chehab   Documentation/par...
7
  You can pass parameters to the ``parport`` code to override its automatic
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
8
9
  detection of your hardware.  This is particularly useful if you want
  to use IRQs, since in general these can't be autoprobed successfully.
e095f0711   Mauro Carvalho Chehab   Documentation/par...
10
  By default IRQs are not used even if they **can** be probed.  This is
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
11
12
  because there are a lot of people using the same IRQ for their
  parallel port and a sound card or network card.
e095f0711   Mauro Carvalho Chehab   Documentation/par...
13
  The ``parport`` code is split into two parts: generic (which deals with
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
14
15
16
17
18
19
  port-sharing) and architecture-dependent (which deals with actually
  using the port).
  
  
  Parport as modules
  ==================
e095f0711   Mauro Carvalho Chehab   Documentation/par...
20
  If you load the `parport`` code as a module, say::
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
21
22
  
  	# insmod parport
e095f0711   Mauro Carvalho Chehab   Documentation/par...
23
24
  to load the generic ``parport`` code.  You then must load the
  architecture-dependent code with (for example)::
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
25
26
  
  	# insmod parport_pc io=0x3bc,0x378,0x278 irq=none,7,auto
e095f0711   Mauro Carvalho Chehab   Documentation/par...
27
  to tell the ``parport`` code that you want three PC-style ports, one at
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
28
  0x3bc with no IRQ, one at 0x378 using IRQ 7, and one at 0x278 with an
e095f0711   Mauro Carvalho Chehab   Documentation/par...
29
  auto-detected IRQ.  Currently, PC-style (``parport_pc``), Sun ``bpp``,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
30
  Amiga, Atari, and MFC3 hardware is supported.
e095f0711   Mauro Carvalho Chehab   Documentation/par...
31
  PCI parallel I/O card support comes from ``parport_pc``.  Base I/O
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
32
33
  addresses should not be specified for supported PCI cards since they
  are automatically detected.
970e24864   Lucas De Marchi   Documentation: re...
34
35
  modprobe
  --------
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
36

970e24864   Lucas De Marchi   Documentation: re...
37
  If you use modprobe , you will find it useful to add lines as below to a
e095f0711   Mauro Carvalho Chehab   Documentation/par...
38
  configuration file in /etc/modprobe.d/ directory::
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
39
40
41
  
  	alias parport_lowlevel parport_pc
  	options parport_pc io=0x378,0x278 irq=7,auto
e095f0711   Mauro Carvalho Chehab   Documentation/par...
42
43
  modprobe will load ``parport_pc`` (with the options ``io=0x378,0x278 irq=7,auto``)
  whenever a parallel port device driver (such as ``lp``) is loaded.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
44
45
  
  Note that these are example lines only!  You shouldn't in general need
e095f0711   Mauro Carvalho Chehab   Documentation/par...
46
  to specify any options to ``parport_pc`` in order to be able to use a
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
47
48
49
50
  parallel port.
  
  
  Parport probe [optional]
e095f0711   Mauro Carvalho Chehab   Documentation/par...
51
  ------------------------
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
52

e095f0711   Mauro Carvalho Chehab   Documentation/par...
53
  In 2.2 kernels there was a module called ``parport_probe``, which was used
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
54
55
56
  for collecting IEEE 1284 device ID information.  This has now been
  enhanced and now lives with the IEEE 1284 support.  When a parallel
  port is detected, the devices that are connected to it are analysed,
e095f0711   Mauro Carvalho Chehab   Documentation/par...
57
  and information is logged like this::
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
58
59
  
  	parport0: Printer, BJC-210 (Canon)
e095f0711   Mauro Carvalho Chehab   Documentation/par...
60
  The probe information is available from files in ``/proc/sys/dev/parport/``.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
61
62
63
64
  
  
  Parport linked into the kernel statically
  =========================================
e095f0711   Mauro Carvalho Chehab   Documentation/par...
65
  If you compile the ``parport`` code into the kernel, then you can use
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
66
  kernel boot parameters to get the same effect.  Add something like the
e095f0711   Mauro Carvalho Chehab   Documentation/par...
67
  following to your LILO command line::
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
68
69
  
  	parport=0x3bc parport=0x378,7 parport=0x278,auto,nofifo
e095f0711   Mauro Carvalho Chehab   Documentation/par...
70
71
72
73
  You can have many ``parport=...`` statements, one for each port you want
  to add.  Adding ``parport=0`` to the kernel command-line will disable
  parport support entirely.  Adding ``parport=auto`` to the kernel
  command-line will make ``parport`` use any IRQ lines or DMA channels that
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
74
75
76
77
78
  it auto-detects.
  
  
  Files in /proc
  ==============
e095f0711   Mauro Carvalho Chehab   Documentation/par...
79
80
  If you have configured the ``/proc`` filesystem into your kernel, you will
  see a new directory entry: ``/proc/sys/dev/parport``.  In there will be a
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
81
82
83
  directory entry for each parallel port for which parport is
  configured.  In each of those directories are a collection of files
  describing that parallel port.
e095f0711   Mauro Carvalho Chehab   Documentation/par...
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
  The ``/proc/sys/dev/parport`` directory tree looks like::
  
  	parport
  	|-- default
  	|   |-- spintime
  	|   `-- timeslice
  	|-- parport0
  	|   |-- autoprobe
  	|   |-- autoprobe0
  	|   |-- autoprobe1
  	|   |-- autoprobe2
  	|   |-- autoprobe3
  	|   |-- devices
  	|   |   |-- active
  	|   |   `-- lp
  	|   |       `-- timeslice
  	|   |-- base-addr
  	|   |-- irq
  	|   |-- dma
  	|   |-- modes
  	|   `-- spintime
  	`-- parport1
  	|-- autoprobe
  	|-- autoprobe0
  	|-- autoprobe1
  	|-- autoprobe2
  	|-- autoprobe3
  	|-- devices
  	|   |-- active
  	|   `-- ppa
  	|       `-- timeslice
  	|-- base-addr
  	|-- irq
  	|-- dma
  	|-- modes
  	`-- spintime
35a1beb9c   Mauro Carvalho Chehab   Documentation/par...
120
  .. tabularcolumns:: |p{4.0cm}|p{13.5cm}|
e095f0711   Mauro Carvalho Chehab   Documentation/par...
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
  =======================	=======================================================
  File			Contents
  =======================	=======================================================
  ``devices/active``	A list of the device drivers using that port.  A "+"
  			will appear by the name of the device currently using
  			the port (it might not appear against any).  The
  			string "none" means that there are no device drivers
  			using that port.
  
  ``base-addr``		Parallel port's base address, or addresses if the port
  			has more than one in which case they are separated
  			with tabs.  These values might not have any sensible
  			meaning for some ports.
  
  ``irq``			Parallel port's IRQ, or -1 if none is being used.
  
  ``dma``			Parallel port's DMA channel, or -1 if none is being
  			used.
  
  ``modes``		Parallel port's hardware modes, comma-separated,
  			meaning:
35a1beb9c   Mauro Carvalho Chehab   Documentation/par...
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
  			- PCSPP
  				PC-style SPP registers are available.
  
  			- TRISTATE
  				Port is bidirectional.
  
  			- COMPAT
  				Hardware acceleration for printers is
  				available and will be used.
  
  			- EPP
  				Hardware acceleration for EPP protocol
  				is available and will be used.
  
  			- ECP
  				Hardware acceleration for ECP protocol
  				is available and will be used.
  
  			- DMA
  				DMA is available and will be used.
e095f0711   Mauro Carvalho Chehab   Documentation/par...
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
  
  			Note that the current implementation will only take
  			advantage of COMPAT and ECP modes if it has an IRQ
  			line to use.
  
  ``autoprobe``		Any IEEE-1284 device ID information that has been
  			acquired from the (non-IEEE 1284.3) device.
  
  ``autoprobe[0-3]``	IEEE 1284 device ID information retrieved from
  			daisy-chain devices that conform to IEEE 1284.3.
  
  ``spintime``		The number of microseconds to busy-loop while waiting
  			for the peripheral to respond.  You might find that
  			adjusting this improves performance, depending on your
  			peripherals.  This is a port-wide setting, i.e. it
  			applies to all devices on a particular port.
  
  ``timeslice``		The number of milliseconds that a device driver is
  			allowed to keep a port claimed for.  This is advisory,
  			and driver can ignore it if it must.
  
  ``default/*``		The defaults for spintime and timeslice. When a new
  			port is	registered, it picks up the default spintime.
  			When a new device is registered, it picks up the
  			default timeslice.
  =======================	=======================================================
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
188
189
190
191
192
193
194
195
  
  Device drivers
  ==============
  
  Once the parport code is initialised, you can attach device drivers to
  specific ports.  Normally this happens automatically; if the lp driver
  is loaded it will create one lp device for each port found.  You can
  override this, though, by using parameters either when you load the lp
e095f0711   Mauro Carvalho Chehab   Documentation/par...
196
  driver::
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
197
198
  
  	# insmod lp parport=0,2
e095f0711   Mauro Carvalho Chehab   Documentation/par...
199
  or on the LILO command line::
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
200
201
  
  	lp=parport0 lp=parport2
e095f0711   Mauro Carvalho Chehab   Documentation/par...
202
203
  Both the above examples would inform lp that you want ``/dev/lp0`` to be
  the first parallel port, and /dev/lp1 to be the **third** parallel port,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
204
205
206
  with no lp device associated with the second port (parport1).  Note
  that this is different to the way older kernels worked; there used to
  be a static association between the I/O port address and the device
e095f0711   Mauro Carvalho Chehab   Documentation/par...
207
208
  name, so ``/dev/lp0`` was always the port at 0x3bc.  This is no longer the
  case - if you only have one port, it will default to being ``/dev/lp0``,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
209
210
211
212
213
  regardless of base address.
  
  Also:
  
   * If you selected the IEEE 1284 support at compile time, you can say
e095f0711   Mauro Carvalho Chehab   Documentation/par...
214
     ``lp=auto`` on the kernel command line, and lp will create devices
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
215
     only for those ports that seem to have printers attached.
e095f0711   Mauro Carvalho Chehab   Documentation/par...
216
217
   * If you give PLIP the ``timid`` parameter, either with ``plip=timid`` on
     the command line, or with ``insmod plip timid=1`` when using modules,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
218
219
220
221
222
223
224
225
226
227
228
     it will avoid any ports that seem to be in use by other devices.
  
   * IRQ autoprobing works only for a few port types at the moment.
  
  Reporting printer problems with parport
  =======================================
  
  If you are having problems printing, please go through these steps to
  try to narrow down where the problem area is.
  
  When reporting problems with parport, really you need to give all of
e095f0711   Mauro Carvalho Chehab   Documentation/par...
229
  the messages that ``parport_pc`` spits out when it initialises.  There are
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
230
  several code paths:
e095f0711   Mauro Carvalho Chehab   Documentation/par...
231
232
233
234
  - polling
  - interrupt-driven, protocol in software
  - interrupt-driven, protocol in hardware using PIO
  - interrupt-driven, protocol in hardware using DMA
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
235

e095f0711   Mauro Carvalho Chehab   Documentation/par...
236
  The kernel messages that ``parport_pc`` logs give an indication of which
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
237
238
239
240
241
242
  code path is being used. (They could be a lot better actually..)
  
  For normal printer protocol, having IEEE 1284 modes enabled or not
  should not make a difference.
  
  To turn off the 'protocol in hardware' code paths, disable
e095f0711   Mauro Carvalho Chehab   Documentation/par...
243
244
  ``CONFIG_PARPORT_PC_FIFO``.  Note that when they are enabled they are not
  necessarily **used**; it depends on whether the hardware is available,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
245
  enabled by the BIOS, and detected by the driver.
e095f0711   Mauro Carvalho Chehab   Documentation/par...
246
247
  So, to start with, disable ``CONFIG_PARPORT_PC_FIFO``, and load ``parport_pc``
  with ``irq=none``. See if printing works then.  It really should,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
248
  because this is the simplest code path.
e095f0711   Mauro Carvalho Chehab   Documentation/par...
249
  If that works fine, try with ``io=0x378 irq=7`` (adjust for your
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
250
  hardware), to make it use interrupt-driven in-software protocol.
e095f0711   Mauro Carvalho Chehab   Documentation/par...
251
252
  If **that** works fine, then one of the hardware modes isn't working
  right.  Enable ``CONFIG_FIFO`` (no, it isn't a module option,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
253
  and yes, it should be), set the port to ECP mode in the BIOS and note
e095f0711   Mauro Carvalho Chehab   Documentation/par...
254
  the DMA channel, and try with::
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
255
256
257
  
      io=0x378 irq=7 dma=none (for PIO)
      io=0x378 irq=7 dma=3 (for DMA)
e095f0711   Mauro Carvalho Chehab   Documentation/par...
258
259
  
  ----------
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
260
261
  philb@gnu.org
  tim@cyberelk.net