brintos

brintos / linux-shallow public Read only

0
0
Text · 9.3 KiB · ad3f9b8 Raw
287 lines · plain
1Parport2+++++++3 4The ``parport`` code provides parallel-port support under Linux.  This5includes the ability to share one port between multiple device6drivers.7 8You can pass parameters to the ``parport`` code to override its automatic9detection of your hardware.  This is particularly useful if you want10to use IRQs, since in general these can't be autoprobed successfully.11By default IRQs are not used even if they **can** be probed.  This is12because there are a lot of people using the same IRQ for their13parallel port and a sound card or network card.14 15The ``parport`` code is split into two parts: generic (which deals with16port-sharing) and architecture-dependent (which deals with actually17using the port).18 19 20Parport as modules21==================22 23If you load the `parport`` code as a module, say::24 25	# insmod parport26 27to load the generic ``parport`` code.  You then must load the28architecture-dependent code with (for example)::29 30	# insmod parport_pc io=0x3bc,0x378,0x278 irq=none,7,auto31 32to tell the ``parport`` code that you want three PC-style ports, one at330x3bc with no IRQ, one at 0x378 using IRQ 7, and one at 0x278 with an34auto-detected IRQ.  Currently, PC-style (``parport_pc``), Sun ``bpp``,35Amiga, Atari, and MFC3 hardware is supported.36 37PCI parallel I/O card support comes from ``parport_pc``.  Base I/O38addresses should not be specified for supported PCI cards since they39are automatically detected.40 41 42modprobe43--------44 45If you use modprobe , you will find it useful to add lines as below to a46configuration file in /etc/modprobe.d/ directory::47 48	alias parport_lowlevel parport_pc49	options parport_pc io=0x378,0x278 irq=7,auto50 51modprobe will load ``parport_pc`` (with the options ``io=0x378,0x278 irq=7,auto``)52whenever a parallel port device driver (such as ``lp``) is loaded.53 54Note that these are example lines only!  You shouldn't in general need55to specify any options to ``parport_pc`` in order to be able to use a56parallel port.57 58 59Parport probe [optional]60------------------------61 62In 2.2 kernels there was a module called ``parport_probe``, which was used63for collecting IEEE 1284 device ID information.  This has now been64enhanced and now lives with the IEEE 1284 support.  When a parallel65port is detected, the devices that are connected to it are analysed,66and information is logged like this::67 68	parport0: Printer, BJC-210 (Canon)69 70The probe information is available from files in ``/proc/sys/dev/parport/``.71 72 73Parport linked into the kernel statically74=========================================75 76If you compile the ``parport`` code into the kernel, then you can use77kernel boot parameters to get the same effect.  Add something like the78following to your LILO command line::79 80	parport=0x3bc parport=0x378,7 parport=0x278,auto,nofifo81 82You can have many ``parport=...`` statements, one for each port you want83to add.  Adding ``parport=0`` to the kernel command-line will disable84parport support entirely.  Adding ``parport=auto`` to the kernel85command-line will make ``parport`` use any IRQ lines or DMA channels that86it auto-detects.87 88 89Files in /proc90==============91 92If you have configured the ``/proc`` filesystem into your kernel, you will93see a new directory entry: ``/proc/sys/dev/parport``.  In there will be a94directory entry for each parallel port for which parport is95configured.  In each of those directories are a collection of files96describing that parallel port.97 98The ``/proc/sys/dev/parport`` directory tree looks like::99 100	parport101	|-- default102	|   |-- spintime103	|   `-- timeslice104	|-- parport0105	|   |-- autoprobe106	|   |-- autoprobe0107	|   |-- autoprobe1108	|   |-- autoprobe2109	|   |-- autoprobe3110	|   |-- devices111	|   |   |-- active112	|   |   `-- lp113	|   |       `-- timeslice114	|   |-- base-addr115	|   |-- irq116	|   |-- dma117	|   |-- modes118	|   `-- spintime119	`-- parport1120	|-- autoprobe121	|-- autoprobe0122	|-- autoprobe1123	|-- autoprobe2124	|-- autoprobe3125	|-- devices126	|   |-- active127	|   `-- ppa128	|       `-- timeslice129	|-- base-addr130	|-- irq131	|-- dma132	|-- modes133	`-- spintime134 135.. tabularcolumns:: |p{4.0cm}|p{13.5cm}|136 137=======================	=======================================================138File			Contents139=======================	=======================================================140``devices/active``	A list of the device drivers using that port.  A "+"141			will appear by the name of the device currently using142			the port (it might not appear against any).  The143			string "none" means that there are no device drivers144			using that port.145 146``base-addr``		Parallel port's base address, or addresses if the port147			has more than one in which case they are separated148			with tabs.  These values might not have any sensible149			meaning for some ports.150 151``irq``			Parallel port's IRQ, or -1 if none is being used.152 153``dma``			Parallel port's DMA channel, or -1 if none is being154			used.155 156``modes``		Parallel port's hardware modes, comma-separated,157			meaning:158 159			- PCSPP160				PC-style SPP registers are available.161 162			- TRISTATE163				Port is bidirectional.164 165			- COMPAT166				Hardware acceleration for printers is167				available and will be used.168 169			- EPP170				Hardware acceleration for EPP protocol171				is available and will be used.172 173			- ECP174				Hardware acceleration for ECP protocol175				is available and will be used.176 177			- DMA178				DMA is available and will be used.179 180			Note that the current implementation will only take181			advantage of COMPAT and ECP modes if it has an IRQ182			line to use.183 184``autoprobe``		Any IEEE-1284 device ID information that has been185			acquired from the (non-IEEE 1284.3) device.186 187``autoprobe[0-3]``	IEEE 1284 device ID information retrieved from188			daisy-chain devices that conform to IEEE 1284.3.189 190``spintime``		The number of microseconds to busy-loop while waiting191			for the peripheral to respond.  You might find that192			adjusting this improves performance, depending on your193			peripherals.  This is a port-wide setting, i.e. it194			applies to all devices on a particular port.195 196``timeslice``		The number of milliseconds that a device driver is197			allowed to keep a port claimed for.  This is advisory,198			and driver can ignore it if it must.199 200``default/*``		The defaults for spintime and timeslice. When a new201			port is	registered, it picks up the default spintime.202			When a new device is registered, it picks up the203			default timeslice.204=======================	=======================================================205 206Device drivers207==============208 209Once the parport code is initialised, you can attach device drivers to210specific ports.  Normally this happens automatically; if the lp driver211is loaded it will create one lp device for each port found.  You can212override this, though, by using parameters either when you load the lp213driver::214 215	# insmod lp parport=0,2216 217or on the LILO command line::218 219	lp=parport0 lp=parport2220 221Both the above examples would inform lp that you want ``/dev/lp0`` to be222the first parallel port, and /dev/lp1 to be the **third** parallel port,223with no lp device associated with the second port (parport1).  Note224that this is different to the way older kernels worked; there used to225be a static association between the I/O port address and the device226name, so ``/dev/lp0`` was always the port at 0x3bc.  This is no longer the227case - if you only have one port, it will default to being ``/dev/lp0``,228regardless of base address.229 230Also:231 232 * If you selected the IEEE 1284 support at compile time, you can say233   ``lp=auto`` on the kernel command line, and lp will create devices234   only for those ports that seem to have printers attached.235 236 * If you give PLIP the ``timid`` parameter, either with ``plip=timid`` on237   the command line, or with ``insmod plip timid=1`` when using modules,238   it will avoid any ports that seem to be in use by other devices.239 240 * IRQ autoprobing works only for a few port types at the moment.241 242Reporting printer problems with parport243=======================================244 245If you are having problems printing, please go through these steps to246try to narrow down where the problem area is.247 248When reporting problems with parport, really you need to give all of249the messages that ``parport_pc`` spits out when it initialises.  There are250several code paths:251 252- polling253- interrupt-driven, protocol in software254- interrupt-driven, protocol in hardware using PIO255- interrupt-driven, protocol in hardware using DMA256 257The kernel messages that ``parport_pc`` logs give an indication of which258code path is being used. (They could be a lot better actually..)259 260For normal printer protocol, having IEEE 1284 modes enabled or not261should not make a difference.262 263To turn off the 'protocol in hardware' code paths, disable264``CONFIG_PARPORT_PC_FIFO``.  Note that when they are enabled they are not265necessarily **used**; it depends on whether the hardware is available,266enabled by the BIOS, and detected by the driver.267 268So, to start with, disable ``CONFIG_PARPORT_PC_FIFO``, and load ``parport_pc``269with ``irq=none``. See if printing works then.  It really should,270because this is the simplest code path.271 272If that works fine, try with ``io=0x378 irq=7`` (adjust for your273hardware), to make it use interrupt-driven in-software protocol.274 275If **that** works fine, then one of the hardware modes isn't working276right.  Enable ``CONFIG_FIFO`` (no, it isn't a module option,277and yes, it should be), set the port to ECP mode in the BIOS and note278the DMA channel, and try with::279 280    io=0x378 irq=7 dma=none (for PIO)281    io=0x378 irq=7 dma=3 (for DMA)282 283----------284 285philb@gnu.org286tim@cyberelk.net287