0001 Parport
0002 +++++++
0003
0004 The ``parport`` code provides parallel-port support under Linux. This
0005 includes the ability to share one port between multiple device
0006 drivers.
0007
0008 You can pass parameters to the ``parport`` code to override its automatic
0009 detection of your hardware. This is particularly useful if you want
0010 to use IRQs, since in general these can't be autoprobed successfully.
0011 By default IRQs are not used even if they **can** be probed. This is
0012 because there are a lot of people using the same IRQ for their
0013 parallel port and a sound card or network card.
0014
0015 The ``parport`` code is split into two parts: generic (which deals with
0016 port-sharing) and architecture-dependent (which deals with actually
0017 using the port).
0018
0019
0020 Parport as modules
0021 ==================
0022
0023 If you load the `parport`` code as a module, say::
0024
0025 # insmod parport
0026
0027 to load the generic ``parport`` code. You then must load the
0028 architecture-dependent code with (for example)::
0029
0030 # insmod parport_pc io=0x3bc,0x378,0x278 irq=none,7,auto
0031
0032 to tell the ``parport`` code that you want three PC-style ports, one at
0033 0x3bc with no IRQ, one at 0x378 using IRQ 7, and one at 0x278 with an
0034 auto-detected IRQ. Currently, PC-style (``parport_pc``), Sun ``bpp``,
0035 Amiga, Atari, and MFC3 hardware is supported.
0036
0037 PCI parallel I/O card support comes from ``parport_pc``. Base I/O
0038 addresses should not be specified for supported PCI cards since they
0039 are automatically detected.
0040
0041
0042 modprobe
0043 --------
0044
0045 If you use modprobe , you will find it useful to add lines as below to a
0046 configuration file in /etc/modprobe.d/ directory::
0047
0048 alias parport_lowlevel parport_pc
0049 options parport_pc io=0x378,0x278 irq=7,auto
0050
0051 modprobe will load ``parport_pc`` (with the options ``io=0x378,0x278 irq=7,auto``)
0052 whenever a parallel port device driver (such as ``lp``) is loaded.
0053
0054 Note that these are example lines only! You shouldn't in general need
0055 to specify any options to ``parport_pc`` in order to be able to use a
0056 parallel port.
0057
0058
0059 Parport probe [optional]
0060 ------------------------
0061
0062 In 2.2 kernels there was a module called ``parport_probe``, which was used
0063 for collecting IEEE 1284 device ID information. This has now been
0064 enhanced and now lives with the IEEE 1284 support. When a parallel
0065 port is detected, the devices that are connected to it are analysed,
0066 and information is logged like this::
0067
0068 parport0: Printer, BJC-210 (Canon)
0069
0070 The probe information is available from files in ``/proc/sys/dev/parport/``.
0071
0072
0073 Parport linked into the kernel statically
0074 =========================================
0075
0076 If you compile the ``parport`` code into the kernel, then you can use
0077 kernel boot parameters to get the same effect. Add something like the
0078 following to your LILO command line::
0079
0080 parport=0x3bc parport=0x378,7 parport=0x278,auto,nofifo
0081
0082 You can have many ``parport=...`` statements, one for each port you want
0083 to add. Adding ``parport=0`` to the kernel command-line will disable
0084 parport support entirely. Adding ``parport=auto`` to the kernel
0085 command-line will make ``parport`` use any IRQ lines or DMA channels that
0086 it auto-detects.
0087
0088
0089 Files in /proc
0090 ==============
0091
0092 If you have configured the ``/proc`` filesystem into your kernel, you will
0093 see a new directory entry: ``/proc/sys/dev/parport``. In there will be a
0094 directory entry for each parallel port for which parport is
0095 configured. In each of those directories are a collection of files
0096 describing that parallel port.
0097
0098 The ``/proc/sys/dev/parport`` directory tree looks like::
0099
0100 parport
0101 |-- default
0102 | |-- spintime
0103 | `-- timeslice
0104 |-- parport0
0105 | |-- autoprobe
0106 | |-- autoprobe0
0107 | |-- autoprobe1
0108 | |-- autoprobe2
0109 | |-- autoprobe3
0110 | |-- devices
0111 | | |-- active
0112 | | `-- lp
0113 | | `-- timeslice
0114 | |-- base-addr
0115 | |-- irq
0116 | |-- dma
0117 | |-- modes
0118 | `-- spintime
0119 `-- parport1
0120 |-- autoprobe
0121 |-- autoprobe0
0122 |-- autoprobe1
0123 |-- autoprobe2
0124 |-- autoprobe3
0125 |-- devices
0126 | |-- active
0127 | `-- ppa
0128 | `-- timeslice
0129 |-- base-addr
0130 |-- irq
0131 |-- dma
0132 |-- modes
0133 `-- spintime
0134
0135 .. tabularcolumns:: |p{4.0cm}|p{13.5cm}|
0136
0137 ======================= =======================================================
0138 File Contents
0139 ======================= =======================================================
0140 ``devices/active`` A list of the device drivers using that port. A "+"
0141 will appear by the name of the device currently using
0142 the port (it might not appear against any). The
0143 string "none" means that there are no device drivers
0144 using that port.
0145
0146 ``base-addr`` Parallel port's base address, or addresses if the port
0147 has more than one in which case they are separated
0148 with tabs. These values might not have any sensible
0149 meaning for some ports.
0150
0151 ``irq`` Parallel port's IRQ, or -1 if none is being used.
0152
0153 ``dma`` Parallel port's DMA channel, or -1 if none is being
0154 used.
0155
0156 ``modes`` Parallel port's hardware modes, comma-separated,
0157 meaning:
0158
0159 - PCSPP
0160 PC-style SPP registers are available.
0161
0162 - TRISTATE
0163 Port is bidirectional.
0164
0165 - COMPAT
0166 Hardware acceleration for printers is
0167 available and will be used.
0168
0169 - EPP
0170 Hardware acceleration for EPP protocol
0171 is available and will be used.
0172
0173 - ECP
0174 Hardware acceleration for ECP protocol
0175 is available and will be used.
0176
0177 - DMA
0178 DMA is available and will be used.
0179
0180 Note that the current implementation will only take
0181 advantage of COMPAT and ECP modes if it has an IRQ
0182 line to use.
0183
0184 ``autoprobe`` Any IEEE-1284 device ID information that has been
0185 acquired from the (non-IEEE 1284.3) device.
0186
0187 ``autoprobe[0-3]`` IEEE 1284 device ID information retrieved from
0188 daisy-chain devices that conform to IEEE 1284.3.
0189
0190 ``spintime`` The number of microseconds to busy-loop while waiting
0191 for the peripheral to respond. You might find that
0192 adjusting this improves performance, depending on your
0193 peripherals. This is a port-wide setting, i.e. it
0194 applies to all devices on a particular port.
0195
0196 ``timeslice`` The number of milliseconds that a device driver is
0197 allowed to keep a port claimed for. This is advisory,
0198 and driver can ignore it if it must.
0199
0200 ``default/*`` The defaults for spintime and timeslice. When a new
0201 port is registered, it picks up the default spintime.
0202 When a new device is registered, it picks up the
0203 default timeslice.
0204 ======================= =======================================================
0205
0206 Device drivers
0207 ==============
0208
0209 Once the parport code is initialised, you can attach device drivers to
0210 specific ports. Normally this happens automatically; if the lp driver
0211 is loaded it will create one lp device for each port found. You can
0212 override this, though, by using parameters either when you load the lp
0213 driver::
0214
0215 # insmod lp parport=0,2
0216
0217 or on the LILO command line::
0218
0219 lp=parport0 lp=parport2
0220
0221 Both the above examples would inform lp that you want ``/dev/lp0`` to be
0222 the first parallel port, and /dev/lp1 to be the **third** parallel port,
0223 with no lp device associated with the second port (parport1). Note
0224 that this is different to the way older kernels worked; there used to
0225 be a static association between the I/O port address and the device
0226 name, so ``/dev/lp0`` was always the port at 0x3bc. This is no longer the
0227 case - if you only have one port, it will default to being ``/dev/lp0``,
0228 regardless of base address.
0229
0230 Also:
0231
0232 * If you selected the IEEE 1284 support at compile time, you can say
0233 ``lp=auto`` on the kernel command line, and lp will create devices
0234 only for those ports that seem to have printers attached.
0235
0236 * If you give PLIP the ``timid`` parameter, either with ``plip=timid`` on
0237 the command line, or with ``insmod plip timid=1`` when using modules,
0238 it will avoid any ports that seem to be in use by other devices.
0239
0240 * IRQ autoprobing works only for a few port types at the moment.
0241
0242 Reporting printer problems with parport
0243 =======================================
0244
0245 If you are having problems printing, please go through these steps to
0246 try to narrow down where the problem area is.
0247
0248 When reporting problems with parport, really you need to give all of
0249 the messages that ``parport_pc`` spits out when it initialises. There are
0250 several code paths:
0251
0252 - polling
0253 - interrupt-driven, protocol in software
0254 - interrupt-driven, protocol in hardware using PIO
0255 - interrupt-driven, protocol in hardware using DMA
0256
0257 The kernel messages that ``parport_pc`` logs give an indication of which
0258 code path is being used. (They could be a lot better actually..)
0259
0260 For normal printer protocol, having IEEE 1284 modes enabled or not
0261 should not make a difference.
0262
0263 To turn off the 'protocol in hardware' code paths, disable
0264 ``CONFIG_PARPORT_PC_FIFO``. Note that when they are enabled they are not
0265 necessarily **used**; it depends on whether the hardware is available,
0266 enabled by the BIOS, and detected by the driver.
0267
0268 So, to start with, disable ``CONFIG_PARPORT_PC_FIFO``, and load ``parport_pc``
0269 with ``irq=none``. See if printing works then. It really should,
0270 because this is the simplest code path.
0271
0272 If that works fine, try with ``io=0x378 irq=7`` (adjust for your
0273 hardware), to make it use interrupt-driven in-software protocol.
0274
0275 If **that** works fine, then one of the hardware modes isn't working
0276 right. Enable ``CONFIG_FIFO`` (no, it isn't a module option,
0277 and yes, it should be), set the port to ECP mode in the BIOS and note
0278 the DMA channel, and try with::
0279
0280 io=0x378 irq=7 dma=none (for PIO)
0281 io=0x378 irq=7 dma=3 (for DMA)
0282
0283 ----------
0284
0285 philb@gnu.org
0286 tim@cyberelk.net