This document describes the "ATP" Linux driver for commonly OEMed pocket (parallel port) ethernet adapters based on the Realtek RTL8002 and RTL8012 chips.
I've updated the "atp" driver for the RTL8002 based on the RTL8012 datasheet. The new driver should work with both chips, but I don't have a RTL8012 device to test with.
The new driver adds the following features over the v2.0.29 kernel version:
The following files are drop-in replacements for drivers/net/atp.[ch]:
A diagnostic program is available from cesdis.gsfc.nasa.gov:/pub/linux/diag/atp-diag.c. It is one of the extensive Linux network adapter diagnostic and setup programs.
In 1997 Realtek made available the documentation for the second generation RTL8012 chip, which has lead to several driver improvements. http://www.realtek.com.tw/cn/cn.html.
A future driver might add the bi-directional and ECP modes for the RTL8012.
The RTL8002 adapter seems to be built around a custom spin of the SEEQ controller core. It has a 32K internal packet buffer, of which the first 4K is devoted to transmit and the rest to receive. The controller maintains the queue of received packet and the packet buffer access pointer internally, with only 'reset to beginning' and 'skip to next packet' commands visible. The transmit packet queue holds two packets: both 'retransmit this packet' (due to collision) and 'transmit next packet' commands must be started by hand.
The station address is stored in a standard bit-serial EEPROM which must be read (ughh) by the device driver. Provisions exist in the chip for substituting a 74S288 PROM, but I haven't gotten reports of any models using it.
Unlike built-in devices, a pocket adapter can temporarily lose power without indication to the device driver. Thus the driver monitors for transmit timeouts or lack of receive activity and reinitializes the station address, receive filter (promiscuous, etc.) and transceiver.
The controller itself has two pages of 16 registers. The first bank contains contains the station address setting, and the second bank contains the multicast filter table (now used) and the EEPROM access registers. Most of the operational registers are visible in either bank. The registers are read and written 4 bits at a time in the basic printer-port mode. The four bit register address is presented on the data lines along with a few additional timing and control bits. The data is then read from status port or written to the data port.
Since the bulk data transfer of the actual packets through the slow parallel port dominates the driver's running time, four distinct data (non-register) transfer modes are provided by the adapter, two in each direction. In the first mode timing for the nibble transfers is provided through the data port. In the second mode the same timing is provided through the control port. In either case the data is read from the status port and written to the data port, just as when accessing registers.
In addition to the basic data transfer methods, several other transfer modes are supported. These are implemented by doing multiple reads of the data lines to allow them to stabilize. This delay seems to be needed on most machines. The data transfer mode is stored in the 'dev->if_port' field. Its default value is '4'. It may be overridden at boot-time using the third parameter to the "ether=..." initialization.
Bulk data writes to the packet buffer:
The first, faster method uses only the dataport (data modes 0, 2 and 4). The second (backup) method uses data and control regs (modes 1, 3 and 5). It should only be needed when there is skew between the individual data lines, or on some very old laptops where the high-order line of the printer port is used for some other purpose.
The header file "atp.h" provides inline functions that encapsulate the register and data access methods. These functions are hand-tuned to generate reasonable object code. This header file also documents my interpretations of the device registers.
Linux at CESDIS