OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [Documentation/] [paride.txt] - Blame information for rev 1777

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1625 jcastillo
 
2
                Linux and parallel port IDE devices
3
 
4
 
5
PARIDE-1.03s   (c) 1997-8  Grant Guenther 
6
 
7
*************************************************************************
8
 
9
Special notes for the 2.0 version:
10
 
11
(i)   This is the paride from 2.1 retrofitted to work with 2.0.
12
 
13
(ii)  PARPORT is _not_ supported.  If you obtain the PARPORT patches
14
      for 2.0 and try to use them, it might work.  I have not tried
15
      it.
16
 
17
(iii) There is no guarantee of any ongoing support or future development
18
      for this special retrofit.
19
 
20
(iv)  I have not built or tested PARIDE with SMP support in 2.0.35,
21
      use it at your own risk.
22
 
23
(v)   The pcd driver in 2.1 now contains support for playing audio
24
      discs.  This functionality is not available in the 2.0 version.
25
 
26
*************************************************************************
27
 
28
1. Introduction
29
 
30
Owing to the simplicity and near universality of the parallel port interface
31
to personal computers, many external devices such as portable hard-disk,
32
CD-ROM, LS-120 and tape drives use the parallel port to connect to their
33
host computer.  While some devices (notably scanners) use ad-hoc methods
34
to pass commands and data through the parallel port interface, most
35
external devices are actually identical to an internal model, but with
36
a parallel-port adapter chip added in.  Some of the original parallel port
37
adapters were little more than mechanisms for multiplexing a SCSI bus.
38
(The Iomega PPA-3 adapter used in the ZIP drives is an example of this
39
approach).  Most current designs, however, take a different approach.
40
The adapter chip reproduces a small ISA or IDE bus in the external device
41
and the communication protocol provides operations for reading and writing
42
device registers, as well as data block transfer functions.  Sometimes,
43
the device being addressed via the parallel cable is a standard SCSI
44
controller like an NCR 5380.  The "ditto" family of external tape
45
drives use the ISA replicator to interface a floppy disk controller,
46
which is then connected to a floppy-tape mechanism.  The vast majority
47
of external parallel port devices, however, are now based on standard
48
IDE type devices, which require no intermediate controller.  If one
49
were to open up a parallel port CD-ROM drive, for instance, one would
50
find a standard ATAPI CD-ROM drive, a power supply, and a single adapter
51
that interconnected a standard PC parallel port cable and a standard
52
IDE cable.  It is usually possible to exchange the CD-ROM device with
53
any other device using the IDE interface.
54
 
55
The document describes the support in Linux for parallel port IDE
56
devices.  It does not cover parallel port SCSI devices, "ditto" tape
57
drives or scanners.  Many different devices are supported by the
58
parallel port IDE subsystem, including:
59
 
60
        MicroSolutions backpack CD-ROM
61
        MicroSolutions backpack PD/CD
62
        MicroSolutions backpack hard-drives
63
        MicroSolutions backpack 8000t tape drive
64
        SyQuest EZ-135, EZ-230 & SparQ drives
65
        Avatar Shark
66
        Imation Superdisk LS-120
67
        Maxell Superdisk LS-120
68
        FreeCom Power CD
69
        Hewlett-Packard 5GB and 8GB tape drives
70
        Hewlett-Packard 7100 and 7200 CD-RW drives
71
 
72
as well as most of the clone and no-name products on the market.
73
 
74
To support such a wide range of devices, PARIDE, the parallel port IDE
75
subsystem, is actually structured in three parts.   There is a base
76
paride module which provides a registry and some common methods for
77
accessing the parallel ports.  The second component is a set of
78
high-level drivers for each of the different types of supported devices:
79
 
80
        pd      IDE disk
81
        pcd     ATAPI CD-ROM
82
        pf      ATAPI disk
83
        pt      ATAPI tape
84
        pg      ATAPI generic
85
 
86
(Currently, the pg driver is only used with CD-R drives).
87
 
88
The high-level drivers function according to the relevant standards.
89
The third component of PARIDE is a set of low-level protocol drivers
90
for each of the parallel port IDE adapter chips.  Thanks to the interest
91
and encouragement of Linux users from many parts of the world,
92
support is available for almost all known adapter protocols:
93
 
94
        aten    ATEN EH-100                            (HK)
95
        bpck    Microsolutions backpack                (US)
96
        comm    DataStor (old-type) "commuter" adapter (TW)
97
        dstr    DataStor EP-2000                       (TW)
98
        epat    Shuttle EPAT                           (UK)
99
        epia    Shuttle EPIA                           (UK)
100
        fit2    FIT TD-2000                            (US)
101
        fit3    FIT TD-3000                            (US)
