3 Under the terms of the GNU General Public License.
5 fit2.c is a low-level protocol driver for the older version
6 of the Fidelity International Technology parallel port adapter.
7 This adapter is used in their TransDisk 2000 and older TransDisk
8 3000 portable hard-drives. As far as I can tell, this device
9 supports 4-bit mode _only_.
11 Newer models of the FIT products use an enhanced protocol.
12 The "fit3" protocol module should support current drives.
16 #include <linux/module.h>
17 #include <linux/init.h>
18 #include <linux/delay.h>
19 #include <linux/kernel.h>
20 #include <linux/types.h>
21 #include <linux/wait.h>
23 #include "pata_parport.h"
25 #define j44(a,b) (((a>>4)&0x0f)|(b&0xf0))
27 /* cont = 0 - access the IDE register file
28 cont = 1 - access the IDE command set
30 NB: The FIT adapter does not appear to use the control registers.
31 So, we map ALT_STATUS to STATUS and NO-OP writes to the device
32 control register - this means that IDE reset will not work on these
37 static void fit2_write_regr(struct pi_adapter *pi, int cont, int regr, int val)
39 { if (cont == 1) return;
40 w2(0xc); w0(regr); w2(4); w0(val); w2(5); w0(0); w2(4);
43 static int fit2_read_regr(struct pi_adapter *pi, int cont, int regr)
48 if (regr != 6) return 0xff;
50 } else r = regr + 0x10;
52 w2(0xc); w0(r); w2(4); w2(5);
61 static void fit2_read_block(struct pi_adapter *pi, char *buf, int count)
67 for (k=0;k<count/4;k++) {
70 w0(0); a = r1(); w0(1); b = r1();
71 w0(3); c = r1(); w0(2); d = r1();
72 buf[4*k+0] = j44(a,b);
73 buf[4*k+1] = j44(d,c);
76 a = r1(); w0(3); b = r1();
77 w0(1); c = r1(); w0(0); d = r1();
78 buf[4*k+2] = j44(d,c);
79 buf[4*k+3] = j44(a,b);
87 static void fit2_write_block(struct pi_adapter *pi, char *buf, int count)
93 for (k=0;k<count/2;k++) {
95 w2(5); w0(buf[2*k+1]);
100 static void fit2_connect(struct pi_adapter *pi)
102 { pi->saved_r0 = r0();
107 static void fit2_disconnect(struct pi_adapter *pi)
113 static void fit2_log_adapter(struct pi_adapter *pi)
116 dev_info(&pi->dev, "FIT 2000 adapter at 0x%x, delay %d\n",
117 pi->port, pi->delay);
121 static struct pi_protocol fit2 = {
122 .owner = THIS_MODULE,
128 .write_regr = fit2_write_regr,
129 .read_regr = fit2_read_regr,
130 .write_block = fit2_write_block,
131 .read_block = fit2_read_block,
132 .connect = fit2_connect,
133 .disconnect = fit2_disconnect,
134 .log_adapter = fit2_log_adapter,
137 MODULE_LICENSE("GPL");
138 module_pata_parport_driver(fit2);