Lines Matching +full:0 +full:- +full:4
2 kbic.c (c) 1997-8 Grant R. Guenther <grant@torque.net>
5 This is a low-level driver for the KBIC-951A and KBIC-971A
33 #define r12w() (delay_p,inw(pi->port+1)&0xffff)
35 #define j44(a,b) ((((a>>4)&0x0f)|(b&0xf0))^0x88)
36 #define j53(w) (((w>>3)&0x1f)|((w>>4)&0xe0))
39 /* cont = 0 - access the IDE register file
40 cont = 1 - access the IDE command set
43 static int cont_map[2] = { 0x80, 0x40 };
51 switch (pi->mode) { in kbic_read_regr()
53 case 0: w0(regr|0x18|s); w2(4); w2(6); w2(4); w2(1); w0(8); in kbic_read_regr()
54 a = r1(); w0(0x28); b = r1(); w2(4); in kbic_read_regr()
57 case 1: w0(regr|0x38|s); w2(4); w2(6); w2(4); w2(5); w0(8); in kbic_read_regr()
58 a = r12w(); w2(4); in kbic_read_regr()
61 case 2: w0(regr|0x08|s); w2(4); w2(6); w2(4); w2(0xa5); w2(0xa1); in kbic_read_regr()
62 a = r0(); w2(4); in kbic_read_regr()
66 case 4: in kbic_read_regr()
67 case 5: w0(0x20|s); w2(4); w2(6); w2(4); w3(regr); in kbic_read_regr()
68 a = r4(); b = r4(); w2(4); w2(0); w2(4); in kbic_read_regr()
72 return -1; in kbic_read_regr()
81 switch (pi->mode) { in kbic_write_regr()
83 case 0: in kbic_write_regr()
85 case 2: w0(regr|0x10|s); w2(4); w2(6); w2(4); in kbic_write_regr()
86 w0(val); w2(5); w2(4); in kbic_write_regr()
90 case 4: in kbic_write_regr()
91 case 5: w0(0x20|s); w2(4); w2(6); w2(4); w3(regr); in kbic_write_regr()
93 w2(4); w2(0); w2(4); in kbic_write_regr()
101 { pi->saved_r0 = r0(); in k951_connect()
102 pi->saved_r2 = r2(); in k951_connect()
103 w2(4); in k951_connect()
108 { w0(pi->saved_r0); in k951_disconnect()
109 w2(pi->saved_r2); in k951_disconnect()
112 #define CCP(x) w2(0xc4);w0(0xaa);w0(0x55);w0(0);w0(0xff);w0(0x87);\
113 w0(0x78);w0(x);w2(0xc5);w2(0xc4);w0(0xff);
117 { pi->saved_r0 = r0(); in k971_connect()
118 pi->saved_r2 = r2(); in k971_connect()
119 CCP(0x20); in k971_connect()
120 w2(4); in k971_connect()
125 { CCP(0x30); in k971_disconnect()
126 w0(pi->saved_r0); in k971_disconnect()
127 w2(pi->saved_r2); in k971_disconnect()
130 /* counts must be congruent to 0 MOD 4, but all known applications
138 switch (pi->mode) { in kbic_read_block()
140 case 0: w0(0x98); w2(4); w2(6); w2(4); in kbic_read_block()
141 for (k=0;k<count/2;k++) { in kbic_read_block()
143 w0(0x28); b = r1(); in kbic_read_block()
148 w2(4); in kbic_read_block()
152 case 1: w0(0xb8); w2(4); w2(6); w2(4); in kbic_read_block()
153 for (k=0;k<count/4;k++) { in kbic_read_block()
154 w0(0xb8); in kbic_read_block()
155 w2(4); w2(5); in kbic_read_block()
156 w0(8); buf[4*k] = j53(r12w()); in kbic_read_block()
157 w0(0xb8); buf[4*k+1] = j53(r12w()); in kbic_read_block()
158 w2(4); w2(5); in kbic_read_block()
159 buf[4*k+3] = j53(r12w()); in kbic_read_block()
160 w0(8); buf[4*k+2] = j53(r12w()); in kbic_read_block()
162 w2(4); in kbic_read_block()
165 case 2: w0(0x88); w2(4); w2(6); w2(4); in kbic_read_block()
166 for (k=0;k<count/2;k++) { in kbic_read_block()
167 w2(0xa0); w2(0xa1); buf[2*k] = r0(); in kbic_read_block()
168 w2(0xa5); buf[2*k+1] = r0(); in kbic_read_block()
170 w2(4); in kbic_read_block()
173 case 3: w0(0xa0); w2(4); w2(6); w2(4); w3(0); in kbic_read_block()
174 for (k=0;k<count;k++) buf[k] = r4(); in kbic_read_block()
175 w2(4); w2(0); w2(4); in kbic_read_block()
178 case 4: w0(0xa0); w2(4); w2(6); w2(4); w3(0); in kbic_read_block()
179 for (k=0;k<count/2;k++) ((u16 *)buf)[k] = r4w(); in kbic_read_block()
180 w2(4); w2(0); w2(4); in kbic_read_block()
183 case 5: w0(0xa0); w2(4); w2(6); w2(4); w3(0); in kbic_read_block()
184 for (k=0;k<count/4;k++) ((u32 *)buf)[k] = r4l(); in kbic_read_block()
185 w2(4); w2(0); w2(4); in kbic_read_block()
196 switch (pi->mode) { in kbic_write_block()
198 case 0: in kbic_write_block()
200 case 2: w0(0x90); w2(4); w2(6); w2(4); in kbic_write_block()
201 for(k=0;k<count/2;k++) { in kbic_write_block()
202 w0(buf[2*k+1]); w2(0); w2(4); in kbic_write_block()
203 w0(buf[2*k]); w2(5); w2(4); in kbic_write_block()
207 case 3: w0(0xa0); w2(4); w2(6); w2(4); w3(0); in kbic_write_block()
208 for(k=0;k<count/2;k++) { in kbic_write_block()
212 w2(4); w2(0); w2(4); in kbic_write_block()
215 case 4: w0(0xa0); w2(4); w2(6); w2(4); w3(0); in kbic_write_block()
216 for(k=0;k<count/2;k++) w4w(pi_swab16(buf,k)); in kbic_write_block()
217 w2(4); w2(0); w2(4); in kbic_write_block()
220 case 5: w0(0xa0); w2(4); w2(6); w2(4); w3(0); in kbic_write_block()
221 for(k=0;k<count/4;k++) w4l(pi_swab32(buf,k)); in kbic_write_block()
222 w2(4); w2(0); w2(4); in kbic_write_block()
232 { char *mode_string[6] = {"4-bit","5/3","8-bit", in kbic_log_adapter()
233 "EPP-8","EPP_16","EPP-32"}; in kbic_log_adapter()
235 printk("%s: kbic %s, KingByte %s at 0x%x, ", in kbic_log_adapter()
236 pi->device,KBIC_VERSION,chip,pi->port); in kbic_log_adapter()
237 printk("mode %d (%s), delay %d\n",pi->mode, in kbic_log_adapter()
238 mode_string[pi->mode],pi->delay); in kbic_log_adapter()
244 { kbic_log_adapter(pi,scratch,verbose,"KBIC-951A"); in k951_log_adapter()
249 { kbic_log_adapter(pi,scratch,verbose,"KBIC-971A"); in k971_log_adapter()
289 if (rv < 0) in kbic_init()
292 if (rv < 0) in kbic_init()