102
        friq    Freecom IQ cable                       (DE)
103
        frpw    Freecom Power                          (DE)
104
        kbic    KingByte KBIC-951A and KBIC-971A       (TW)
105
        ktti    KT Technology PHd adapter              (SG)
106
        on20    OnSpec 90c20                           (US)
107
        on26    OnSpec 90c26                           (US)
108
 
109
 
110
2. Using the PARIDE subsystem
111
 
112
While configuring the Linux kernel, you may choose either to build
113
the PARIDE drivers into your kernel, or to build them as modules.
114
 
115
In either case, you will need to select "Parallel port IDE device support"
116
as well as at least one of the high-level drivers and at least one
117
of the parallel port communication protocols.  If you do not know
118
what kind of parallel port adapter is used in your drive, you could
119
begin by checking the file names and any text files on your DOS
120
installation floppy.  Alternatively, you can look at the markings on
121
the adapter chip itself.  That's usually sufficient to identify the
122
correct device.
123
 
124
You can actually select all the protocol modules, and allow the PARIDE
125
subsystem to try them all for you.
126
 
127
For the "brand-name" products listed above, here are the protocol
128
and high-level drivers that you would use:
129
 
130
        Manufacturer            Model           Driver  Protocol
131
 
132
        MicroSolutions          CD-ROM          pcd     bpck
133
        MicroSolutions          PD drive        pf      bpck
134
        MicroSolutions          hard-drive      pd      bpck
135
        MicroSolutions          8000t tape      pt      bpck
136
        SyQuest                 EZ, SparQ       pd      epat
137
        Imation                 Superdisk       pf      epat
138
        Maxell                  Superdisk       pf      friq
139
        Avatar                  Shark           pd      epat
140
        FreeCom                 CD-ROM          pcd     frpw
141
        Hewlett-Packard         5GB Tape        pt      epat
142
        Hewlett-Packard         7200e (CD)      pcd     epat
143
        Hewlett-Packard         7200e (CD-R)    pg      epat
144
 
145
2.1  Configuring built-in drivers
146
 
147
We recommend that you get to know how the drivers work and how to
148
configure them as loadable modules, before attempting to compile a
149
kernel with the drivers built-in.
150
 
151
If you built all of your PARIDE support directly into your kernel,
152
and you have just a single parallel port IDE device, your kernel should
153
locate it automatically for you.  If you have more than one device,
154
you may need to give some command line options to your bootloader
155
(eg: LILO), how to do that is beyond the scope of this document.
156
 
157
The high-level drivers accept a number of command line parameters, all
158
of which are documented in the source files in linux/drivers/block/paride.
159
By default, each driver will automatically try all parallel ports it
160
can find, and all protocol types that have been installed, until it finds
161
a parallel port IDE adapter.  Once it finds one, the probe stops.  So,
162
if you have more than one device, you will need to tell the drivers
163
how to identify them.  This requires specifying the port address, the
164
protocol identification number and, for some devices, the drive's
165
chain ID.  While your system is booting, a number of messages are
166
displayed on the console.  Like all such messages, they can be
167
reviewed with the 'dmesg' command.  Among those messages will be
168
some lines like:
169
 
170
        paride: bpck registered as protocol 0
171
        paride: epat registered as protocol 1
172
 
173
The numbers will always be the same until you build a new kernel with
174
different protocol selections.  You should note these numbers as you
175
will need them to identify the devices.
176
 
177
If you happen to be using a MicroSolutions backpack device, you will
178
also need to know the unit ID number for each drive.  This is usually
179
the last two digits of the drive's serial number (but read MicroSolutions'
180
documentation about this).
181
 
182
As an example, let's assume that you have a MicroSolutions PD/CD drive
183
with unit ID number 36 connected to the parallel port at 0x378, a SyQuest
184
EZ-135 connected to the chained port on the PD/CD drive and also an
185
Imation Superdisk connected to port 0x278.  You could give the following
186
options on your boot command:
187
 
188
        pd.drive0=0x378,1 pf.drive0=0x278,1 pf.drive1=0x378,0,36
189
 
190
In the last option, pf.drive1 configures device /dev/pf1, the 0x378
191
is the parallel port base address, the 0 is the protocol registration
192
number and 36 is the chain ID.
193
 
194
This special version of PARIDE does not support chained devices on the
195
same parallel port.
196
 
197
2.2  Loading and configuring PARIDE as modules
198
 
199
It is much faster and simpler to get to understand the PARIDE drivers
200
if you use them as loadable kernel modules.
201
 
202
Note:  using these drivers with the "kerneld" automatic module loading
203
system is not recommended for beginners, and is not documented here.
204
 
205
To use PARIDE, you must begin by
206
 
