xref: /openbmc/linux/Documentation/networking/plip.rst (revision 4b4193256c8d3bc3a5397b5cd9494c2ad386317d)
1*32c01266SMauro Carvalho Chehab.. SPDX-License-Identifier: GPL-2.0
2*32c01266SMauro Carvalho Chehab
3*32c01266SMauro Carvalho Chehab================================================
4*32c01266SMauro Carvalho ChehabPLIP: The Parallel Line Internet Protocol Device
5*32c01266SMauro Carvalho Chehab================================================
6*32c01266SMauro Carvalho Chehab
7*32c01266SMauro Carvalho ChehabDonald Becker (becker@super.org)
8*32c01266SMauro Carvalho ChehabI.D.A. Supercomputing Research Center, Bowie MD 20715
9*32c01266SMauro Carvalho Chehab
10*32c01266SMauro Carvalho ChehabAt some point T. Thorn will probably contribute text,
11*32c01266SMauro Carvalho ChehabTommy Thorn (tthorn@daimi.aau.dk)
12*32c01266SMauro Carvalho Chehab
13*32c01266SMauro Carvalho ChehabPLIP Introduction
14*32c01266SMauro Carvalho Chehab-----------------
15*32c01266SMauro Carvalho Chehab
16*32c01266SMauro Carvalho ChehabThis document describes the parallel port packet pusher for Net/LGX.
17*32c01266SMauro Carvalho ChehabThis device interface allows a point-to-point connection between two
18*32c01266SMauro Carvalho Chehabparallel ports to appear as a IP network interface.
19*32c01266SMauro Carvalho Chehab
20*32c01266SMauro Carvalho ChehabWhat is PLIP?
21*32c01266SMauro Carvalho Chehab=============
22*32c01266SMauro Carvalho Chehab
23*32c01266SMauro Carvalho ChehabPLIP is Parallel Line IP, that is, the transportation of IP packages
24*32c01266SMauro Carvalho Chehabover a parallel port. In the case of a PC, the obvious choice is the
25*32c01266SMauro Carvalho Chehabprinter port.  PLIP is a non-standard, but [can use] uses the standard
26*32c01266SMauro Carvalho ChehabLapLink null-printer cable [can also work in turbo mode, with a PLIP
27*32c01266SMauro Carvalho Chehabcable]. [The protocol used to pack IP packages, is a simple one
28*32c01266SMauro Carvalho Chehabinitiated by Crynwr.]
29*32c01266SMauro Carvalho Chehab
30*32c01266SMauro Carvalho ChehabAdvantages of PLIP
31*32c01266SMauro Carvalho Chehab==================
32*32c01266SMauro Carvalho Chehab
33*32c01266SMauro Carvalho ChehabIt's cheap, it's available everywhere, and it's easy.
34*32c01266SMauro Carvalho Chehab
35*32c01266SMauro Carvalho ChehabThe PLIP cable is all that's needed to connect two Linux boxes, and it
36*32c01266SMauro Carvalho Chehabcan be built for very few bucks.
37*32c01266SMauro Carvalho Chehab
38*32c01266SMauro Carvalho ChehabConnecting two Linux boxes takes only a second's decision and a few
39*32c01266SMauro Carvalho Chehabminutes' work, no need to search for a [supported] netcard. This might
40*32c01266SMauro Carvalho Chehabeven be especially important in the case of notebooks, where netcards
41*32c01266SMauro Carvalho Chehabare not easily available.
42*32c01266SMauro Carvalho Chehab
43*32c01266SMauro Carvalho ChehabNot requiring a netcard also means that apart from connecting the
44*32c01266SMauro Carvalho Chehabcables, everything else is software configuration [which in principle
45*32c01266SMauro Carvalho Chehabcould be made very easy.]
46*32c01266SMauro Carvalho Chehab
47*32c01266SMauro Carvalho ChehabDisadvantages of PLIP
48*32c01266SMauro Carvalho Chehab=====================
49*32c01266SMauro Carvalho Chehab
50*32c01266SMauro Carvalho ChehabDoesn't work over a modem, like SLIP and PPP. Limited range, 15 m.
51*32c01266SMauro Carvalho ChehabCan only be used to connect three (?) Linux boxes. Doesn't connect to
52*32c01266SMauro Carvalho Chehaban existing Ethernet. Isn't standard (not even de facto standard, like
53*32c01266SMauro Carvalho ChehabSLIP).
54*32c01266SMauro Carvalho Chehab
55*32c01266SMauro Carvalho ChehabPerformance
56*32c01266SMauro Carvalho Chehab===========
57*32c01266SMauro Carvalho Chehab
58*32c01266SMauro Carvalho ChehabPLIP easily outperforms Ethernet cards....(ups, I was dreaming, but
59*32c01266SMauro Carvalho Chehabit *is* getting late. EOB)
60*32c01266SMauro Carvalho Chehab
61*32c01266SMauro Carvalho ChehabPLIP driver details
62*32c01266SMauro Carvalho Chehab-------------------
63*32c01266SMauro Carvalho Chehab
64*32c01266SMauro Carvalho ChehabThe Linux PLIP driver is an implementation of the original Crynwr protocol,
65*32c01266SMauro Carvalho Chehabthat uses the parallel port subsystem of the kernel in order to properly
66*32c01266SMauro Carvalho Chehabshare parallel ports between PLIP and other services.
67*32c01266SMauro Carvalho Chehab
68*32c01266SMauro Carvalho ChehabIRQs and trigger timeouts
69*32c01266SMauro Carvalho Chehab=========================
70*32c01266SMauro Carvalho Chehab
71*32c01266SMauro Carvalho ChehabWhen a parallel port used for a PLIP driver has an IRQ configured to it, the
72*32c01266SMauro Carvalho ChehabPLIP driver is signaled whenever data is sent to it via the cable, such that
73*32c01266SMauro Carvalho Chehabwhen no data is available, the driver isn't being used.
74*32c01266SMauro Carvalho Chehab
75*32c01266SMauro Carvalho ChehabHowever, on some machines it is hard, if not impossible, to configure an IRQ
76*32c01266SMauro Carvalho Chehabto a certain parallel port, mainly because it is used by some other device.
77*32c01266SMauro Carvalho ChehabOn these machines, the PLIP driver can be used in IRQ-less mode, where
78*32c01266SMauro Carvalho Chehabthe PLIP driver would constantly poll the parallel port for data waiting,
79*32c01266SMauro Carvalho Chehaband if such data is available, process it. This mode is less efficient than
80*32c01266SMauro Carvalho Chehabthe IRQ mode, because the driver has to check the parallel port many times
81*32c01266SMauro Carvalho Chehabper second, even when no data at all is sent. Some rough measurements
82*32c01266SMauro Carvalho Chehabindicate that there isn't a noticeable performance drop when using IRQ-less
83*32c01266SMauro Carvalho Chehabmode as compared to IRQ mode as far as the data transfer speed is involved.
84*32c01266SMauro Carvalho ChehabThere is a performance drop on the machine hosting the driver.
85*32c01266SMauro Carvalho Chehab
86*32c01266SMauro Carvalho ChehabWhen the PLIP driver is used in IRQ mode, the timeout used for triggering a
87*32c01266SMauro Carvalho Chehabdata transfer (the maximal time the PLIP driver would allow the other side
88*32c01266SMauro Carvalho Chehabbefore announcing a timeout, when trying to handshake a transfer of some
89*32c01266SMauro Carvalho Chehabdata) is, by default, 500usec. As IRQ delivery is more or less immediate,
90*32c01266SMauro Carvalho Chehabthis timeout is quite sufficient.
91*32c01266SMauro Carvalho Chehab
92*32c01266SMauro Carvalho ChehabWhen in IRQ-less mode, the PLIP driver polls the parallel port HZ times
93*32c01266SMauro Carvalho Chehabper second (where HZ is typically 100 on most platforms, and 1024 on an
94*32c01266SMauro Carvalho ChehabAlpha, as of this writing). Between two such polls, there are 10^6/HZ usecs.
95*32c01266SMauro Carvalho ChehabOn an i386, for example, 10^6/100 = 10000usec. It is easy to see that it is
96*32c01266SMauro Carvalho Chehabquite possible for the trigger timeout to expire between two such polls, as
97*32c01266SMauro Carvalho Chehabthe timeout is only 500usec long. As a result, it is required to change the
98*32c01266SMauro Carvalho Chehabtrigger timeout on the *other* side of a PLIP connection, to about
99*32c01266SMauro Carvalho Chehab10^6/HZ usecs. If both sides of a PLIP connection are used in IRQ-less mode,
100*32c01266SMauro Carvalho Chehabthis timeout is required on both sides.
101*32c01266SMauro Carvalho Chehab
102*32c01266SMauro Carvalho ChehabIt appears that in practice, the trigger timeout can be shorter than in the
103*32c01266SMauro Carvalho Chehababove calculation. It isn't an important issue, unless the wire is faulty,
104*32c01266SMauro Carvalho Chehabin which case a long timeout would stall the machine when, for whatever
105*32c01266SMauro Carvalho Chehabreason, bits are dropped.
106*32c01266SMauro Carvalho Chehab
107*32c01266SMauro Carvalho ChehabA utility that can perform this change in Linux is plipconfig, which is part
108*32c01266SMauro Carvalho Chehabof the net-tools package (its location can be found in the
109*32c01266SMauro Carvalho ChehabDocumentation/Changes file). An example command would be
110*32c01266SMauro Carvalho Chehab'plipconfig plipX trigger 10000', where plipX is the appropriate
111*32c01266SMauro Carvalho ChehabPLIP device.
112*32c01266SMauro Carvalho Chehab
113*32c01266SMauro Carvalho ChehabPLIP hardware interconnection
114*32c01266SMauro Carvalho Chehab-----------------------------
115*32c01266SMauro Carvalho Chehab
116*32c01266SMauro Carvalho ChehabPLIP uses several different data transfer methods.  The first (and the
117*32c01266SMauro Carvalho Chehabonly one implemented in the early version of the code) uses a standard
118*32c01266SMauro Carvalho Chehabprinter "null" cable to transfer data four bits at a time using
119*32c01266SMauro Carvalho Chehabdata bit outputs connected to status bit inputs.
120*32c01266SMauro Carvalho Chehab
121*32c01266SMauro Carvalho ChehabThe second data transfer method relies on both machines having
122*32c01266SMauro Carvalho Chehabbi-directional parallel ports, rather than output-only ``printer``
123*32c01266SMauro Carvalho Chehabports.  This allows byte-wide transfers and avoids reconstructing
124*32c01266SMauro Carvalho Chehabnibbles into bytes, leading to much faster transfers.
125*32c01266SMauro Carvalho Chehab
126*32c01266SMauro Carvalho ChehabParallel Transfer Mode 0 Cable
127*32c01266SMauro Carvalho Chehab==============================
128*32c01266SMauro Carvalho Chehab
129*32c01266SMauro Carvalho ChehabThe cable for the first transfer mode is a standard
130*32c01266SMauro Carvalho Chehabprinter "null" cable which transfers data four bits at a time using
131*32c01266SMauro Carvalho Chehabdata bit outputs of the first port (machine T) connected to the
132*32c01266SMauro Carvalho Chehabstatus bit inputs of the second port (machine R).  There are five
133*32c01266SMauro Carvalho Chehabstatus inputs, and they are used as four data inputs and a clock (data
134*32c01266SMauro Carvalho Chehabstrobe) input, arranged so that the data input bits appear as contiguous
135*32c01266SMauro Carvalho Chehabbits with standard status register implementation.
136*32c01266SMauro Carvalho Chehab
137*32c01266SMauro Carvalho ChehabA cable that implements this protocol is available commercially as a
138*32c01266SMauro Carvalho Chehab"Null Printer" or "Turbo Laplink" cable.  It can be constructed with
139*32c01266SMauro Carvalho Chehabtwo DB-25 male connectors symmetrically connected as follows::
140*32c01266SMauro Carvalho Chehab
141*32c01266SMauro Carvalho Chehab    STROBE output	1*
142*32c01266SMauro Carvalho Chehab    D0->ERROR	2 - 15		15 - 2
143*32c01266SMauro Carvalho Chehab    D1->SLCT	3 - 13		13 - 3
144*32c01266SMauro Carvalho Chehab    D2->PAPOUT	4 - 12		12 - 4
145*32c01266SMauro Carvalho Chehab    D3->ACK	5 - 10		10 - 5
146*32c01266SMauro Carvalho Chehab    D4->BUSY	6 - 11		11 - 6
147*32c01266SMauro Carvalho Chehab    D5,D6,D7 are   7*, 8*, 9*
148*32c01266SMauro Carvalho Chehab    AUTOFD output 14*
149*32c01266SMauro Carvalho Chehab    INIT   output 16*
150*32c01266SMauro Carvalho Chehab    SLCTIN	17 - 17
151*32c01266SMauro Carvalho Chehab    extra grounds are 18*,19*,20*,21*,22*,23*,24*
152*32c01266SMauro Carvalho Chehab    GROUND	25 - 25
153*32c01266SMauro Carvalho Chehab
154*32c01266SMauro Carvalho Chehab    * Do not connect these pins on either end
155*32c01266SMauro Carvalho Chehab
156*32c01266SMauro Carvalho ChehabIf the cable you are using has a metallic shield it should be
157*32c01266SMauro Carvalho Chehabconnected to the metallic DB-25 shell at one end only.
158*32c01266SMauro Carvalho Chehab
159*32c01266SMauro Carvalho ChehabParallel Transfer Mode 1
160*32c01266SMauro Carvalho Chehab========================
161*32c01266SMauro Carvalho Chehab
162*32c01266SMauro Carvalho ChehabThe second data transfer method relies on both machines having
163*32c01266SMauro Carvalho Chehabbi-directional parallel ports, rather than output-only ``printer``
164*32c01266SMauro Carvalho Chehabports.  This allows byte-wide transfers, and avoids reconstructing
165*32c01266SMauro Carvalho Chehabnibbles into bytes.  This cable should not be used on unidirectional
166*32c01266SMauro Carvalho Chehab``printer`` (as opposed to ``parallel``) ports or when the machine
167*32c01266SMauro Carvalho Chehabisn't configured for PLIP, as it will result in output driver
168*32c01266SMauro Carvalho Chehabconflicts and the (unlikely) possibility of damage.
169*32c01266SMauro Carvalho Chehab
170*32c01266SMauro Carvalho ChehabThe cable for this transfer mode should be constructed as follows::
171*32c01266SMauro Carvalho Chehab
172*32c01266SMauro Carvalho Chehab    STROBE->BUSY 1 - 11
173*32c01266SMauro Carvalho Chehab    D0->D0	2 - 2
174*32c01266SMauro Carvalho Chehab    D1->D1	3 - 3
175*32c01266SMauro Carvalho Chehab    D2->D2	4 - 4
176*32c01266SMauro Carvalho Chehab    D3->D3	5 - 5
177*32c01266SMauro Carvalho Chehab    D4->D4	6 - 6
178*32c01266SMauro Carvalho Chehab    D5->D5	7 - 7
179*32c01266SMauro Carvalho Chehab    D6->D6	8 - 8
180*32c01266SMauro Carvalho Chehab    D7->D7	9 - 9
181*32c01266SMauro Carvalho Chehab    INIT -> ACK  16 - 10
182*32c01266SMauro Carvalho Chehab    AUTOFD->PAPOUT 14 - 12
183*32c01266SMauro Carvalho Chehab    SLCT->SLCTIN 13 - 17
184*32c01266SMauro Carvalho Chehab    GND->ERROR	18 - 15
185*32c01266SMauro Carvalho Chehab    extra grounds are 19*,20*,21*,22*,23*,24*
186*32c01266SMauro Carvalho Chehab    GROUND	25 - 25
187*32c01266SMauro Carvalho Chehab
188*32c01266SMauro Carvalho Chehab    * Do not connect these pins on either end
189*32c01266SMauro Carvalho Chehab
190*32c01266SMauro Carvalho ChehabOnce again, if the cable you are using has a metallic shield it should
191*32c01266SMauro Carvalho Chehabbe connected to the metallic DB-25 shell at one end only.
192*32c01266SMauro Carvalho Chehab
193*32c01266SMauro Carvalho ChehabPLIP Mode 0 transfer protocol
194*32c01266SMauro Carvalho Chehab=============================
195*32c01266SMauro Carvalho Chehab
196*32c01266SMauro Carvalho ChehabThe PLIP driver is compatible with the "Crynwr" parallel port transfer
197*32c01266SMauro Carvalho Chehabstandard in Mode 0.  That standard specifies the following protocol::
198*32c01266SMauro Carvalho Chehab
199*32c01266SMauro Carvalho Chehab   send header nibble '0x8'
200*32c01266SMauro Carvalho Chehab   count-low octet
201*32c01266SMauro Carvalho Chehab   count-high octet
202*32c01266SMauro Carvalho Chehab   ... data octets
203*32c01266SMauro Carvalho Chehab   checksum octet
204*32c01266SMauro Carvalho Chehab
205*32c01266SMauro Carvalho ChehabEach octet is sent as::
206*32c01266SMauro Carvalho Chehab
207*32c01266SMauro Carvalho Chehab	<wait for rx. '0x1?'>	<send 0x10+(octet&0x0F)>
208*32c01266SMauro Carvalho Chehab	<wait for rx. '0x0?'>	<send 0x00+((octet>>4)&0x0F)>
209*32c01266SMauro Carvalho Chehab
210*32c01266SMauro Carvalho ChehabTo start a transfer the transmitting machine outputs a nibble 0x08.
211*32c01266SMauro Carvalho ChehabThat raises the ACK line, triggering an interrupt in the receiving
212*32c01266SMauro Carvalho Chehabmachine.  The receiving machine disables interrupts and raises its own ACK
213*32c01266SMauro Carvalho Chehabline.
214*32c01266SMauro Carvalho Chehab
215*32c01266SMauro Carvalho ChehabRestated::
216*32c01266SMauro Carvalho Chehab
217*32c01266SMauro Carvalho Chehab  (OUT is bit 0-4, OUT.j is bit j from OUT. IN likewise)
218*32c01266SMauro Carvalho Chehab  Send_Byte:
219*32c01266SMauro Carvalho Chehab     OUT := low nibble, OUT.4 := 1
220*32c01266SMauro Carvalho Chehab     WAIT FOR IN.4 = 1
221*32c01266SMauro Carvalho Chehab     OUT := high nibble, OUT.4 := 0
222*32c01266SMauro Carvalho Chehab     WAIT FOR IN.4 = 0
223