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