1e7751617SMauro Carvalho Chehab===================================
2e7751617SMauro Carvalho ChehabLinux and parallel port IDE devices
3e7751617SMauro Carvalho Chehab===================================
4e7751617SMauro Carvalho Chehab
5e7751617SMauro Carvalho ChehabPARIDE v1.03   (c) 1997-8  Grant Guenther <grant@torque.net>
6*7750d8b5SOndrej ZaryPATA_PARPORT   (c) 2023 Ondrej Zary
7e7751617SMauro Carvalho Chehab
8e7751617SMauro Carvalho Chehab1. Introduction
9e7751617SMauro Carvalho Chehab===============
10e7751617SMauro Carvalho Chehab
11e7751617SMauro Carvalho ChehabOwing to the simplicity and near universality of the parallel port interface
12e7751617SMauro Carvalho Chehabto personal computers, many external devices such as portable hard-disk,
13e7751617SMauro Carvalho ChehabCD-ROM, LS-120 and tape drives use the parallel port to connect to their
14e7751617SMauro Carvalho Chehabhost computer.  While some devices (notably scanners) use ad-hoc methods
15e7751617SMauro Carvalho Chehabto pass commands and data through the parallel port interface, most
16e7751617SMauro Carvalho Chehabexternal devices are actually identical to an internal model, but with
17e7751617SMauro Carvalho Chehaba parallel-port adapter chip added in.  Some of the original parallel port
18e7751617SMauro Carvalho Chehabadapters were little more than mechanisms for multiplexing a SCSI bus.
19e7751617SMauro Carvalho Chehab(The Iomega PPA-3 adapter used in the ZIP drives is an example of this
20e7751617SMauro Carvalho Chehabapproach).  Most current designs, however, take a different approach.
21e7751617SMauro Carvalho ChehabThe adapter chip reproduces a small ISA or IDE bus in the external device
22e7751617SMauro Carvalho Chehaband the communication protocol provides operations for reading and writing
23e7751617SMauro Carvalho Chehabdevice registers, as well as data block transfer functions.  Sometimes,
24e7751617SMauro Carvalho Chehabthe device being addressed via the parallel cable is a standard SCSI
25e7751617SMauro Carvalho Chehabcontroller like an NCR 5380.  The "ditto" family of external tape
26e7751617SMauro Carvalho Chehabdrives use the ISA replicator to interface a floppy disk controller,
27e7751617SMauro Carvalho Chehabwhich is then connected to a floppy-tape mechanism.  The vast majority
28e7751617SMauro Carvalho Chehabof external parallel port devices, however, are now based on standard
29e7751617SMauro Carvalho ChehabIDE type devices, which require no intermediate controller.  If one
30e7751617SMauro Carvalho Chehabwere to open up a parallel port CD-ROM drive, for instance, one would
31e7751617SMauro Carvalho Chehabfind a standard ATAPI CD-ROM drive, a power supply, and a single adapter
32e7751617SMauro Carvalho Chehabthat interconnected a standard PC parallel port cable and a standard
33e7751617SMauro Carvalho ChehabIDE cable.  It is usually possible to exchange the CD-ROM device with
34e7751617SMauro Carvalho Chehabany other device using the IDE interface.
35e7751617SMauro Carvalho Chehab
36e7751617SMauro Carvalho ChehabThe document describes the support in Linux for parallel port IDE
37e7751617SMauro Carvalho Chehabdevices.  It does not cover parallel port SCSI devices, "ditto" tape
38e7751617SMauro Carvalho Chehabdrives or scanners.  Many different devices are supported by the
39e7751617SMauro Carvalho Chehabparallel port IDE subsystem, including:
40e7751617SMauro Carvalho Chehab
41e7751617SMauro Carvalho Chehab	- MicroSolutions backpack CD-ROM
42e7751617SMauro Carvalho Chehab	- MicroSolutions backpack PD/CD
43e7751617SMauro Carvalho Chehab	- MicroSolutions backpack hard-drives
44e7751617SMauro Carvalho Chehab	- MicroSolutions backpack 8000t tape drive
45e7751617SMauro Carvalho Chehab	- SyQuest EZ-135, EZ-230 & SparQ drives
46e7751617SMauro Carvalho Chehab	- Avatar Shark
47e7751617SMauro Carvalho Chehab	- Imation Superdisk LS-120
48e7751617SMauro Carvalho Chehab	- Maxell Superdisk LS-120
49e7751617SMauro Carvalho Chehab	- FreeCom Power CD
50e7751617SMauro Carvalho Chehab	- Hewlett-Packard 5GB and 8GB tape drives
51e7751617SMauro Carvalho Chehab	- Hewlett-Packard 7100 and 7200 CD-RW drives
52e7751617SMauro Carvalho Chehab
53e7751617SMauro Carvalho Chehabas well as most of the clone and no-name products on the market.
54e7751617SMauro Carvalho Chehab
55*7750d8b5SOndrej ZaryTo support such a wide range of devices, pata_parport is actually structured
56*7750d8b5SOndrej Zaryin two parts. There is a base pata_parport module which provides an interface
57*7750d8b5SOndrej Zaryto kernel libata subsystem, registry and some common methods for accessing
58*7750d8b5SOndrej Zarythe parallel ports.
59e7751617SMauro Carvalho Chehab
60*7750d8b5SOndrej ZaryThe second component is a set of low-level protocol drivers for each of the
61*7750d8b5SOndrej Zaryparallel port IDE adapter chips.  Thanks to the interest and encouragement of
62*7750d8b5SOndrej ZaryLinux users from many parts of the world, support is available for almost all
63*7750d8b5SOndrej Zaryknown adapter protocols:
64e7751617SMauro Carvalho Chehab
65e7751617SMauro Carvalho Chehab	====    ====================================== ====
66e7751617SMauro Carvalho Chehab        aten    ATEN EH-100                            (HK)
67e7751617SMauro Carvalho Chehab        bpck    Microsolutions backpack                (US)
68e7751617SMauro Carvalho Chehab        comm    DataStor (old-type) "commuter" adapter (TW)
69e7751617SMauro Carvalho Chehab        dstr    DataStor EP-2000                       (TW)
70e7751617SMauro Carvalho Chehab        epat    Shuttle EPAT                           (UK)
71e7751617SMauro Carvalho Chehab        epia    Shuttle EPIA                           (UK)
72e7751617SMauro Carvalho Chehab	fit2    FIT TD-2000			       (US)
73e7751617SMauro Carvalho Chehab	fit3    FIT TD-3000			       (US)
74e7751617SMauro Carvalho Chehab	friq    Freecom IQ cable                       (DE)
75e7751617SMauro Carvalho Chehab        frpw    Freecom Power                          (DE)
76e7751617SMauro Carvalho Chehab        kbic    KingByte KBIC-951A and KBIC-971A       (TW)
77e7751617SMauro Carvalho Chehab	ktti    KT Technology PHd adapter              (SG)
78e7751617SMauro Carvalho Chehab        on20    OnSpec 90c20                           (US)
79e7751617SMauro Carvalho Chehab        on26    OnSpec 90c26                           (US)
80e7751617SMauro Carvalho Chehab	====    ====================================== ====
81e7751617SMauro Carvalho Chehab
82e7751617SMauro Carvalho Chehab
83*7750d8b5SOndrej Zary2. Using pata_parport subsystem
84*7750d8b5SOndrej Zary===============================
85e7751617SMauro Carvalho Chehab
86e7751617SMauro Carvalho ChehabWhile configuring the Linux kernel, you may choose either to build
87*7750d8b5SOndrej Zarythe pata_parport drivers into your kernel, or to build them as modules.
88e7751617SMauro Carvalho Chehab
89e7751617SMauro Carvalho ChehabIn either case, you will need to select "Parallel port IDE device support"
90*7750d8b5SOndrej Zaryand at least one of the parallel port communication protocols.
91*7750d8b5SOndrej ZaryIf you do not know what kind of parallel port adapter is used in your drive,
92*7750d8b5SOndrej Zaryyou could begin by checking the file names and any text files on your DOS
93e7751617SMauro Carvalho Chehabinstallation floppy.  Alternatively, you can look at the markings on
94e7751617SMauro Carvalho Chehabthe adapter chip itself.  That's usually sufficient to identify the
95e7751617SMauro Carvalho Chehabcorrect device.
96e7751617SMauro Carvalho Chehab
97*7750d8b5SOndrej ZaryYou can actually select all the protocol modules, and allow the pata_parport
98e7751617SMauro Carvalho Chehabsubsystem to try them all for you.
99e7751617SMauro Carvalho Chehab
100e7751617SMauro Carvalho ChehabFor the "brand-name" products listed above, here are the protocol
101e7751617SMauro Carvalho Chehaband high-level drivers that you would use:
102e7751617SMauro Carvalho Chehab
103*7750d8b5SOndrej Zary	================	============	========
104*7750d8b5SOndrej Zary	Manufacturer		Model		Protocol
105*7750d8b5SOndrej Zary	================	============	========
106*7750d8b5SOndrej Zary	MicroSolutions		CD-ROM		bpck
107*7750d8b5SOndrej Zary	MicroSolutions		PD drive	bpck
108*7750d8b5SOndrej Zary	MicroSolutions		hard-drive	bpck
109*7750d8b5SOndrej Zary	MicroSolutions          8000t tape      bpck
110*7750d8b5SOndrej Zary	SyQuest			EZ, SparQ	epat
111*7750d8b5SOndrej Zary	Imation			Superdisk	epat
112*7750d8b5SOndrej Zary	Maxell                  Superdisk       friq
113*7750d8b5SOndrej Zary	Avatar			Shark		epat
114*7750d8b5SOndrej Zary	FreeCom			CD-ROM		frpw
115*7750d8b5SOndrej Zary	Hewlett-Packard		5GB Tape	epat
116*7750d8b5SOndrej Zary	Hewlett-Packard		7200e (CD)	epat
117*7750d8b5SOndrej Zary	Hewlett-Packard		7200e (CD-R)	epat
118*7750d8b5SOndrej Zary	================	============	========
119246a1c4cSOndrej Zary
120246a1c4cSOndrej ZaryAll parports and all protocol drivers are probed automatically unless probe=0
121246a1c4cSOndrej Zaryparameter is used. So just "modprobe epat" is enough for a Imation SuperDisk
122246a1c4cSOndrej Zarydrive to work.
123246a1c4cSOndrej Zary
124246a1c4cSOndrej ZaryManual device creation::
125246a1c4cSOndrej Zary
126246a1c4cSOndrej Zary	# echo "port protocol mode unit delay" >/sys/bus/pata_parport/new_device
127246a1c4cSOndrej Zary
128246a1c4cSOndrej Zarywhere:
129246a1c4cSOndrej Zary
130246a1c4cSOndrej Zary	======== ================================================
131246a1c4cSOndrej Zary	port	 parport name (or "auto" for all parports)
132246a1c4cSOndrej Zary	protocol protocol name (or "auto" for all protocols)
133246a1c4cSOndrej Zary	mode	 mode number (protocol-specific) or -1 for probe
134*7750d8b5SOndrej Zary	unit	 unit number (for backpack only, see below)
135*7750d8b5SOndrej Zary	delay	 I/O delay (see troubleshooting section below)
136246a1c4cSOndrej Zary	======== ================================================
137246a1c4cSOndrej Zary
138*7750d8b5SOndrej ZaryIf you happen to be using a MicroSolutions backpack device, you will
139*7750d8b5SOndrej Zaryalso need to know the unit ID number for each drive.  This is usually
140*7750d8b5SOndrej Zarythe last two digits of the drive's serial number (but read MicroSolutions'
141*7750d8b5SOndrej Zarydocumentation about this).
142*7750d8b5SOndrej Zary
143246a1c4cSOndrej ZaryIf you omit the parameters from the end, defaults will be used, e.g.:
144246a1c4cSOndrej Zary
145246a1c4cSOndrej ZaryProbe all parports with all protocols::
146246a1c4cSOndrej Zary
147246a1c4cSOndrej Zary	# echo auto >/sys/bus/pata_parport/new_device
148246a1c4cSOndrej Zary
149246a1c4cSOndrej ZaryProbe parport0 using protocol epat and mode 4 (EPP-16)::
150246a1c4cSOndrej Zary
151246a1c4cSOndrej Zary	# echo "parport0 epat 4" >/sys/bus/pata_parport/new_device
152246a1c4cSOndrej Zary
153246a1c4cSOndrej ZaryProbe parport0 using all protocols::
154246a1c4cSOndrej Zary
155246a1c4cSOndrej Zary	# echo "parport0 auto" >/sys/bus/pata_parport/new_device
156246a1c4cSOndrej Zary
157246a1c4cSOndrej ZaryProbe all parports using protoocol epat::
158246a1c4cSOndrej Zary
159246a1c4cSOndrej Zary	# echo "auto epat" >/sys/bus/pata_parport/new_device
160246a1c4cSOndrej Zary
161246a1c4cSOndrej ZaryDeleting devices::
162246a1c4cSOndrej Zary
163246a1c4cSOndrej Zary	# echo pata_parport.0 >/sys/bus/pata_parport/delete_device
164*7750d8b5SOndrej Zary
165*7750d8b5SOndrej Zary
166*7750d8b5SOndrej Zary3. Troubleshooting
167*7750d8b5SOndrej Zary==================
168*7750d8b5SOndrej Zary
169*7750d8b5SOndrej Zary3.1  Use EPP mode if you can
170*7750d8b5SOndrej Zary----------------------------
171*7750d8b5SOndrej Zary
172*7750d8b5SOndrej ZaryThe most common problems that people report with the pata_parport drivers
173*7750d8b5SOndrej Zaryconcern the parallel port CMOS settings.  At this time, none of the
174*7750d8b5SOndrej Zaryprotocol modules support ECP mode, or any ECP combination modes.
175*7750d8b5SOndrej ZaryIf you are able to do so, please set your parallel port into EPP mode
176*7750d8b5SOndrej Zaryusing your CMOS setup procedure.
177*7750d8b5SOndrej Zary
178*7750d8b5SOndrej Zary3.2  Check the port delay
179*7750d8b5SOndrej Zary-------------------------
180*7750d8b5SOndrej Zary
181*7750d8b5SOndrej ZarySome parallel ports cannot reliably transfer data at full speed.  To
182*7750d8b5SOndrej Zaryoffset the errors, the protocol modules introduce a "port
183*7750d8b5SOndrej Zarydelay" between each access to the i/o ports.  Each protocol sets
184*7750d8b5SOndrej Zarya default value for this delay.  In most cases, the user can override
185*7750d8b5SOndrej Zarythe default and set it to 0 - resulting in somewhat higher transfer
186*7750d8b5SOndrej Zaryrates.  In some rare cases (especially with older 486 systems) the
187*7750d8b5SOndrej Zarydefault delays are not long enough.  if you experience corrupt data
188*7750d8b5SOndrej Zarytransfers, or unexpected failures, you may wish to increase the
189*7750d8b5SOndrej Zaryport delay.
190*7750d8b5SOndrej Zary
191*7750d8b5SOndrej Zary3.3  Some drives need a printer reset
192*7750d8b5SOndrej Zary-------------------------------------
193*7750d8b5SOndrej Zary
194*7750d8b5SOndrej ZaryThere appear to be a number of "noname" external drives on the market
195*7750d8b5SOndrej Zarythat do not always power up correctly.  We have noticed this with some
196*7750d8b5SOndrej Zarydrives based on OnSpec and older Freecom adapters.  In these rare cases,
197*7750d8b5SOndrej Zarythe adapter can often be reinitialised by issuing a "printer reset" on
198*7750d8b5SOndrej Zarythe parallel port.  As the reset operation is potentially disruptive in
199*7750d8b5SOndrej Zarymultiple device environments, the pata_parport drivers will not do it
200*7750d8b5SOndrej Zaryautomatically.  You can however, force a printer reset by doing::
201*7750d8b5SOndrej Zary
202*7750d8b5SOndrej Zary	insmod lp reset=1
203*7750d8b5SOndrej Zary	rmmod lp
204*7750d8b5SOndrej Zary
205*7750d8b5SOndrej ZaryIf you have one of these marginal cases, you should probably build
206*7750d8b5SOndrej Zaryyour pata_parport drivers as modules, and arrange to do the printer reset
207*7750d8b5SOndrej Zarybefore loading the pata_parport drivers.
208