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