207
        insmod paride
208
 
209
this loads a base module which provides a registry for the protocols,
210
among other tasks.
211
 
212
Then, load as many of the protocol modules as you think you might need.
213
As you load each module, it will register the protocols that it supports,
214
and print a log message to your kernel log file and your console. For
215
example:
216
 
217
        # insmod epat
218
        paride: epat registered as protocol 0
219
        # insmod kbic
220
        paride: k951 registered as protocol 1
221
        paride: k971 registered as protocol 2
222
 
223
Finally, you can load high-level drivers for each kind of device that
224
you have connected.  By default, each driver will autoprobe for a single
225
device, but you can support up to four similar devices by giving their
226
individual co-ordinates when you load the driver.
227
 
228
For example, if you had two no-name CD-ROM drives both using the
229
KingByte KBIC-951A adapter, one on port 0x378 and the other on 0x3bc
230
you could give the following command:
231
 
232
        # insmod pcd drive0=0x378,1 drive1=0x3bc,1
233
 
234
For most adapters, giving a port address and protocol number is sufficient,
235
but check the source files in linux/drivers/block/paride for more
236
information.  (Hopefully someone will write some man pages one day !).
237
 
238
As another example, here's what happens when PARPORT is installed, and
239
a SyQuest EZ-135 is attached to port 0x378:
240
 
241
        # insmod paride
242
        paride: version 1.0 installed
243
        # insmod epat
244
        paride: epat registered as protocol 0
245
        # insmod pd
246
        pd: pd version 1.0, major 45, cluster 64, nice 0
247
        pda: Sharing parport1 at 0x378
248
        pda: epat 1.0, Shuttle EPAT chip c3 at 0x378, mode 5 (EPP-32), delay 1
249
        pda: SyQuest EZ135A, 262144 blocks [128M], (512/16/32), removable media
250
         pda: pda1
251
 
252
Note that the last line is the output from the generic partition table
253
scanner - in this case it reports that it has found a disk with one partition.
254
 
255
2.3  Using a PARIDE device
256
 
257
Once the drivers have been loaded, you can access PARIDE devices in the
258
same way as their traditional counterparts.  You will probably need to
259
create the device "special files".  Here is a simple script that you can
260
cut to a file and execute:
261
 
262
#!/bin/bash
263
#
264
# mkd -- a script to create the device special files for the PARIDE subsystem
265
#
266
function mkdev {
267
  mknod $1 $2 $3 $4 ; chmod 0660 $1 ; chown root:disk $1
268
}
269
#
270
function pd {
271
  D=$( printf \\$( printf "x%03x" $[ $1 + 97 ] ) )
272
  mkdev pd$D b 45 $[ $1 * 16 ]
273
  for P in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
274
  do mkdev pd$D$P b 45 $[ $1 * 16 + $P ]
275
  done
276
}
277
#
278
cd /dev
279
#
280
for u in 0 1 2 3 ; do pd $u ; done
281
for u in 0 1 2 3 ; do mkdev pcd$u b 46 $u ; done
282
for u in 0 1 2 3 ; do mkdev pf$u  b 47 $u ; done
283
for u in 0 1 2 3 ; do mkdev pt$u  c 96 $u ; done
284
for u in 0 1 2 3 ; do mkdev npt$u c 96 $[ $u + 128 ] ; done
285
for u in 0 1 2 3 ; do mkdev pg$u  c 97 $u ; done
286
#
287
# end of mkd
288
 
289
With the device files and drivers in place, you can access PARIDE devices
290
like any other Linux device.   For example, to mount a CD-ROM in pcd0, use:
291
 
292
        mount /dev/pcd0 /cdrom
293
 
294
If you have a fresh Avatar Shark cartridge, and the drive is pda, you
295
might do something like:
296
 
297
        fdisk /dev/pda          -- make a new partition table with
298
                                   partition 1 of type 83
299
 
300
        mke2fs /dev/pda1        -- to build the file system
301
 
302
        mkdir /shark            -- make a place to mount the disk
303
 
304
        mount /dev/pda1 /shark
305
 
306
Devices like the Imation superdisk work in the same way, except that
307
they do not have a partition table.  For example to make a 120MB
308
floppy that you could share with a DOS system:
309
 
310
        mkdosfs /dev/pf0
311
        mount /dev/pf0 /mnt
312
 
313
 
314
2.4  The pf driver
315
 
316
The pf driver is intended for use with parallel port ATAPI disk
317
devices.  The most common devices in this category are PD drives
318
and LS-120 drives.  Traditionally, media for these devices are not
319
partitioned.  Consequently, the pf driver does not support partitioned
320
media.  This may be changed in a future version of the driver.
321
 
