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