0001 ===================================
0002 Linux and parallel port IDE devices
0003 ===================================
0004
0005 PARIDE v1.03 (c) 1997-8 Grant Guenther <grant@torque.net>
0006
0007 1. Introduction
0008 ===============
0009
0010 Owing to the simplicity and near universality of the parallel port interface
0011 to personal computers, many external devices such as portable hard-disk,
0012 CD-ROM, LS-120 and tape drives use the parallel port to connect to their
0013 host computer. While some devices (notably scanners) use ad-hoc methods
0014 to pass commands and data through the parallel port interface, most
0015 external devices are actually identical to an internal model, but with
0016 a parallel-port adapter chip added in. Some of the original parallel port
0017 adapters were little more than mechanisms for multiplexing a SCSI bus.
0018 (The Iomega PPA-3 adapter used in the ZIP drives is an example of this
0019 approach). Most current designs, however, take a different approach.
0020 The adapter chip reproduces a small ISA or IDE bus in the external device
0021 and the communication protocol provides operations for reading and writing
0022 device registers, as well as data block transfer functions. Sometimes,
0023 the device being addressed via the parallel cable is a standard SCSI
0024 controller like an NCR 5380. The "ditto" family of external tape
0025 drives use the ISA replicator to interface a floppy disk controller,
0026 which is then connected to a floppy-tape mechanism. The vast majority
0027 of external parallel port devices, however, are now based on standard
0028 IDE type devices, which require no intermediate controller. If one
0029 were to open up a parallel port CD-ROM drive, for instance, one would
0030 find a standard ATAPI CD-ROM drive, a power supply, and a single adapter
0031 that interconnected a standard PC parallel port cable and a standard
0032 IDE cable. It is usually possible to exchange the CD-ROM device with
0033 any other device using the IDE interface.
0034
0035 The document describes the support in Linux for parallel port IDE
0036 devices. It does not cover parallel port SCSI devices, "ditto" tape
0037 drives or scanners. Many different devices are supported by the
0038 parallel port IDE subsystem, including:
0039
0040 - MicroSolutions backpack CD-ROM
0041 - MicroSolutions backpack PD/CD
0042 - MicroSolutions backpack hard-drives
0043 - MicroSolutions backpack 8000t tape drive
0044 - SyQuest EZ-135, EZ-230 & SparQ drives
0045 - Avatar Shark
0046 - Imation Superdisk LS-120
0047 - Maxell Superdisk LS-120
0048 - FreeCom Power CD
0049 - Hewlett-Packard 5GB and 8GB tape drives
0050 - Hewlett-Packard 7100 and 7200 CD-RW drives
0051
0052 as well as most of the clone and no-name products on the market.
0053
0054 To support such a wide range of devices, PARIDE, the parallel port IDE
0055 subsystem, is actually structured in three parts. There is a base
0056 paride module which provides a registry and some common methods for
0057 accessing the parallel ports. The second component is a set of
0058 high-level drivers for each of the different types of supported devices:
0059
0060 === =============
0061 pd IDE disk
0062 pcd ATAPI CD-ROM
0063 pf ATAPI disk
0064 pt ATAPI tape
0065 pg ATAPI generic
0066 === =============
0067
0068 (Currently, the pg driver is only used with CD-R drives).
0069
0070 The high-level drivers function according to the relevant standards.
0071 The third component of PARIDE is a set of low-level protocol drivers
0072 for each of the parallel port IDE adapter chips. Thanks to the interest
0073 and encouragement of Linux users from many parts of the world,
0074 support is available for almost all known adapter protocols:
0075
0076 ==== ====================================== ====
0077 aten ATEN EH-100 (HK)
0078 bpck Microsolutions backpack (US)
0079 comm DataStor (old-type) "commuter" adapter (TW)
0080 dstr DataStor EP-2000 (TW)
0081 epat Shuttle EPAT (UK)
0082 epia Shuttle EPIA (UK)
0083 fit2 FIT TD-2000 (US)
0084 fit3 FIT TD-3000 (US)
0085 friq Freecom IQ cable (DE)
0086 frpw Freecom Power (DE)
0087 kbic KingByte KBIC-951A and KBIC-971A (TW)
0088 ktti KT Technology PHd adapter (SG)
0089 on20 OnSpec 90c20 (US)
0090 on26 OnSpec 90c26 (US)
0091 ==== ====================================== ====
0092
0093
0094 2. Using the PARIDE subsystem
0095 =============================
0096
0097 While configuring the Linux kernel, you may choose either to build
0098 the PARIDE drivers into your kernel, or to build them as modules.
0099
0100 In either case, you will need to select "Parallel port IDE device support"
0101 as well as at least one of the high-level drivers and at least one
0102 of the parallel port communication protocols. If you do not know
0103 what kind of parallel port adapter is used in your drive, you could
0104 begin by checking the file names and any text files on your DOS
0105 installation floppy. Alternatively, you can look at the markings on
0106 the adapter chip itself. That's usually sufficient to identify the
0107 correct device.
0108
0109 You can actually select all the protocol modules, and allow the PARIDE
0110 subsystem to try them all for you.
0111
0112 For the "brand-name" products listed above, here are the protocol
0113 and high-level drivers that you would use:
0114
0115 ================ ============ ====== ========
0116 Manufacturer Model Driver Protocol
0117 ================ ============ ====== ========
0118 MicroSolutions CD-ROM pcd bpck
0119 MicroSolutions PD drive pf bpck
0120 MicroSolutions hard-drive pd bpck
0121 MicroSolutions 8000t tape pt bpck
0122 SyQuest EZ, SparQ pd epat
0123 Imation Superdisk pf epat
0124 Maxell Superdisk pf friq
0125 Avatar Shark pd epat
0126 FreeCom CD-ROM pcd frpw
0127 Hewlett-Packard 5GB Tape pt epat
0128 Hewlett-Packard 7200e (CD) pcd epat
0129 Hewlett-Packard 7200e (CD-R) pg epat
0130 ================ ============ ====== ========
0131
0132 2.1 Configuring built-in drivers
0133 ---------------------------------
0134
0135 We recommend that you get to know how the drivers work and how to
0136 configure them as loadable modules, before attempting to compile a
0137 kernel with the drivers built-in.
0138
0139 If you built all of your PARIDE support directly into your kernel,
0140 and you have just a single parallel port IDE device, your kernel should
0141 locate it automatically for you. If you have more than one device,
0142 you may need to give some command line options to your bootloader
0143 (eg: LILO), how to do that is beyond the scope of this document.
0144
0145 The high-level drivers accept a number of command line parameters, all
0146 of which are documented in the source files in linux/drivers/block/paride.
0147 By default, each driver will automatically try all parallel ports it
0148 can find, and all protocol types that have been installed, until it finds
0149 a parallel port IDE adapter. Once it finds one, the probe stops. So,
0150 if you have more than one device, you will need to tell the drivers
0151 how to identify them. This requires specifying the port address, the
0152 protocol identification number and, for some devices, the drive's
0153 chain ID. While your system is booting, a number of messages are
0154 displayed on the console. Like all such messages, they can be
0155 reviewed with the 'dmesg' command. Among those messages will be
0156 some lines like::
0157
0158 paride: bpck registered as protocol 0
0159 paride: epat registered as protocol 1
0160
0161 The numbers will always be the same until you build a new kernel with
0162 different protocol selections. You should note these numbers as you
0163 will need them to identify the devices.
0164
0165 If you happen to be using a MicroSolutions backpack device, you will
0166 also need to know the unit ID number for each drive. This is usually
0167 the last two digits of the drive's serial number (but read MicroSolutions'
0168 documentation about this).
0169
0170 As an example, let's assume that you have a MicroSolutions PD/CD drive
0171 with unit ID number 36 connected to the parallel port at 0x378, a SyQuest
0172 EZ-135 connected to the chained port on the PD/CD drive and also an
0173 Imation Superdisk connected to port 0x278. You could give the following
0174 options on your boot command::
0175
0176 pd.drive0=0x378,1 pf.drive0=0x278,1 pf.drive1=0x378,0,36
0177
0178 In the last option, pf.drive1 configures device /dev/pf1, the 0x378
0179 is the parallel port base address, the 0 is the protocol registration
0180 number and 36 is the chain ID.
0181
0182 Please note: while PARIDE will work both with and without the
0183 PARPORT parallel port sharing system that is included by the
0184 "Parallel port support" option, PARPORT must be included and enabled
0185 if you want to use chains of devices on the same parallel port.
0186
0187 2.2 Loading and configuring PARIDE as modules
0188 ----------------------------------------------
0189
0190 It is much faster and simpler to get to understand the PARIDE drivers
0191 if you use them as loadable kernel modules.
0192
0193 Note 1:
0194 using these drivers with the "kerneld" automatic module loading
0195 system is not recommended for beginners, and is not documented here.
0196
0197 Note 2:
0198 if you build PARPORT support as a loadable module, PARIDE must
0199 also be built as loadable modules, and PARPORT must be loaded before
0200 the PARIDE modules.
0201
0202 To use PARIDE, you must begin by::
0203
0204 insmod paride
0205
0206 this loads a base module which provides a registry for the protocols,
0207 among other tasks.
0208
0209 Then, load as many of the protocol modules as you think you might need.
0210 As you load each module, it will register the protocols that it supports,
0211 and print a log message to your kernel log file and your console. For
0212 example::
0213
0214 # insmod epat
0215 paride: epat registered as protocol 0
0216 # insmod kbic
0217 paride: k951 registered as protocol 1
0218 paride: k971 registered as protocol 2
0219
0220 Finally, you can load high-level drivers for each kind of device that
0221 you have connected. By default, each driver will autoprobe for a single
0222 device, but you can support up to four similar devices by giving their
0223 individual coordinates when you load the driver.
0224
0225 For example, if you had two no-name CD-ROM drives both using the
0226 KingByte KBIC-951A adapter, one on port 0x378 and the other on 0x3bc
0227 you could give the following command::
0228
0229 # insmod pcd drive0=0x378,1 drive1=0x3bc,1
0230
0231 For most adapters, giving a port address and protocol number is sufficient,
0232 but check the source files in linux/drivers/block/paride for more
0233 information. (Hopefully someone will write some man pages one day !).
0234
0235 As another example, here's what happens when PARPORT is installed, and
0236 a SyQuest EZ-135 is attached to port 0x378::
0237
0238 # insmod paride
0239 paride: version 1.0 installed
0240 # insmod epat
0241 paride: epat registered as protocol 0
0242 # insmod pd
0243 pd: pd version 1.0, major 45, cluster 64, nice 0
0244 pda: Sharing parport1 at 0x378
0245 pda: epat 1.0, Shuttle EPAT chip c3 at 0x378, mode 5 (EPP-32), delay 1
0246 pda: SyQuest EZ135A, 262144 blocks [128M], (512/16/32), removable media
0247 pda: pda1
0248
0249 Note that the last line is the output from the generic partition table
0250 scanner - in this case it reports that it has found a disk with one partition.
0251
0252 2.3 Using a PARIDE device
0253 --------------------------
0254
0255 Once the drivers have been loaded, you can access PARIDE devices in the
0256 same way as their traditional counterparts. You will probably need to
0257 create the device "special files". Here is a simple script that you can
0258 cut to a file and execute::
0259
0260 #!/bin/bash
0261 #
0262 # mkd -- a script to create the device special files for the PARIDE subsystem
0263 #
0264 function mkdev {
0265 mknod $1 $2 $3 $4 ; chmod 0660 $1 ; chown root:disk $1
0266 }
0267 #
0268 function pd {
0269 D=$( printf \\$( printf "x%03x" $[ $1 + 97 ] ) )
0270 mkdev pd$D b 45 $[ $1 * 16 ]
0271 for P in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0272 do mkdev pd$D$P b 45 $[ $1 * 16 + $P ]
0273 done
0274 }
0275 #
0276 cd /dev
0277 #
0278 for u in 0 1 2 3 ; do pd $u ; done
0279 for u in 0 1 2 3 ; do mkdev pcd$u b 46 $u ; done
0280 for u in 0 1 2 3 ; do mkdev pf$u b 47 $u ; done
0281 for u in 0 1 2 3 ; do mkdev pt$u c 96 $u ; done
0282 for u in 0 1 2 3 ; do mkdev npt$u c 96 $[ $u + 128 ] ; done
0283 for u in 0 1 2 3 ; do mkdev pg$u c 97 $u ; done
0284 #
0285 # end of mkd
0286
0287 With the device files and drivers in place, you can access PARIDE devices
0288 like any other Linux device. For example, to mount a CD-ROM in pcd0, use::
0289
0290 mount /dev/pcd0 /cdrom
0291
0292 If you have a fresh Avatar Shark cartridge, and the drive is pda, you
0293 might do something like::
0294
0295 fdisk /dev/pda -- make a new partition table with
0296 partition 1 of type 83
0297
0298 mke2fs /dev/pda1 -- to build the file system
0299
0300 mkdir /shark -- make a place to mount the disk
0301
0302 mount /dev/pda1 /shark
0303
0304 Devices like the Imation superdisk work in the same way, except that
0305 they do not have a partition table. For example to make a 120MB
0306 floppy that you could share with a DOS system::
0307
0308 mkdosfs /dev/pf0
0309 mount /dev/pf0 /mnt
0310
0311
0312 2.4 The pf driver
0313 ------------------
0314
0315 The pf driver is intended for use with parallel port ATAPI disk
0316 devices. The most common devices in this category are PD drives
0317 and LS-120 drives. Traditionally, media for these devices are not
0318 partitioned. Consequently, the pf driver does not support partitioned
0319 media. This may be changed in a future version of the driver.
0320
0321 2.5 Using the pt driver
0322 ------------------------
0323
0324 The pt driver for parallel port ATAPI tape drives is a minimal driver.
0325 It does not yet support many of the standard tape ioctl operations.
0326 For best performance, a block size of 32KB should be used. You will
0327 probably want to set the parallel port delay to 0, if you can.
0328
0329 2.6 Using the pg driver
0330 ------------------------
0331
0332 The pg driver can be used in conjunction with the cdrecord program
0333 to create CD-ROMs. Please get cdrecord version 1.6.1 or later
0334 from ftp://ftp.fokus.gmd.de/pub/unix/cdrecord/ . To record CD-R media
0335 your parallel port should ideally be set to EPP mode, and the "port delay"
0336 should be set to 0. With those settings it is possible to record at 2x
0337 speed without any buffer underruns. If you cannot get the driver to work
0338 in EPP mode, try to use "bidirectional" or "PS/2" mode and 1x speeds only.
0339
0340
0341 3. Troubleshooting
0342 ==================
0343
0344 3.1 Use EPP mode if you can
0345 ----------------------------
0346
0347 The most common problems that people report with the PARIDE drivers
0348 concern the parallel port CMOS settings. At this time, none of the
0349 PARIDE protocol modules support ECP mode, or any ECP combination modes.
0350 If you are able to do so, please set your parallel port into EPP mode
0351 using your CMOS setup procedure.
0352
0353 3.2 Check the port delay
0354 -------------------------
0355
0356 Some parallel ports cannot reliably transfer data at full speed. To
0357 offset the errors, the PARIDE protocol modules introduce a "port
0358 delay" between each access to the i/o ports. Each protocol sets
0359 a default value for this delay. In most cases, the user can override
0360 the default and set it to 0 - resulting in somewhat higher transfer
0361 rates. In some rare cases (especially with older 486 systems) the
0362 default delays are not long enough. if you experience corrupt data
0363 transfers, or unexpected failures, you may wish to increase the
0364 port delay. The delay can be programmed using the "driveN" parameters
0365 to each of the high-level drivers. Please see the notes above, or
0366 read the comments at the beginning of the driver source files in
0367 linux/drivers/block/paride.
0368
0369 3.3 Some drives need a printer reset
0370 -------------------------------------
0371
0372 There appear to be a number of "noname" external drives on the market
0373 that do not always power up correctly. We have noticed this with some
0374 drives based on OnSpec and older Freecom adapters. In these rare cases,
0375 the adapter can often be reinitialised by issuing a "printer reset" on
0376 the parallel port. As the reset operation is potentially disruptive in
0377 multiple device environments, the PARIDE drivers will not do it
0378 automatically. You can however, force a printer reset by doing::
0379
0380 insmod lp reset=1
0381 rmmod lp
0382
0383 If you have one of these marginal cases, you should probably build
0384 your paride drivers as modules, and arrange to do the printer reset
0385 before loading the PARIDE drivers.
0386
0387 3.4 Use the verbose option and dmesg if you need help
0388 ------------------------------------------------------
0389
0390 While a lot of testing has gone into these drivers to make them work
0391 as smoothly as possible, problems will arise. If you do have problems,
0392 please check all the obvious things first: does the drive work in
0393 DOS with the manufacturer's drivers ? If that doesn't yield any useful
0394 clues, then please make sure that only one drive is hooked to your system,
0395 and that either (a) PARPORT is enabled or (b) no other device driver
0396 is using your parallel port (check in /proc/ioports). Then, load the
0397 appropriate drivers (you can load several protocol modules if you want)
0398 as in::
0399
0400 # insmod paride
0401 # insmod epat
0402 # insmod bpck
0403 # insmod kbic
0404 ...
0405 # insmod pd verbose=1
0406
0407 (using the correct driver for the type of device you have, of course).
0408 The verbose=1 parameter will cause the drivers to log a trace of their
0409 activity as they attempt to locate your drive.
0410
0411 Use 'dmesg' to capture a log of all the PARIDE messages (any messages
0412 beginning with paride:, a protocol module's name or a driver's name) and
0413 include that with your bug report. You can submit a bug report in one
0414 of two ways. Either send it directly to the author of the PARIDE suite,
0415 by e-mail to grant@torque.net, or join the linux-parport mailing list
0416 and post your report there.
0417
0418 3.5 For more information or help
0419 ---------------------------------
0420
0421 You can join the linux-parport mailing list by sending a mail message
0422 to:
0423
0424 linux-parport-request@torque.net
0425
0426 with the single word::
0427
0428 subscribe
0429
0430 in the body of the mail message (not in the subject line). Please be
0431 sure that your mail program is correctly set up when you do this, as
0432 the list manager is a robot that will subscribe you using the reply
0433 address in your mail headers. REMOVE any anti-spam gimmicks you may
0434 have in your mail headers, when sending mail to the list server.
0435
0436 You might also find some useful information on the linux-parport
0437 web pages (although they are not always up to date) at
0438
0439 http://web.archive.org/web/%2E/http://www.torque.net/parport/