322
2.5  Using the pt driver
323
 
324
The pt driver for parallel port ATAPI tape drives is a minimal driver.
325
It does not yet support many of the standard tape ioctl operations.
326
For best performance, a block size of 32KB should be used.  You will
327
probably want to set the parallel port delay to 0, if you can.
328
 
329
2.6  Using the pg driver
330
 
331
The pg driver can be used in conjunction with the cdrecord program
332
to create CD-ROMs.  Please get cdrecord version 1.6.1 or later
333
from ftp://ftp.fokus.gmd.de/pub/unix/cdrecord/ .  To record CD-R media
334
your parallel port should ideally be set to EPP mode, and the "port delay"
335
should be set to 0.  With those settings it is possible to record at 2x
336
speed without any buffer underruns.  If you cannot get the driver to work
337
in EPP mode, try to use "bidirectional" or "PS/2" mode and 1x speeds only.
338
 
339
 
340
3. Troubleshooting
341
 
342
3.1  Use EPP mode if you can
343
 
344
The most common problems that people report with the PARIDE drivers
345
concern the parallel port CMOS settings.  At this time, none of the
346
PARIDE protocol modules support ECP mode, or any ECP combination modes.
347
If you are able to do so, please set your parallel port into EPP mode
348
using your CMOS setup procedure.
349
 
350
3.2  Check the port delay
351
 
352
Some parallel ports cannot reliably transfer data at full speed.  To
353
offset the errors, the PARIDE protocol modules introduce a "port
354
delay" between each access to the i/o ports.  Each protocol sets
355
a default value for this delay.  In most cases, the user can override
356
the default and set it to 0 - resulting in somewhat higher transfer
357
rates.  In some rare cases (especially with older 486 systems) the
358
default delays are not long enough.  if you experience corrupt data
359
transfers, or unexpected failures, you may wish to increase the
360
port delay.   The delay can be programmed using the "driveN" parameters
361
to each of the high-level drivers.  Please see the notes above, or
362
read the comments at the beginning of the driver source files in
363
linux/drivers/block/paride.
364
 
365
3.3  Some drives need a printer reset
366
 
367
There appear to be a number of "noname" external drives on the market
368
that do not always power up correctly.  We have noticed this with some
369
drives based on OnSpec and older Freecom adapters.  In these rare cases,
370
the adapter can often be reinitialised by issuing a "printer reset" on
371
the parallel port.  As the reset operation is potentially disruptive in
372
multiple device environments, the PARIDE drivers will not do it
373
automatically.  You can however, force a printer reset by doing:
374
 
375
        insmod lp
376
        rmmod lp
377
 
378
If you have one of these marginal cases, you should probably build
379
your paride drivers as modules, and arrange to do the printer reset
380
before loading the PARIDE drivers.
381
 
382
3.4  Use the verbose option and dmesg if you need help
383
 
384
While a lot of testing has gone into these drivers to make them work
385
as smoothly as possible, problems will arise.  If you do have problems,
386
please check all the obvious things first:  does the drive work in
387
DOS with the manufacturer's drivers ?  If that doesn't yield any useful
388
clues, then please make sure that only one drive is hooked to your system,
389
and that no other device driver is using your parallel port (check in
390
/proc/ioports).  Then, load the appropriate drivers (you can load several
391
protocol modules if you want) as in:
392
 
393
        # insmod paride
394
        # insmod epat
395
        # insmod bpck
396
        # insmod kbic
397
        ...
398
        # insmod pd verbose=1
399
 
400
(using the correct driver for the type of device you have, of course).
401
The verbose=1 parameter will cause the drivers to log a trace of their
402
activity as they attempt to locate your drive.
403
 
404
Use 'dmesg' to capture a log of all the PARIDE messages (any messages
405
beginning with paride:, a protocol module's name or a driver's name) and
406
include that with your bug report.  You can submit a bug report in one
407
of two ways.  Either send it directly to the author of the PARIDE suite,
408
by e-mail to grant@torque.net, or join the linux-parport mailing list
409
and post your report there.
410
 
411
3.5  For more information or help
412
 
413
You can join the linux-parport mailing list by sending a mail message
414
to
415
                linux-parport-request@torque.net
416
 
417
with the single word
418
 
419
                subscribe
420
 
421
in the body of the mail message (not in the subject line).   Please be
422
sure that your mail program is correctly set up when you do this,  as
423
the list manager is a robot that will subscribe you using the reply
424
address in your mail headers.  REMOVE any anti-spam gimmicks you may
425
have in your mail headers, when sending mail to the list server.
426
 
427
You might also find some useful information on the linux-parport
428
web pages (although they are not always up to date) at
429
 
430
        http://www.torque.net/parport/
431
 
432
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.