19 #define ON26_VERSION "1.04"
21 #include <linux/module.h>
24 #include <linux/kernel.h>
25 #include <linux/types.h>
26 #include <linux/wait.h>
38 #define j44(a,b) (((a>>4)&0x0f)|(b&0xf0))
40 #define P1 w2(5);w2(0xd);w2(5);w2(0xd);w2(5);w2(4);
41 #define P2 w2(5);w2(7);w2(5);w2(4);
47 static int on26_read_regr(
PIA *pi,
int cont,
int regr )
51 r = (regr<<2) + 1 + cont;
76 static void on26_write_regr(
PIA *pi,
int cont,
int regr,
int val )
80 r = (regr<<2) + 1 + cont;
99 #define CCP(x) w0(0xfe);w0(0xaa);w0(0x55);w0(0);w0(0xff);\
100 w0(0x87);w0(0x78);w0(x);w2(4);w2(5);w2(4);w0(0xff);
102 static void on26_connect (
PIA *pi )
110 x = 8;
if (pi->
mode) x = 9;
116 static void on26_disconnect (
PIA *pi )
125 #define RESET_WAIT 200
127 static int on26_test_port(
PIA *pi)
129 {
int i,
m,
d,
x=0,
y=0;
144 i = ((
r1() & 0xf0) << 4);
w0(0x87);
145 i |= (
r1() & 0xf0);
w0(0x78);
147 i |= ((
r1() & 0xf0) >> 4);
158 on26_write_regr(pi,0,6,0xa0);
161 on26_write_regr(pi,0,6,0xa0);
162 x = on26_read_regr(pi,0,7);
163 on26_write_regr(pi,0,6,0xb0);
164 y = on26_read_regr(pi,0,7);
165 if (!((x&0x80)||(
y&0x80)))
break;
170 printk(
"on26: Device reset failed (%x,%x)\n",x,
y);
186 static void on26_read_block(
PIA *pi,
char *
buf,
int count )
194 for (k=0;k<
count;k++) {
204 for (k=0;k<count/2;k++) {
205 w2(0x26); buf[2*
k] =
r0();
206 w2(0x24); buf[2*k+1] =
r0();
214 for (k=0;k<
count;k++) buf[k] =
r4();
221 for (k=0;k<count/2;k++) ((
u16 *)buf)[
k] =
r4w();
228 for (k=0;k<count/4;k++) ((
u32 *)buf)[
k] =
r4l();
235 static void on26_write_block(
PIA *pi,
char * buf,
int count )
245 for (k=0;k<count/2;k++) {
247 w2(7);
w0(buf[2*k+1]);
256 for (k=0;k<
count;k++)
w4(buf[k]);
263 for (k=0;k<count/2;k++)
w4w(((
u16 *)buf)[k]);
270 for (k=0;k<count/4;k++)
w4l(((
u32 *)buf)[k]);
280 {
char *mode_string[5] = {
"4-bit",
"8-bit",
"EPP-8",
283 printk(
"%s: on26 %s, OnSpec 90c26 at 0x%x, ",
297 .write_regr = on26_write_regr,
298 .read_regr = on26_read_regr,
299 .write_block = on26_write_block,
300 .read_block = on26_read_block,
301 .connect = on26_connect,
302 .disconnect = on26_disconnect,
303 .test_port = on26_test_port,
304 .log_adapter = on26_log_adapter,
307 static int __init on26_init(
void)
312 static void __exit on26_exit(
void)