parport.txt 8.8 KB

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