diff options
-rw-r--r-- | drivers/parport/parport_pc.c | 1746 |
1 files changed, 916 insertions, 830 deletions
diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c index 24984c4a1ba4..edf83e945853 100644 --- a/drivers/parport/parport_pc.c +++ b/drivers/parport/parport_pc.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Low-level parallel-port routines for 8255-based PC-style hardware. | 1 | /* Low-level parallel-port routines for 8255-based PC-style hardware. |
2 | * | 2 | * |
3 | * Authors: Phil Blundell <philb@gnu.org> | 3 | * Authors: Phil Blundell <philb@gnu.org> |
4 | * Tim Waugh <tim@cyberelk.demon.co.uk> | 4 | * Tim Waugh <tim@cyberelk.demon.co.uk> |
5 | * Jose Renau <renau@acm.org> | 5 | * Jose Renau <renau@acm.org> |
@@ -11,7 +11,7 @@ | |||
11 | * Cleaned up include files - Russell King <linux@arm.uk.linux.org> | 11 | * Cleaned up include files - Russell King <linux@arm.uk.linux.org> |
12 | * DMA support - Bert De Jonghe <bert@sophis.be> | 12 | * DMA support - Bert De Jonghe <bert@sophis.be> |
13 | * Many ECP bugs fixed. Fred Barnes & Jamie Lokier, 1999 | 13 | * Many ECP bugs fixed. Fred Barnes & Jamie Lokier, 1999 |
14 | * More PCI support now conditional on CONFIG_PCI, 03/2001, Paul G. | 14 | * More PCI support now conditional on CONFIG_PCI, 03/2001, Paul G. |
15 | * Various hacks, Fred Barnes, 04/2001 | 15 | * Various hacks, Fred Barnes, 04/2001 |
16 | * Updated probing logic - Adam Belay <ambx1@neo.rr.com> | 16 | * Updated probing logic - Adam Belay <ambx1@neo.rr.com> |
17 | */ | 17 | */ |
@@ -56,10 +56,10 @@ | |||
56 | #include <linux/pnp.h> | 56 | #include <linux/pnp.h> |
57 | #include <linux/platform_device.h> | 57 | #include <linux/platform_device.h> |
58 | #include <linux/sysctl.h> | 58 | #include <linux/sysctl.h> |
59 | #include <linux/io.h> | ||
60 | #include <linux/uaccess.h> | ||
59 | 61 | ||
60 | #include <asm/io.h> | ||
61 | #include <asm/dma.h> | 62 | #include <asm/dma.h> |
62 | #include <asm/uaccess.h> | ||
63 | 63 | ||
64 | #include <linux/parport.h> | 64 | #include <linux/parport.h> |
65 | #include <linux/parport_pc.h> | 65 | #include <linux/parport_pc.h> |
@@ -82,7 +82,7 @@ | |||
82 | #define ECR_TST 06 | 82 | #define ECR_TST 06 |
83 | #define ECR_CNF 07 | 83 | #define ECR_CNF 07 |
84 | #define ECR_MODE_MASK 0xe0 | 84 | #define ECR_MODE_MASK 0xe0 |
85 | #define ECR_WRITE(p,v) frob_econtrol((p),0xff,(v)) | 85 | #define ECR_WRITE(p, v) frob_econtrol((p), 0xff, (v)) |
86 | 86 | ||
87 | #undef DEBUG | 87 | #undef DEBUG |
88 | 88 | ||
@@ -109,27 +109,27 @@ static int pci_registered_parport; | |||
109 | static int pnp_registered_parport; | 109 | static int pnp_registered_parport; |
110 | 110 | ||
111 | /* frob_control, but for ECR */ | 111 | /* frob_control, but for ECR */ |
112 | static void frob_econtrol (struct parport *pb, unsigned char m, | 112 | static void frob_econtrol(struct parport *pb, unsigned char m, |
113 | unsigned char v) | 113 | unsigned char v) |
114 | { | 114 | { |
115 | unsigned char ectr = 0; | 115 | unsigned char ectr = 0; |
116 | 116 | ||
117 | if (m != 0xff) | 117 | if (m != 0xff) |
118 | ectr = inb (ECONTROL (pb)); | 118 | ectr = inb(ECONTROL(pb)); |
119 | 119 | ||
120 | DPRINTK (KERN_DEBUG "frob_econtrol(%02x,%02x): %02x -> %02x\n", | 120 | DPRINTK(KERN_DEBUG "frob_econtrol(%02x,%02x): %02x -> %02x\n", |
121 | m, v, ectr, (ectr & ~m) ^ v); | 121 | m, v, ectr, (ectr & ~m) ^ v); |
122 | 122 | ||
123 | outb ((ectr & ~m) ^ v, ECONTROL (pb)); | 123 | outb((ectr & ~m) ^ v, ECONTROL(pb)); |
124 | } | 124 | } |
125 | 125 | ||
126 | static __inline__ void frob_set_mode (struct parport *p, int mode) | 126 | static inline void frob_set_mode(struct parport *p, int mode) |
127 | { | 127 | { |
128 | frob_econtrol (p, ECR_MODE_MASK, mode << 5); | 128 | frob_econtrol(p, ECR_MODE_MASK, mode << 5); |
129 | } | 129 | } |
130 | 130 | ||
131 | #ifdef CONFIG_PARPORT_PC_FIFO | 131 | #ifdef CONFIG_PARPORT_PC_FIFO |
132 | /* Safely change the mode bits in the ECR | 132 | /* Safely change the mode bits in the ECR |
133 | Returns: | 133 | Returns: |
134 | 0 : Success | 134 | 0 : Success |
135 | -EBUSY: Could not drain FIFO in some finite amount of time, | 135 | -EBUSY: Could not drain FIFO in some finite amount of time, |
@@ -141,17 +141,18 @@ static int change_mode(struct parport *p, int m) | |||
141 | unsigned char oecr; | 141 | unsigned char oecr; |
142 | int mode; | 142 | int mode; |
143 | 143 | ||
144 | DPRINTK(KERN_INFO "parport change_mode ECP-ISA to mode 0x%02x\n",m); | 144 | DPRINTK(KERN_INFO "parport change_mode ECP-ISA to mode 0x%02x\n", m); |
145 | 145 | ||
146 | if (!priv->ecr) { | 146 | if (!priv->ecr) { |
147 | printk (KERN_DEBUG "change_mode: but there's no ECR!\n"); | 147 | printk(KERN_DEBUG "change_mode: but there's no ECR!\n"); |
148 | return 0; | 148 | return 0; |
149 | } | 149 | } |
150 | 150 | ||
151 | /* Bits <7:5> contain the mode. */ | 151 | /* Bits <7:5> contain the mode. */ |
152 | oecr = inb (ECONTROL (p)); | 152 | oecr = inb(ECONTROL(p)); |
153 | mode = (oecr >> 5) & 0x7; | 153 | mode = (oecr >> 5) & 0x7; |
154 | if (mode == m) return 0; | 154 | if (mode == m) |
155 | return 0; | ||
155 | 156 | ||
156 | if (mode >= 2 && !(priv->ctr & 0x20)) { | 157 | if (mode >= 2 && !(priv->ctr & 0x20)) { |
157 | /* This mode resets the FIFO, so we may | 158 | /* This mode resets the FIFO, so we may |
@@ -163,19 +164,21 @@ static int change_mode(struct parport *p, int m) | |||
163 | case ECR_ECP: /* ECP Parallel Port mode */ | 164 | case ECR_ECP: /* ECP Parallel Port mode */ |
164 | /* Busy wait for 200us */ | 165 | /* Busy wait for 200us */ |
165 | for (counter = 0; counter < 40; counter++) { | 166 | for (counter = 0; counter < 40; counter++) { |
166 | if (inb (ECONTROL (p)) & 0x01) | 167 | if (inb(ECONTROL(p)) & 0x01) |
167 | break; | 168 | break; |
168 | if (signal_pending (current)) break; | 169 | if (signal_pending(current)) |
169 | udelay (5); | 170 | break; |
171 | udelay(5); | ||
170 | } | 172 | } |
171 | 173 | ||
172 | /* Poll slowly. */ | 174 | /* Poll slowly. */ |
173 | while (!(inb (ECONTROL (p)) & 0x01)) { | 175 | while (!(inb(ECONTROL(p)) & 0x01)) { |
174 | if (time_after_eq (jiffies, expire)) | 176 | if (time_after_eq(jiffies, expire)) |
175 | /* The FIFO is stuck. */ | 177 | /* The FIFO is stuck. */ |
176 | return -EBUSY; | 178 | return -EBUSY; |
177 | schedule_timeout_interruptible(msecs_to_jiffies(10)); | 179 | schedule_timeout_interruptible( |
178 | if (signal_pending (current)) | 180 | msecs_to_jiffies(10)); |
181 | if (signal_pending(current)) | ||
179 | break; | 182 | break; |
180 | } | 183 | } |
181 | } | 184 | } |
@@ -185,20 +188,20 @@ static int change_mode(struct parport *p, int m) | |||
185 | /* We have to go through mode 001 */ | 188 | /* We have to go through mode 001 */ |
186 | oecr &= ~(7 << 5); | 189 | oecr &= ~(7 << 5); |
187 | oecr |= ECR_PS2 << 5; | 190 | oecr |= ECR_PS2 << 5; |
188 | ECR_WRITE (p, oecr); | 191 | ECR_WRITE(p, oecr); |
189 | } | 192 | } |
190 | 193 | ||
191 | /* Set the mode. */ | 194 | /* Set the mode. */ |
192 | oecr &= ~(7 << 5); | 195 | oecr &= ~(7 << 5); |
193 | oecr |= m << 5; | 196 | oecr |= m << 5; |
194 | ECR_WRITE (p, oecr); | 197 | ECR_WRITE(p, oecr); |
195 | return 0; | 198 | return 0; |
196 | } | 199 | } |
197 | 200 | ||
198 | #ifdef CONFIG_PARPORT_1284 | 201 | #ifdef CONFIG_PARPORT_1284 |
199 | /* Find FIFO lossage; FIFO is reset */ | 202 | /* Find FIFO lossage; FIFO is reset */ |
200 | #if 0 | 203 | #if 0 |
201 | static int get_fifo_residue (struct parport *p) | 204 | static int get_fifo_residue(struct parport *p) |
202 | { | 205 | { |
203 | int residue; | 206 | int residue; |
204 | int cnfga; | 207 | int cnfga; |
@@ -206,26 +209,26 @@ static int get_fifo_residue (struct parport *p) | |||
206 | 209 | ||
207 | /* Adjust for the contents of the FIFO. */ | 210 | /* Adjust for the contents of the FIFO. */ |
208 | for (residue = priv->fifo_depth; ; residue--) { | 211 | for (residue = priv->fifo_depth; ; residue--) { |
209 | if (inb (ECONTROL (p)) & 0x2) | 212 | if (inb(ECONTROL(p)) & 0x2) |
210 | /* Full up. */ | 213 | /* Full up. */ |
211 | break; | 214 | break; |
212 | 215 | ||
213 | outb (0, FIFO (p)); | 216 | outb(0, FIFO(p)); |
214 | } | 217 | } |
215 | 218 | ||
216 | printk (KERN_DEBUG "%s: %d PWords were left in FIFO\n", p->name, | 219 | printk(KERN_DEBUG "%s: %d PWords were left in FIFO\n", p->name, |
217 | residue); | 220 | residue); |
218 | 221 | ||
219 | /* Reset the FIFO. */ | 222 | /* Reset the FIFO. */ |
220 | frob_set_mode (p, ECR_PS2); | 223 | frob_set_mode(p, ECR_PS2); |
221 | 224 | ||
222 | /* Now change to config mode and clean up. FIXME */ | 225 | /* Now change to config mode and clean up. FIXME */ |
223 | frob_set_mode (p, ECR_CNF); | 226 | frob_set_mode(p, ECR_CNF); |
224 | cnfga = inb (CONFIGA (p)); | 227 | cnfga = inb(CONFIGA(p)); |
225 | printk (KERN_DEBUG "%s: cnfgA contains 0x%02x\n", p->name, cnfga); | 228 | printk(KERN_DEBUG "%s: cnfgA contains 0x%02x\n", p->name, cnfga); |
226 | 229 | ||
227 | if (!(cnfga & (1<<2))) { | 230 | if (!(cnfga & (1<<2))) { |
228 | printk (KERN_DEBUG "%s: Accounting for extra byte\n", p->name); | 231 | printk(KERN_DEBUG "%s: Accounting for extra byte\n", p->name); |
229 | residue++; | 232 | residue++; |
230 | } | 233 | } |
231 | 234 | ||
@@ -233,9 +236,11 @@ static int get_fifo_residue (struct parport *p) | |||
233 | * PWord != 1 byte. */ | 236 | * PWord != 1 byte. */ |
234 | 237 | ||
235 | /* Back to PS2 mode. */ | 238 | /* Back to PS2 mode. */ |
236 | frob_set_mode (p, ECR_PS2); | 239 | frob_set_mode(p, ECR_PS2); |
237 | 240 | ||
238 | DPRINTK (KERN_DEBUG "*** get_fifo_residue: done residue collecting (ecr = 0x%2.2x)\n", inb (ECONTROL (p))); | 241 | DPRINTK(KERN_DEBUG |
242 | "*** get_fifo_residue: done residue collecting (ecr = 0x%2.2x)\n", | ||
243 | inb(ECONTROL(p))); | ||
239 | return residue; | 244 | return residue; |
240 | } | 245 | } |
241 | #endif /* 0 */ | 246 | #endif /* 0 */ |
@@ -257,8 +262,8 @@ static int clear_epp_timeout(struct parport *pb) | |||
257 | /* To clear timeout some chips require double read */ | 262 | /* To clear timeout some chips require double read */ |
258 | parport_pc_read_status(pb); | 263 | parport_pc_read_status(pb); |
259 | r = parport_pc_read_status(pb); | 264 | r = parport_pc_read_status(pb); |
260 | outb (r | 0x01, STATUS (pb)); /* Some reset by writing 1 */ | 265 | outb(r | 0x01, STATUS(pb)); /* Some reset by writing 1 */ |
261 | outb (r & 0xfe, STATUS (pb)); /* Others by writing 0 */ | 266 | outb(r & 0xfe, STATUS(pb)); /* Others by writing 0 */ |
262 | r = parport_pc_read_status(pb); | 267 | r = parport_pc_read_status(pb); |
263 | 268 | ||
264 | return !(r & 0x01); | 269 | return !(r & 0x01); |
@@ -272,7 +277,8 @@ static int clear_epp_timeout(struct parport *pb) | |||
272 | * of these are in parport_pc.h. | 277 | * of these are in parport_pc.h. |
273 | */ | 278 | */ |
274 | 279 | ||
275 | static void parport_pc_init_state(struct pardevice *dev, struct parport_state *s) | 280 | static void parport_pc_init_state(struct pardevice *dev, |
281 | struct parport_state *s) | ||
276 | { | 282 | { |
277 | s->u.pc.ctr = 0xc; | 283 | s->u.pc.ctr = 0xc; |
278 | if (dev->irq_func && | 284 | if (dev->irq_func && |
@@ -289,22 +295,23 @@ static void parport_pc_save_state(struct parport *p, struct parport_state *s) | |||
289 | const struct parport_pc_private *priv = p->physport->private_data; | 295 | const struct parport_pc_private *priv = p->physport->private_data; |
290 | s->u.pc.ctr = priv->ctr; | 296 | s->u.pc.ctr = priv->ctr; |
291 | if (priv->ecr) | 297 | if (priv->ecr) |
292 | s->u.pc.ecr = inb (ECONTROL (p)); | 298 | s->u.pc.ecr = inb(ECONTROL(p)); |
293 | } | 299 | } |
294 | 300 | ||
295 | static void parport_pc_restore_state(struct parport *p, struct parport_state *s) | 301 | static void parport_pc_restore_state(struct parport *p, |
302 | struct parport_state *s) | ||
296 | { | 303 | { |
297 | struct parport_pc_private *priv = p->physport->private_data; | 304 | struct parport_pc_private *priv = p->physport->private_data; |
298 | register unsigned char c = s->u.pc.ctr & priv->ctr_writable; | 305 | register unsigned char c = s->u.pc.ctr & priv->ctr_writable; |
299 | outb (c, CONTROL (p)); | 306 | outb(c, CONTROL(p)); |
300 | priv->ctr = c; | 307 | priv->ctr = c; |
301 | if (priv->ecr) | 308 | if (priv->ecr) |
302 | ECR_WRITE (p, s->u.pc.ecr); | 309 | ECR_WRITE(p, s->u.pc.ecr); |
303 | } | 310 | } |
304 | 311 | ||
305 | #ifdef CONFIG_PARPORT_1284 | 312 | #ifdef CONFIG_PARPORT_1284 |
306 | static size_t parport_pc_epp_read_data (struct parport *port, void *buf, | 313 | static size_t parport_pc_epp_read_data(struct parport *port, void *buf, |
307 | size_t length, int flags) | 314 | size_t length, int flags) |
308 | { | 315 | { |
309 | size_t got = 0; | 316 | size_t got = 0; |
310 | 317 | ||
@@ -316,54 +323,52 @@ static size_t parport_pc_epp_read_data (struct parport *port, void *buf, | |||
316 | * nFault is 0 if there is at least 1 byte in the Warp's FIFO | 323 | * nFault is 0 if there is at least 1 byte in the Warp's FIFO |
317 | * pError is 1 if there are 16 bytes in the Warp's FIFO | 324 | * pError is 1 if there are 16 bytes in the Warp's FIFO |
318 | */ | 325 | */ |
319 | status = inb (STATUS (port)); | 326 | status = inb(STATUS(port)); |
320 | 327 | ||
321 | while (!(status & 0x08) && (got < length)) { | 328 | while (!(status & 0x08) && got < length) { |
322 | if ((left >= 16) && (status & 0x20) && !(status & 0x08)) { | 329 | if (left >= 16 && (status & 0x20) && !(status & 0x08)) { |
323 | /* can grab 16 bytes from warp fifo */ | 330 | /* can grab 16 bytes from warp fifo */ |
324 | if (!((long)buf & 0x03)) { | 331 | if (!((long)buf & 0x03)) |
325 | insl (EPPDATA (port), buf, 4); | 332 | insl(EPPDATA(port), buf, 4); |
326 | } else { | 333 | else |
327 | insb (EPPDATA (port), buf, 16); | 334 | insb(EPPDATA(port), buf, 16); |
328 | } | ||
329 | buf += 16; | 335 | buf += 16; |
330 | got += 16; | 336 | got += 16; |
331 | left -= 16; | 337 | left -= 16; |
332 | } else { | 338 | } else { |
333 | /* grab single byte from the warp fifo */ | 339 | /* grab single byte from the warp fifo */ |
334 | *((char *)buf) = inb (EPPDATA (port)); | 340 | *((char *)buf) = inb(EPPDATA(port)); |
335 | buf++; | 341 | buf++; |
336 | got++; | 342 | got++; |
337 | left--; | 343 | left--; |
338 | } | 344 | } |
339 | status = inb (STATUS (port)); | 345 | status = inb(STATUS(port)); |
340 | if (status & 0x01) { | 346 | if (status & 0x01) { |
341 | /* EPP timeout should never occur... */ | 347 | /* EPP timeout should never occur... */ |
342 | printk (KERN_DEBUG "%s: EPP timeout occurred while talking to " | 348 | printk(KERN_DEBUG |
343 | "w91284pic (should not have done)\n", port->name); | 349 | "%s: EPP timeout occurred while talking to w91284pic (should not have done)\n", port->name); |
344 | clear_epp_timeout (port); | 350 | clear_epp_timeout(port); |
345 | } | 351 | } |
346 | } | 352 | } |
347 | return got; | 353 | return got; |
348 | } | 354 | } |
349 | if ((flags & PARPORT_EPP_FAST) && (length > 1)) { | 355 | if ((flags & PARPORT_EPP_FAST) && (length > 1)) { |
350 | if (!(((long)buf | length) & 0x03)) { | 356 | if (!(((long)buf | length) & 0x03)) |
351 | insl (EPPDATA (port), buf, (length >> 2)); | 357 | insl(EPPDATA(port), buf, (length >> 2)); |
352 | } else { | 358 | else |
353 | insb (EPPDATA (port), buf, length); | 359 | insb(EPPDATA(port), buf, length); |
354 | } | 360 | if (inb(STATUS(port)) & 0x01) { |
355 | if (inb (STATUS (port)) & 0x01) { | 361 | clear_epp_timeout(port); |
356 | clear_epp_timeout (port); | ||
357 | return -EIO; | 362 | return -EIO; |
358 | } | 363 | } |
359 | return length; | 364 | return length; |
360 | } | 365 | } |
361 | for (; got < length; got++) { | 366 | for (; got < length; got++) { |
362 | *((char*)buf) = inb (EPPDATA(port)); | 367 | *((char *)buf) = inb(EPPDATA(port)); |
363 | buf++; | 368 | buf++; |
364 | if (inb (STATUS (port)) & 0x01) { | 369 | if (inb(STATUS(port)) & 0x01) { |
365 | /* EPP timeout */ | 370 | /* EPP timeout */ |
366 | clear_epp_timeout (port); | 371 | clear_epp_timeout(port); |
367 | break; | 372 | break; |
368 | } | 373 | } |
369 | } | 374 | } |
@@ -371,28 +376,27 @@ static size_t parport_pc_epp_read_data (struct parport *port, void *buf, | |||
371 | return got; | 376 | return got; |
372 | } | 377 | } |
373 | 378 | ||
374 | static size_t parport_pc_epp_write_data (struct parport *port, const void *buf, | 379 | static size_t parport_pc_epp_write_data(struct parport *port, const void *buf, |
375 | size_t length, int flags) | 380 | size_t length, int flags) |
376 | { | 381 | { |
377 | size_t written = 0; | 382 | size_t written = 0; |
378 | 383 | ||
379 | if ((flags & PARPORT_EPP_FAST) && (length > 1)) { | 384 | if ((flags & PARPORT_EPP_FAST) && (length > 1)) { |
380 | if (!(((long)buf | length) & 0x03)) { | 385 | if (!(((long)buf | length) & 0x03)) |
381 | outsl (EPPDATA (port), buf, (length >> 2)); | 386 | outsl(EPPDATA(port), buf, (length >> 2)); |
382 | } else { | 387 | else |
383 | outsb (EPPDATA (port), buf, length); | 388 | outsb(EPPDATA(port), buf, length); |
384 | } | 389 | if (inb(STATUS(port)) & 0x01) { |
385 | if (inb (STATUS (port)) & 0x01) { | 390 | clear_epp_timeout(port); |
386 | clear_epp_timeout (port); | ||
387 | return -EIO; | 391 | return -EIO; |
388 | } | 392 | } |
389 | return length; | 393 | return length; |
390 | } | 394 | } |
391 | for (; written < length; written++) { | 395 | for (; written < length; written++) { |
392 | outb (*((char*)buf), EPPDATA(port)); | 396 | outb(*((char *)buf), EPPDATA(port)); |
393 | buf++; | 397 | buf++; |
394 | if (inb (STATUS(port)) & 0x01) { | 398 | if (inb(STATUS(port)) & 0x01) { |
395 | clear_epp_timeout (port); | 399 | clear_epp_timeout(port); |
396 | break; | 400 | break; |
397 | } | 401 | } |
398 | } | 402 | } |
@@ -400,24 +404,24 @@ static size_t parport_pc_epp_write_data (struct parport *port, const void *buf, | |||
400 | return written; | 404 | return written; |
401 | } | 405 | } |
402 | 406 | ||
403 | static size_t parport_pc_epp_read_addr (struct parport *port, void *buf, | 407 | static size_t parport_pc_epp_read_addr(struct parport *port, void *buf, |
404 | size_t length, int flags) | 408 | size_t length, int flags) |
405 | { | 409 | { |
406 | size_t got = 0; | 410 | size_t got = 0; |
407 | 411 | ||
408 | if ((flags & PARPORT_EPP_FAST) && (length > 1)) { | 412 | if ((flags & PARPORT_EPP_FAST) && (length > 1)) { |
409 | insb (EPPADDR (port), buf, length); | 413 | insb(EPPADDR(port), buf, length); |
410 | if (inb (STATUS (port)) & 0x01) { | 414 | if (inb(STATUS(port)) & 0x01) { |
411 | clear_epp_timeout (port); | 415 | clear_epp_timeout(port); |
412 | return -EIO; | 416 | return -EIO; |
413 | } | 417 | } |
414 | return length; | 418 | return length; |
415 | } | 419 | } |
416 | for (; got < length; got++) { | 420 | for (; got < length; got++) { |
417 | *((char*)buf) = inb (EPPADDR (port)); | 421 | *((char *)buf) = inb(EPPADDR(port)); |
418 | buf++; | 422 | buf++; |
419 | if (inb (STATUS (port)) & 0x01) { | 423 | if (inb(STATUS(port)) & 0x01) { |
420 | clear_epp_timeout (port); | 424 | clear_epp_timeout(port); |
421 | break; | 425 | break; |
422 | } | 426 | } |
423 | } | 427 | } |
@@ -425,25 +429,25 @@ static size_t parport_pc_epp_read_addr (struct parport *port, void *buf, | |||
425 | return got; | 429 | return got; |
426 | } | 430 | } |
427 | 431 | ||
428 | static size_t parport_pc_epp_write_addr (struct parport *port, | 432 | static size_t parport_pc_epp_write_addr(struct parport *port, |
429 | const void *buf, size_t length, | 433 | const void *buf, size_t length, |
430 | int flags) | 434 | int flags) |
431 | { | 435 | { |
432 | size_t written = 0; | 436 | size_t written = 0; |
433 | 437 | ||
434 | if ((flags & PARPORT_EPP_FAST) && (length > 1)) { | 438 | if ((flags & PARPORT_EPP_FAST) && (length > 1)) { |
435 | outsb (EPPADDR (port), buf, length); | 439 | outsb(EPPADDR(port), buf, length); |
436 | if (inb (STATUS (port)) & 0x01) { | 440 | if (inb(STATUS(port)) & 0x01) { |
437 | clear_epp_timeout (port); | 441 | clear_epp_timeout(port); |
438 | return -EIO; | 442 | return -EIO; |
439 | } | 443 | } |
440 | return length; | 444 | return length; |
441 | } | 445 | } |
442 | for (; written < length; written++) { | 446 | for (; written < length; written++) { |
443 | outb (*((char*)buf), EPPADDR (port)); | 447 | outb(*((char *)buf), EPPADDR(port)); |
444 | buf++; | 448 | buf++; |
445 | if (inb (STATUS (port)) & 0x01) { | 449 | if (inb(STATUS(port)) & 0x01) { |
446 | clear_epp_timeout (port); | 450 | clear_epp_timeout(port); |
447 | break; | 451 | break; |
448 | } | 452 | } |
449 | } | 453 | } |
@@ -451,74 +455,74 @@ static size_t parport_pc_epp_write_addr (struct parport *port, | |||
451 | return written; | 455 | return written; |
452 | } | 456 | } |
453 | 457 | ||
454 | static size_t parport_pc_ecpepp_read_data (struct parport *port, void *buf, | 458 | static size_t parport_pc_ecpepp_read_data(struct parport *port, void *buf, |
455 | size_t length, int flags) | 459 | size_t length, int flags) |
456 | { | 460 | { |
457 | size_t got; | 461 | size_t got; |
458 | 462 | ||
459 | frob_set_mode (port, ECR_EPP); | 463 | frob_set_mode(port, ECR_EPP); |
460 | parport_pc_data_reverse (port); | 464 | parport_pc_data_reverse(port); |
461 | parport_pc_write_control (port, 0x4); | 465 | parport_pc_write_control(port, 0x4); |
462 | got = parport_pc_epp_read_data (port, buf, length, flags); | 466 | got = parport_pc_epp_read_data(port, buf, length, flags); |
463 | frob_set_mode (port, ECR_PS2); | 467 | frob_set_mode(port, ECR_PS2); |
464 | 468 | ||
465 | return got; | 469 | return got; |
466 | } | 470 | } |
467 | 471 | ||
468 | static size_t parport_pc_ecpepp_write_data (struct parport *port, | 472 | static size_t parport_pc_ecpepp_write_data(struct parport *port, |
469 | const void *buf, size_t length, | 473 | const void *buf, size_t length, |
470 | int flags) | 474 | int flags) |
471 | { | 475 | { |
472 | size_t written; | 476 | size_t written; |
473 | 477 | ||
474 | frob_set_mode (port, ECR_EPP); | 478 | frob_set_mode(port, ECR_EPP); |
475 | parport_pc_write_control (port, 0x4); | 479 | parport_pc_write_control(port, 0x4); |
476 | parport_pc_data_forward (port); | 480 | parport_pc_data_forward(port); |
477 | written = parport_pc_epp_write_data (port, buf, length, flags); | 481 | written = parport_pc_epp_write_data(port, buf, length, flags); |
478 | frob_set_mode (port, ECR_PS2); | 482 | frob_set_mode(port, ECR_PS2); |
479 | 483 | ||
480 | return written; | 484 | return written; |
481 | } | 485 | } |
482 | 486 | ||
483 | static size_t parport_pc_ecpepp_read_addr (struct parport *port, void *buf, | 487 | static size_t parport_pc_ecpepp_read_addr(struct parport *port, void *buf, |
484 | size_t length, int flags) | 488 | size_t length, int flags) |
485 | { | 489 | { |
486 | size_t got; | 490 | size_t got; |
487 | 491 | ||
488 | frob_set_mode (port, ECR_EPP); | 492 | frob_set_mode(port, ECR_EPP); |
489 | parport_pc_data_reverse (port); | 493 | parport_pc_data_reverse(port); |
490 | parport_pc_write_control (port, 0x4); | 494 | parport_pc_write_control(port, 0x4); |
491 | got = parport_pc_epp_read_addr (port, buf, length, flags); | 495 | got = parport_pc_epp_read_addr(port, buf, length, flags); |
492 | frob_set_mode (port, ECR_PS2); | 496 | frob_set_mode(port, ECR_PS2); |
493 | 497 | ||
494 | return got; | 498 | return got; |
495 | } | 499 | } |
496 | 500 | ||
497 | static size_t parport_pc_ecpepp_write_addr (struct parport *port, | 501 | static size_t parport_pc_ecpepp_write_addr(struct parport *port, |
498 | const void *buf, size_t length, | 502 | const void *buf, size_t length, |
499 | int flags) | 503 | int flags) |
500 | { | 504 | { |
501 | size_t written; | 505 | size_t written; |
502 | 506 | ||
503 | frob_set_mode (port, ECR_EPP); | 507 | frob_set_mode(port, ECR_EPP); |
504 | parport_pc_write_control (port, 0x4); | 508 | parport_pc_write_control(port, 0x4); |
505 | parport_pc_data_forward (port); | 509 | parport_pc_data_forward(port); |
506 | written = parport_pc_epp_write_addr (port, buf, length, flags); | 510 | written = parport_pc_epp_write_addr(port, buf, length, flags); |
507 | frob_set_mode (port, ECR_PS2); | 511 | frob_set_mode(port, ECR_PS2); |
508 | 512 | ||
509 | return written; | 513 | return written; |
510 | } | 514 | } |
511 | #endif /* IEEE 1284 support */ | 515 | #endif /* IEEE 1284 support */ |
512 | 516 | ||
513 | #ifdef CONFIG_PARPORT_PC_FIFO | 517 | #ifdef CONFIG_PARPORT_PC_FIFO |
514 | static size_t parport_pc_fifo_write_block_pio (struct parport *port, | 518 | static size_t parport_pc_fifo_write_block_pio(struct parport *port, |
515 | const void *buf, size_t length) | 519 | const void *buf, size_t length) |
516 | { | 520 | { |
517 | int ret = 0; | 521 | int ret = 0; |
518 | const unsigned char *bufp = buf; | 522 | const unsigned char *bufp = buf; |
519 | size_t left = length; | 523 | size_t left = length; |
520 | unsigned long expire = jiffies + port->physport->cad->timeout; | 524 | unsigned long expire = jiffies + port->physport->cad->timeout; |
521 | const int fifo = FIFO (port); | 525 | const int fifo = FIFO(port); |
522 | int poll_for = 8; /* 80 usecs */ | 526 | int poll_for = 8; /* 80 usecs */ |
523 | const struct parport_pc_private *priv = port->physport->private_data; | 527 | const struct parport_pc_private *priv = port->physport->private_data; |
524 | const int fifo_depth = priv->fifo_depth; | 528 | const int fifo_depth = priv->fifo_depth; |
@@ -526,25 +530,25 @@ static size_t parport_pc_fifo_write_block_pio (struct parport *port, | |||
526 | port = port->physport; | 530 | port = port->physport; |
527 | 531 | ||
528 | /* We don't want to be interrupted every character. */ | 532 | /* We don't want to be interrupted every character. */ |
529 | parport_pc_disable_irq (port); | 533 | parport_pc_disable_irq(port); |
530 | /* set nErrIntrEn and serviceIntr */ | 534 | /* set nErrIntrEn and serviceIntr */ |
531 | frob_econtrol (port, (1<<4) | (1<<2), (1<<4) | (1<<2)); | 535 | frob_econtrol(port, (1<<4) | (1<<2), (1<<4) | (1<<2)); |
532 | 536 | ||
533 | /* Forward mode. */ | 537 | /* Forward mode. */ |
534 | parport_pc_data_forward (port); /* Must be in PS2 mode */ | 538 | parport_pc_data_forward(port); /* Must be in PS2 mode */ |
535 | 539 | ||
536 | while (left) { | 540 | while (left) { |
537 | unsigned char byte; | 541 | unsigned char byte; |
538 | unsigned char ecrval = inb (ECONTROL (port)); | 542 | unsigned char ecrval = inb(ECONTROL(port)); |
539 | int i = 0; | 543 | int i = 0; |
540 | 544 | ||
541 | if (need_resched() && time_before (jiffies, expire)) | 545 | if (need_resched() && time_before(jiffies, expire)) |
542 | /* Can't yield the port. */ | 546 | /* Can't yield the port. */ |
543 | schedule (); | 547 | schedule(); |
544 | 548 | ||
545 | /* Anyone else waiting for the port? */ | 549 | /* Anyone else waiting for the port? */ |
546 | if (port->waithead) { | 550 | if (port->waithead) { |
547 | printk (KERN_DEBUG "Somebody wants the port\n"); | 551 | printk(KERN_DEBUG "Somebody wants the port\n"); |
548 | break; | 552 | break; |
549 | } | 553 | } |
550 | 554 | ||
@@ -552,21 +556,22 @@ static size_t parport_pc_fifo_write_block_pio (struct parport *port, | |||
552 | /* FIFO is full. Wait for interrupt. */ | 556 | /* FIFO is full. Wait for interrupt. */ |
553 | 557 | ||
554 | /* Clear serviceIntr */ | 558 | /* Clear serviceIntr */ |
555 | ECR_WRITE (port, ecrval & ~(1<<2)); | 559 | ECR_WRITE(port, ecrval & ~(1<<2)); |
556 | false_alarm: | 560 | false_alarm: |
557 | ret = parport_wait_event (port, HZ); | 561 | ret = parport_wait_event(port, HZ); |
558 | if (ret < 0) break; | 562 | if (ret < 0) |
563 | break; | ||
559 | ret = 0; | 564 | ret = 0; |
560 | if (!time_before (jiffies, expire)) { | 565 | if (!time_before(jiffies, expire)) { |
561 | /* Timed out. */ | 566 | /* Timed out. */ |
562 | printk (KERN_DEBUG "FIFO write timed out\n"); | 567 | printk(KERN_DEBUG "FIFO write timed out\n"); |
563 | break; | 568 | break; |
564 | } | 569 | } |
565 | ecrval = inb (ECONTROL (port)); | 570 | ecrval = inb(ECONTROL(port)); |
566 | if (!(ecrval & (1<<2))) { | 571 | if (!(ecrval & (1<<2))) { |
567 | if (need_resched() && | 572 | if (need_resched() && |
568 | time_before (jiffies, expire)) | 573 | time_before(jiffies, expire)) |
569 | schedule (); | 574 | schedule(); |
570 | 575 | ||
571 | goto false_alarm; | 576 | goto false_alarm; |
572 | } | 577 | } |
@@ -577,38 +582,38 @@ static size_t parport_pc_fifo_write_block_pio (struct parport *port, | |||
577 | /* Can't fail now. */ | 582 | /* Can't fail now. */ |
578 | expire = jiffies + port->cad->timeout; | 583 | expire = jiffies + port->cad->timeout; |
579 | 584 | ||
580 | poll: | 585 | poll: |
581 | if (signal_pending (current)) | 586 | if (signal_pending(current)) |
582 | break; | 587 | break; |
583 | 588 | ||
584 | if (ecrval & 0x01) { | 589 | if (ecrval & 0x01) { |
585 | /* FIFO is empty. Blast it full. */ | 590 | /* FIFO is empty. Blast it full. */ |
586 | const int n = left < fifo_depth ? left : fifo_depth; | 591 | const int n = left < fifo_depth ? left : fifo_depth; |
587 | outsb (fifo, bufp, n); | 592 | outsb(fifo, bufp, n); |
588 | bufp += n; | 593 | bufp += n; |
589 | left -= n; | 594 | left -= n; |
590 | 595 | ||
591 | /* Adjust the poll time. */ | 596 | /* Adjust the poll time. */ |
592 | if (i < (poll_for - 2)) poll_for--; | 597 | if (i < (poll_for - 2)) |
598 | poll_for--; | ||
593 | continue; | 599 | continue; |
594 | } else if (i++ < poll_for) { | 600 | } else if (i++ < poll_for) { |
595 | udelay (10); | 601 | udelay(10); |
596 | ecrval = inb (ECONTROL (port)); | 602 | ecrval = inb(ECONTROL(port)); |
597 | goto poll; | 603 | goto poll; |
598 | } | 604 | } |
599 | 605 | ||
600 | /* Half-full (call me an optimist) */ | 606 | /* Half-full(call me an optimist) */ |
601 | byte = *bufp++; | 607 | byte = *bufp++; |
602 | outb (byte, fifo); | 608 | outb(byte, fifo); |
603 | left--; | 609 | left--; |
604 | } | 610 | } |
605 | 611 | dump_parport_state("leave fifo_write_block_pio", port); | |
606 | dump_parport_state ("leave fifo_write_block_pio", port); | ||
607 | return length - left; | 612 | return length - left; |
608 | } | 613 | } |
609 | 614 | ||
610 | #ifdef HAS_DMA | 615 | #ifdef HAS_DMA |
611 | static size_t parport_pc_fifo_write_block_dma (struct parport *port, | 616 | static size_t parport_pc_fifo_write_block_dma(struct parport *port, |
612 | const void *buf, size_t length) | 617 | const void *buf, size_t length) |
613 | { | 618 | { |
614 | int ret = 0; | 619 | int ret = 0; |
@@ -621,7 +626,7 @@ static size_t parport_pc_fifo_write_block_dma (struct parport *port, | |||
621 | unsigned long start = (unsigned long) buf; | 626 | unsigned long start = (unsigned long) buf; |
622 | unsigned long end = (unsigned long) buf + length - 1; | 627 | unsigned long end = (unsigned long) buf + length - 1; |
623 | 628 | ||
624 | dump_parport_state ("enter fifo_write_block_dma", port); | 629 | dump_parport_state("enter fifo_write_block_dma", port); |
625 | if (end < MAX_DMA_ADDRESS) { | 630 | if (end < MAX_DMA_ADDRESS) { |
626 | /* If it would cross a 64k boundary, cap it at the end. */ | 631 | /* If it would cross a 64k boundary, cap it at the end. */ |
627 | if ((start ^ end) & ~0xffffUL) | 632 | if ((start ^ end) & ~0xffffUL) |
@@ -629,8 +634,9 @@ dump_parport_state ("enter fifo_write_block_dma", port); | |||
629 | 634 | ||
630 | dma_addr = dma_handle = dma_map_single(dev, (void *)buf, length, | 635 | dma_addr = dma_handle = dma_map_single(dev, (void *)buf, length, |
631 | DMA_TO_DEVICE); | 636 | DMA_TO_DEVICE); |
632 | } else { | 637 | } else { |
633 | /* above 16 MB we use a bounce buffer as ISA-DMA is not possible */ | 638 | /* above 16 MB we use a bounce buffer as ISA-DMA |
639 | is not possible */ | ||
634 | maxlen = PAGE_SIZE; /* sizeof(priv->dma_buf) */ | 640 | maxlen = PAGE_SIZE; /* sizeof(priv->dma_buf) */ |
635 | dma_addr = priv->dma_handle; | 641 | dma_addr = priv->dma_handle; |
636 | dma_handle = 0; | 642 | dma_handle = 0; |
@@ -639,12 +645,12 @@ dump_parport_state ("enter fifo_write_block_dma", port); | |||
639 | port = port->physport; | 645 | port = port->physport; |
640 | 646 | ||
641 | /* We don't want to be interrupted every character. */ | 647 | /* We don't want to be interrupted every character. */ |
642 | parport_pc_disable_irq (port); | 648 | parport_pc_disable_irq(port); |
643 | /* set nErrIntrEn and serviceIntr */ | 649 | /* set nErrIntrEn and serviceIntr */ |
644 | frob_econtrol (port, (1<<4) | (1<<2), (1<<4) | (1<<2)); | 650 | frob_econtrol(port, (1<<4) | (1<<2), (1<<4) | (1<<2)); |
645 | 651 | ||
646 | /* Forward mode. */ | 652 | /* Forward mode. */ |
647 | parport_pc_data_forward (port); /* Must be in PS2 mode */ | 653 | parport_pc_data_forward(port); /* Must be in PS2 mode */ |
648 | 654 | ||
649 | while (left) { | 655 | while (left) { |
650 | unsigned long expire = jiffies + port->physport->cad->timeout; | 656 | unsigned long expire = jiffies + port->physport->cad->timeout; |
@@ -665,10 +671,10 @@ dump_parport_state ("enter fifo_write_block_dma", port); | |||
665 | set_dma_count(port->dma, count); | 671 | set_dma_count(port->dma, count); |
666 | 672 | ||
667 | /* Set DMA mode */ | 673 | /* Set DMA mode */ |
668 | frob_econtrol (port, 1<<3, 1<<3); | 674 | frob_econtrol(port, 1<<3, 1<<3); |
669 | 675 | ||
670 | /* Clear serviceIntr */ | 676 | /* Clear serviceIntr */ |
671 | frob_econtrol (port, 1<<2, 0); | 677 | frob_econtrol(port, 1<<2, 0); |
672 | 678 | ||
673 | enable_dma(port->dma); | 679 | enable_dma(port->dma); |
674 | release_dma_lock(dmaflag); | 680 | release_dma_lock(dmaflag); |
@@ -676,20 +682,22 @@ dump_parport_state ("enter fifo_write_block_dma", port); | |||
676 | /* assume DMA will be successful */ | 682 | /* assume DMA will be successful */ |
677 | left -= count; | 683 | left -= count; |
678 | buf += count; | 684 | buf += count; |
679 | if (dma_handle) dma_addr += count; | 685 | if (dma_handle) |
686 | dma_addr += count; | ||
680 | 687 | ||
681 | /* Wait for interrupt. */ | 688 | /* Wait for interrupt. */ |
682 | false_alarm: | 689 | false_alarm: |
683 | ret = parport_wait_event (port, HZ); | 690 | ret = parport_wait_event(port, HZ); |
684 | if (ret < 0) break; | 691 | if (ret < 0) |
692 | break; | ||
685 | ret = 0; | 693 | ret = 0; |
686 | if (!time_before (jiffies, expire)) { | 694 | if (!time_before(jiffies, expire)) { |
687 | /* Timed out. */ | 695 | /* Timed out. */ |
688 | printk (KERN_DEBUG "DMA write timed out\n"); | 696 | printk(KERN_DEBUG "DMA write timed out\n"); |
689 | break; | 697 | break; |
690 | } | 698 | } |
691 | /* Is serviceIntr set? */ | 699 | /* Is serviceIntr set? */ |
692 | if (!(inb (ECONTROL (port)) & (1<<2))) { | 700 | if (!(inb(ECONTROL(port)) & (1<<2))) { |
693 | cond_resched(); | 701 | cond_resched(); |
694 | 702 | ||
695 | goto false_alarm; | 703 | goto false_alarm; |
@@ -705,14 +713,15 @@ dump_parport_state ("enter fifo_write_block_dma", port); | |||
705 | 713 | ||
706 | /* Anyone else waiting for the port? */ | 714 | /* Anyone else waiting for the port? */ |
707 | if (port->waithead) { | 715 | if (port->waithead) { |
708 | printk (KERN_DEBUG "Somebody wants the port\n"); | 716 | printk(KERN_DEBUG "Somebody wants the port\n"); |
709 | break; | 717 | break; |
710 | } | 718 | } |
711 | 719 | ||
712 | /* update for possible DMA residue ! */ | 720 | /* update for possible DMA residue ! */ |
713 | buf -= count; | 721 | buf -= count; |
714 | left += count; | 722 | left += count; |
715 | if (dma_handle) dma_addr -= count; | 723 | if (dma_handle) |
724 | dma_addr -= count; | ||
716 | } | 725 | } |
717 | 726 | ||
718 | /* Maybe got here through break, so adjust for DMA residue! */ | 727 | /* Maybe got here through break, so adjust for DMA residue! */ |
@@ -723,12 +732,12 @@ dump_parport_state ("enter fifo_write_block_dma", port); | |||
723 | release_dma_lock(dmaflag); | 732 | release_dma_lock(dmaflag); |
724 | 733 | ||
725 | /* Turn off DMA mode */ | 734 | /* Turn off DMA mode */ |
726 | frob_econtrol (port, 1<<3, 0); | 735 | frob_econtrol(port, 1<<3, 0); |
727 | 736 | ||
728 | if (dma_handle) | 737 | if (dma_handle) |
729 | dma_unmap_single(dev, dma_handle, length, DMA_TO_DEVICE); | 738 | dma_unmap_single(dev, dma_handle, length, DMA_TO_DEVICE); |
730 | 739 | ||
731 | dump_parport_state ("leave fifo_write_block_dma", port); | 740 | dump_parport_state("leave fifo_write_block_dma", port); |
732 | return length - left; | 741 | return length - left; |
733 | } | 742 | } |
734 | #endif | 743 | #endif |
@@ -738,13 +747,13 @@ static inline size_t parport_pc_fifo_write_block(struct parport *port, | |||
738 | { | 747 | { |
739 | #ifdef HAS_DMA | 748 | #ifdef HAS_DMA |
740 | if (port->dma != PARPORT_DMA_NONE) | 749 | if (port->dma != PARPORT_DMA_NONE) |
741 | return parport_pc_fifo_write_block_dma (port, buf, length); | 750 | return parport_pc_fifo_write_block_dma(port, buf, length); |
742 | #endif | 751 | #endif |
743 | return parport_pc_fifo_write_block_pio (port, buf, length); | 752 | return parport_pc_fifo_write_block_pio(port, buf, length); |
744 | } | 753 | } |
745 | 754 | ||
746 | /* Parallel Port FIFO mode (ECP chipsets) */ | 755 | /* Parallel Port FIFO mode (ECP chipsets) */ |
747 | static size_t parport_pc_compat_write_block_pio (struct parport *port, | 756 | static size_t parport_pc_compat_write_block_pio(struct parport *port, |
748 | const void *buf, size_t length, | 757 | const void *buf, size_t length, |
749 | int flags) | 758 | int flags) |
750 | { | 759 | { |
@@ -756,14 +765,16 @@ static size_t parport_pc_compat_write_block_pio (struct parport *port, | |||
756 | /* Special case: a timeout of zero means we cannot call schedule(). | 765 | /* Special case: a timeout of zero means we cannot call schedule(). |
757 | * Also if O_NONBLOCK is set then use the default implementation. */ | 766 | * Also if O_NONBLOCK is set then use the default implementation. */ |
758 | if (port->physport->cad->timeout <= PARPORT_INACTIVITY_O_NONBLOCK) | 767 | if (port->physport->cad->timeout <= PARPORT_INACTIVITY_O_NONBLOCK) |
759 | return parport_ieee1284_write_compat (port, buf, | 768 | return parport_ieee1284_write_compat(port, buf, |
760 | length, flags); | 769 | length, flags); |
761 | 770 | ||
762 | /* Set up parallel port FIFO mode.*/ | 771 | /* Set up parallel port FIFO mode.*/ |
763 | parport_pc_data_forward (port); /* Must be in PS2 mode */ | 772 | parport_pc_data_forward(port); /* Must be in PS2 mode */ |
764 | parport_pc_frob_control (port, PARPORT_CONTROL_STROBE, 0); | 773 | parport_pc_frob_control(port, PARPORT_CONTROL_STROBE, 0); |
765 | r = change_mode (port, ECR_PPF); /* Parallel port FIFO */ | 774 | r = change_mode(port, ECR_PPF); /* Parallel port FIFO */ |
766 | if (r) printk (KERN_DEBUG "%s: Warning change_mode ECR_PPF failed\n", port->name); | 775 | if (r) |
776 | printk(KERN_DEBUG "%s: Warning change_mode ECR_PPF failed\n", | ||
777 | port->name); | ||
767 | 778 | ||
768 | port->physport->ieee1284.phase = IEEE1284_PH_FWD_DATA; | 779 | port->physport->ieee1284.phase = IEEE1284_PH_FWD_DATA; |
769 | 780 | ||
@@ -775,40 +786,39 @@ static size_t parport_pc_compat_write_block_pio (struct parport *port, | |||
775 | * the FIFO is empty, so allow 4 seconds for each position | 786 | * the FIFO is empty, so allow 4 seconds for each position |
776 | * in the fifo. | 787 | * in the fifo. |
777 | */ | 788 | */ |
778 | expire = jiffies + (priv->fifo_depth * HZ * 4); | 789 | expire = jiffies + (priv->fifo_depth * HZ * 4); |
779 | do { | 790 | do { |
780 | /* Wait for the FIFO to empty */ | 791 | /* Wait for the FIFO to empty */ |
781 | r = change_mode (port, ECR_PS2); | 792 | r = change_mode(port, ECR_PS2); |
782 | if (r != -EBUSY) { | 793 | if (r != -EBUSY) |
783 | break; | 794 | break; |
784 | } | 795 | } while (time_before(jiffies, expire)); |
785 | } while (time_before (jiffies, expire)); | ||
786 | if (r == -EBUSY) { | 796 | if (r == -EBUSY) { |
787 | 797 | ||
788 | printk (KERN_DEBUG "%s: FIFO is stuck\n", port->name); | 798 | printk(KERN_DEBUG "%s: FIFO is stuck\n", port->name); |
789 | 799 | ||
790 | /* Prevent further data transfer. */ | 800 | /* Prevent further data transfer. */ |
791 | frob_set_mode (port, ECR_TST); | 801 | frob_set_mode(port, ECR_TST); |
792 | 802 | ||
793 | /* Adjust for the contents of the FIFO. */ | 803 | /* Adjust for the contents of the FIFO. */ |
794 | for (written -= priv->fifo_depth; ; written++) { | 804 | for (written -= priv->fifo_depth; ; written++) { |
795 | if (inb (ECONTROL (port)) & 0x2) { | 805 | if (inb(ECONTROL(port)) & 0x2) { |
796 | /* Full up. */ | 806 | /* Full up. */ |
797 | break; | 807 | break; |
798 | } | 808 | } |
799 | outb (0, FIFO (port)); | 809 | outb(0, FIFO(port)); |
800 | } | 810 | } |
801 | 811 | ||
802 | /* Reset the FIFO and return to PS2 mode. */ | 812 | /* Reset the FIFO and return to PS2 mode. */ |
803 | frob_set_mode (port, ECR_PS2); | 813 | frob_set_mode(port, ECR_PS2); |
804 | } | 814 | } |
805 | 815 | ||
806 | r = parport_wait_peripheral (port, | 816 | r = parport_wait_peripheral(port, |
807 | PARPORT_STATUS_BUSY, | 817 | PARPORT_STATUS_BUSY, |
808 | PARPORT_STATUS_BUSY); | 818 | PARPORT_STATUS_BUSY); |
809 | if (r) | 819 | if (r) |
810 | printk (KERN_DEBUG | 820 | printk(KERN_DEBUG |
811 | "%s: BUSY timeout (%d) in compat_write_block_pio\n", | 821 | "%s: BUSY timeout (%d) in compat_write_block_pio\n", |
812 | port->name, r); | 822 | port->name, r); |
813 | 823 | ||
814 | port->physport->ieee1284.phase = IEEE1284_PH_FWD_IDLE; | 824 | port->physport->ieee1284.phase = IEEE1284_PH_FWD_IDLE; |
@@ -818,7 +828,7 @@ static size_t parport_pc_compat_write_block_pio (struct parport *port, | |||
818 | 828 | ||
819 | /* ECP */ | 829 | /* ECP */ |
820 | #ifdef CONFIG_PARPORT_1284 | 830 | #ifdef CONFIG_PARPORT_1284 |
821 | static size_t parport_pc_ecp_write_block_pio (struct parport *port, | 831 | static size_t parport_pc_ecp_write_block_pio(struct parport *port, |
822 | const void *buf, size_t length, | 832 | const void *buf, size_t length, |
823 | int flags) | 833 | int flags) |
824 | { | 834 | { |
@@ -830,36 +840,38 @@ static size_t parport_pc_ecp_write_block_pio (struct parport *port, | |||
830 | /* Special case: a timeout of zero means we cannot call schedule(). | 840 | /* Special case: a timeout of zero means we cannot call schedule(). |
831 | * Also if O_NONBLOCK is set then use the default implementation. */ | 841 | * Also if O_NONBLOCK is set then use the default implementation. */ |
832 | if (port->physport->cad->timeout <= PARPORT_INACTIVITY_O_NONBLOCK) | 842 | if (port->physport->cad->timeout <= PARPORT_INACTIVITY_O_NONBLOCK) |
833 | return parport_ieee1284_ecp_write_data (port, buf, | 843 | return parport_ieee1284_ecp_write_data(port, buf, |
834 | length, flags); | 844 | length, flags); |
835 | 845 | ||
836 | /* Switch to forward mode if necessary. */ | 846 | /* Switch to forward mode if necessary. */ |
837 | if (port->physport->ieee1284.phase != IEEE1284_PH_FWD_IDLE) { | 847 | if (port->physport->ieee1284.phase != IEEE1284_PH_FWD_IDLE) { |
838 | /* Event 47: Set nInit high. */ | 848 | /* Event 47: Set nInit high. */ |
839 | parport_frob_control (port, | 849 | parport_frob_control(port, |
840 | PARPORT_CONTROL_INIT | 850 | PARPORT_CONTROL_INIT |
841 | | PARPORT_CONTROL_AUTOFD, | 851 | | PARPORT_CONTROL_AUTOFD, |
842 | PARPORT_CONTROL_INIT | 852 | PARPORT_CONTROL_INIT |
843 | | PARPORT_CONTROL_AUTOFD); | 853 | | PARPORT_CONTROL_AUTOFD); |
844 | 854 | ||
845 | /* Event 49: PError goes high. */ | 855 | /* Event 49: PError goes high. */ |
846 | r = parport_wait_peripheral (port, | 856 | r = parport_wait_peripheral(port, |
847 | PARPORT_STATUS_PAPEROUT, | 857 | PARPORT_STATUS_PAPEROUT, |
848 | PARPORT_STATUS_PAPEROUT); | 858 | PARPORT_STATUS_PAPEROUT); |
849 | if (r) { | 859 | if (r) { |
850 | printk (KERN_DEBUG "%s: PError timeout (%d) " | 860 | printk(KERN_DEBUG "%s: PError timeout (%d) " |
851 | "in ecp_write_block_pio\n", port->name, r); | 861 | "in ecp_write_block_pio\n", port->name, r); |
852 | } | 862 | } |
853 | } | 863 | } |
854 | 864 | ||
855 | /* Set up ECP parallel port mode.*/ | 865 | /* Set up ECP parallel port mode.*/ |
856 | parport_pc_data_forward (port); /* Must be in PS2 mode */ | 866 | parport_pc_data_forward(port); /* Must be in PS2 mode */ |
857 | parport_pc_frob_control (port, | 867 | parport_pc_frob_control(port, |
858 | PARPORT_CONTROL_STROBE | | 868 | PARPORT_CONTROL_STROBE | |
859 | PARPORT_CONTROL_AUTOFD, | 869 | PARPORT_CONTROL_AUTOFD, |
860 | 0); | 870 | 0); |
861 | r = change_mode (port, ECR_ECP); /* ECP FIFO */ | 871 | r = change_mode(port, ECR_ECP); /* ECP FIFO */ |
862 | if (r) printk (KERN_DEBUG "%s: Warning change_mode ECR_ECP failed\n", port->name); | 872 | if (r) |
873 | printk(KERN_DEBUG "%s: Warning change_mode ECR_ECP failed\n", | ||
874 | port->name); | ||
863 | port->physport->ieee1284.phase = IEEE1284_PH_FWD_DATA; | 875 | port->physport->ieee1284.phase = IEEE1284_PH_FWD_DATA; |
864 | 876 | ||
865 | /* Write the data to the FIFO. */ | 877 | /* Write the data to the FIFO. */ |
@@ -873,55 +885,54 @@ static size_t parport_pc_ecp_write_block_pio (struct parport *port, | |||
873 | expire = jiffies + (priv->fifo_depth * (HZ * 4)); | 885 | expire = jiffies + (priv->fifo_depth * (HZ * 4)); |
874 | do { | 886 | do { |
875 | /* Wait for the FIFO to empty */ | 887 | /* Wait for the FIFO to empty */ |
876 | r = change_mode (port, ECR_PS2); | 888 | r = change_mode(port, ECR_PS2); |
877 | if (r != -EBUSY) { | 889 | if (r != -EBUSY) |
878 | break; | 890 | break; |
879 | } | 891 | } while (time_before(jiffies, expire)); |
880 | } while (time_before (jiffies, expire)); | ||
881 | if (r == -EBUSY) { | 892 | if (r == -EBUSY) { |
882 | 893 | ||
883 | printk (KERN_DEBUG "%s: FIFO is stuck\n", port->name); | 894 | printk(KERN_DEBUG "%s: FIFO is stuck\n", port->name); |
884 | 895 | ||
885 | /* Prevent further data transfer. */ | 896 | /* Prevent further data transfer. */ |
886 | frob_set_mode (port, ECR_TST); | 897 | frob_set_mode(port, ECR_TST); |
887 | 898 | ||
888 | /* Adjust for the contents of the FIFO. */ | 899 | /* Adjust for the contents of the FIFO. */ |
889 | for (written -= priv->fifo_depth; ; written++) { | 900 | for (written -= priv->fifo_depth; ; written++) { |
890 | if (inb (ECONTROL (port)) & 0x2) { | 901 | if (inb(ECONTROL(port)) & 0x2) { |
891 | /* Full up. */ | 902 | /* Full up. */ |
892 | break; | 903 | break; |
893 | } | 904 | } |
894 | outb (0, FIFO (port)); | 905 | outb(0, FIFO(port)); |
895 | } | 906 | } |
896 | 907 | ||
897 | /* Reset the FIFO and return to PS2 mode. */ | 908 | /* Reset the FIFO and return to PS2 mode. */ |
898 | frob_set_mode (port, ECR_PS2); | 909 | frob_set_mode(port, ECR_PS2); |
899 | 910 | ||
900 | /* Host transfer recovery. */ | 911 | /* Host transfer recovery. */ |
901 | parport_pc_data_reverse (port); /* Must be in PS2 mode */ | 912 | parport_pc_data_reverse(port); /* Must be in PS2 mode */ |
902 | udelay (5); | 913 | udelay(5); |
903 | parport_frob_control (port, PARPORT_CONTROL_INIT, 0); | 914 | parport_frob_control(port, PARPORT_CONTROL_INIT, 0); |
904 | r = parport_wait_peripheral (port, PARPORT_STATUS_PAPEROUT, 0); | 915 | r = parport_wait_peripheral(port, PARPORT_STATUS_PAPEROUT, 0); |
905 | if (r) | 916 | if (r) |
906 | printk (KERN_DEBUG "%s: PE,1 timeout (%d) " | 917 | printk(KERN_DEBUG "%s: PE,1 timeout (%d) " |
907 | "in ecp_write_block_pio\n", port->name, r); | 918 | "in ecp_write_block_pio\n", port->name, r); |
908 | 919 | ||
909 | parport_frob_control (port, | 920 | parport_frob_control(port, |
910 | PARPORT_CONTROL_INIT, | 921 | PARPORT_CONTROL_INIT, |
911 | PARPORT_CONTROL_INIT); | 922 | PARPORT_CONTROL_INIT); |
912 | r = parport_wait_peripheral (port, | 923 | r = parport_wait_peripheral(port, |
913 | PARPORT_STATUS_PAPEROUT, | 924 | PARPORT_STATUS_PAPEROUT, |
914 | PARPORT_STATUS_PAPEROUT); | 925 | PARPORT_STATUS_PAPEROUT); |
915 | if (r) | 926 | if (r) |
916 | printk (KERN_DEBUG "%s: PE,2 timeout (%d) " | 927 | printk(KERN_DEBUG "%s: PE,2 timeout (%d) " |
917 | "in ecp_write_block_pio\n", port->name, r); | 928 | "in ecp_write_block_pio\n", port->name, r); |
918 | } | 929 | } |
919 | 930 | ||
920 | r = parport_wait_peripheral (port, | 931 | r = parport_wait_peripheral(port, |
921 | PARPORT_STATUS_BUSY, | 932 | PARPORT_STATUS_BUSY, |
922 | PARPORT_STATUS_BUSY); | 933 | PARPORT_STATUS_BUSY); |
923 | if(r) | 934 | if (r) |
924 | printk (KERN_DEBUG | 935 | printk(KERN_DEBUG |
925 | "%s: BUSY timeout (%d) in ecp_write_block_pio\n", | 936 | "%s: BUSY timeout (%d) in ecp_write_block_pio\n", |
926 | port->name, r); | 937 | port->name, r); |
927 | 938 | ||
@@ -931,7 +942,7 @@ static size_t parport_pc_ecp_write_block_pio (struct parport *port, | |||
931 | } | 942 | } |
932 | 943 | ||
933 | #if 0 | 944 | #if 0 |
934 | static size_t parport_pc_ecp_read_block_pio (struct parport *port, | 945 | static size_t parport_pc_ecp_read_block_pio(struct parport *port, |
935 | void *buf, size_t length, | 946 | void *buf, size_t length, |
936 | int flags) | 947 | int flags) |
937 | { | 948 | { |
@@ -944,13 +955,13 @@ static size_t parport_pc_ecp_read_block_pio (struct parport *port, | |||
944 | char *bufp = buf; | 955 | char *bufp = buf; |
945 | 956 | ||
946 | port = port->physport; | 957 | port = port->physport; |
947 | DPRINTK (KERN_DEBUG "parport_pc: parport_pc_ecp_read_block_pio\n"); | 958 | DPRINTK(KERN_DEBUG "parport_pc: parport_pc_ecp_read_block_pio\n"); |
948 | dump_parport_state ("enter fcn", port); | 959 | dump_parport_state("enter fcn", port); |
949 | 960 | ||
950 | /* Special case: a timeout of zero means we cannot call schedule(). | 961 | /* Special case: a timeout of zero means we cannot call schedule(). |
951 | * Also if O_NONBLOCK is set then use the default implementation. */ | 962 | * Also if O_NONBLOCK is set then use the default implementation. */ |
952 | if (port->cad->timeout <= PARPORT_INACTIVITY_O_NONBLOCK) | 963 | if (port->cad->timeout <= PARPORT_INACTIVITY_O_NONBLOCK) |
953 | return parport_ieee1284_ecp_read_data (port, buf, | 964 | return parport_ieee1284_ecp_read_data(port, buf, |
954 | length, flags); | 965 | length, flags); |
955 | 966 | ||
956 | if (port->ieee1284.mode == IEEE1284_MODE_ECPRLE) { | 967 | if (port->ieee1284.mode == IEEE1284_MODE_ECPRLE) { |
@@ -966,173 +977,177 @@ dump_parport_state ("enter fcn", port); | |||
966 | * go through software emulation. Otherwise we may have to throw | 977 | * go through software emulation. Otherwise we may have to throw |
967 | * away data. */ | 978 | * away data. */ |
968 | if (length < fifofull) | 979 | if (length < fifofull) |
969 | return parport_ieee1284_ecp_read_data (port, buf, | 980 | return parport_ieee1284_ecp_read_data(port, buf, |
970 | length, flags); | 981 | length, flags); |
971 | 982 | ||
972 | if (port->ieee1284.phase != IEEE1284_PH_REV_IDLE) { | 983 | if (port->ieee1284.phase != IEEE1284_PH_REV_IDLE) { |
973 | /* change to reverse-idle phase (must be in forward-idle) */ | 984 | /* change to reverse-idle phase (must be in forward-idle) */ |
974 | 985 | ||
975 | /* Event 38: Set nAutoFd low (also make sure nStrobe is high) */ | 986 | /* Event 38: Set nAutoFd low (also make sure nStrobe is high) */ |
976 | parport_frob_control (port, | 987 | parport_frob_control(port, |
977 | PARPORT_CONTROL_AUTOFD | 988 | PARPORT_CONTROL_AUTOFD |
978 | | PARPORT_CONTROL_STROBE, | 989 | | PARPORT_CONTROL_STROBE, |
979 | PARPORT_CONTROL_AUTOFD); | 990 | PARPORT_CONTROL_AUTOFD); |
980 | parport_pc_data_reverse (port); /* Must be in PS2 mode */ | 991 | parport_pc_data_reverse(port); /* Must be in PS2 mode */ |
981 | udelay (5); | 992 | udelay(5); |
982 | /* Event 39: Set nInit low to initiate bus reversal */ | 993 | /* Event 39: Set nInit low to initiate bus reversal */ |
983 | parport_frob_control (port, | 994 | parport_frob_control(port, |
984 | PARPORT_CONTROL_INIT, | 995 | PARPORT_CONTROL_INIT, |
985 | 0); | 996 | 0); |
986 | /* Event 40: Wait for nAckReverse (PError) to go low */ | 997 | /* Event 40: Wait for nAckReverse (PError) to go low */ |
987 | r = parport_wait_peripheral (port, PARPORT_STATUS_PAPEROUT, 0); | 998 | r = parport_wait_peripheral(port, PARPORT_STATUS_PAPEROUT, 0); |
988 | if (r) { | 999 | if (r) { |
989 | printk (KERN_DEBUG "%s: PE timeout Event 40 (%d) " | 1000 | printk(KERN_DEBUG "%s: PE timeout Event 40 (%d) " |
990 | "in ecp_read_block_pio\n", port->name, r); | 1001 | "in ecp_read_block_pio\n", port->name, r); |
991 | return 0; | 1002 | return 0; |
992 | } | 1003 | } |
993 | } | 1004 | } |
994 | 1005 | ||
995 | /* Set up ECP FIFO mode.*/ | 1006 | /* Set up ECP FIFO mode.*/ |
996 | /* parport_pc_frob_control (port, | 1007 | /* parport_pc_frob_control(port, |
997 | PARPORT_CONTROL_STROBE | | 1008 | PARPORT_CONTROL_STROBE | |
998 | PARPORT_CONTROL_AUTOFD, | 1009 | PARPORT_CONTROL_AUTOFD, |
999 | PARPORT_CONTROL_AUTOFD); */ | 1010 | PARPORT_CONTROL_AUTOFD); */ |
1000 | r = change_mode (port, ECR_ECP); /* ECP FIFO */ | 1011 | r = change_mode(port, ECR_ECP); /* ECP FIFO */ |
1001 | if (r) printk (KERN_DEBUG "%s: Warning change_mode ECR_ECP failed\n", port->name); | 1012 | if (r) |
1013 | printk(KERN_DEBUG "%s: Warning change_mode ECR_ECP failed\n", | ||
1014 | port->name); | ||
1002 | 1015 | ||
1003 | port->ieee1284.phase = IEEE1284_PH_REV_DATA; | 1016 | port->ieee1284.phase = IEEE1284_PH_REV_DATA; |
1004 | 1017 | ||
1005 | /* the first byte must be collected manually */ | 1018 | /* the first byte must be collected manually */ |
1006 | dump_parport_state ("pre 43", port); | 1019 | dump_parport_state("pre 43", port); |
1007 | /* Event 43: Wait for nAck to go low */ | 1020 | /* Event 43: Wait for nAck to go low */ |
1008 | r = parport_wait_peripheral (port, PARPORT_STATUS_ACK, 0); | 1021 | r = parport_wait_peripheral(port, PARPORT_STATUS_ACK, 0); |
1009 | if (r) { | 1022 | if (r) { |
1010 | /* timed out while reading -- no data */ | 1023 | /* timed out while reading -- no data */ |
1011 | printk (KERN_DEBUG "PIO read timed out (initial byte)\n"); | 1024 | printk(KERN_DEBUG "PIO read timed out (initial byte)\n"); |
1012 | goto out_no_data; | 1025 | goto out_no_data; |
1013 | } | 1026 | } |
1014 | /* read byte */ | 1027 | /* read byte */ |
1015 | *bufp++ = inb (DATA (port)); | 1028 | *bufp++ = inb(DATA(port)); |
1016 | left--; | 1029 | left--; |
1017 | dump_parport_state ("43-44", port); | 1030 | dump_parport_state("43-44", port); |
1018 | /* Event 44: nAutoFd (HostAck) goes high to acknowledge */ | 1031 | /* Event 44: nAutoFd (HostAck) goes high to acknowledge */ |
1019 | parport_pc_frob_control (port, | 1032 | parport_pc_frob_control(port, |
1020 | PARPORT_CONTROL_AUTOFD, | 1033 | PARPORT_CONTROL_AUTOFD, |
1021 | 0); | 1034 | 0); |
1022 | dump_parport_state ("pre 45", port); | 1035 | dump_parport_state("pre 45", port); |
1023 | /* Event 45: Wait for nAck to go high */ | 1036 | /* Event 45: Wait for nAck to go high */ |
1024 | /* r = parport_wait_peripheral (port, PARPORT_STATUS_ACK, PARPORT_STATUS_ACK); */ | 1037 | /* r = parport_wait_peripheral(port, PARPORT_STATUS_ACK, |
1025 | dump_parport_state ("post 45", port); | 1038 | PARPORT_STATUS_ACK); */ |
1026 | r = 0; | 1039 | dump_parport_state("post 45", port); |
1040 | r = 0; | ||
1027 | if (r) { | 1041 | if (r) { |
1028 | /* timed out while waiting for peripheral to respond to ack */ | 1042 | /* timed out while waiting for peripheral to respond to ack */ |
1029 | printk (KERN_DEBUG "ECP PIO read timed out (waiting for nAck)\n"); | 1043 | printk(KERN_DEBUG "ECP PIO read timed out (waiting for nAck)\n"); |
1030 | 1044 | ||
1031 | /* keep hold of the byte we've got already */ | 1045 | /* keep hold of the byte we've got already */ |
1032 | goto out_no_data; | 1046 | goto out_no_data; |
1033 | } | 1047 | } |
1034 | /* Event 46: nAutoFd (HostAck) goes low to accept more data */ | 1048 | /* Event 46: nAutoFd (HostAck) goes low to accept more data */ |
1035 | parport_pc_frob_control (port, | 1049 | parport_pc_frob_control(port, |
1036 | PARPORT_CONTROL_AUTOFD, | 1050 | PARPORT_CONTROL_AUTOFD, |
1037 | PARPORT_CONTROL_AUTOFD); | 1051 | PARPORT_CONTROL_AUTOFD); |
1038 | 1052 | ||
1039 | 1053 | ||
1040 | dump_parport_state ("rev idle", port); | 1054 | dump_parport_state("rev idle", port); |
1041 | /* Do the transfer. */ | 1055 | /* Do the transfer. */ |
1042 | while (left > fifofull) { | 1056 | while (left > fifofull) { |
1043 | int ret; | 1057 | int ret; |
1044 | unsigned long expire = jiffies + port->cad->timeout; | 1058 | unsigned long expire = jiffies + port->cad->timeout; |
1045 | unsigned char ecrval = inb (ECONTROL (port)); | 1059 | unsigned char ecrval = inb(ECONTROL(port)); |
1046 | 1060 | ||
1047 | if (need_resched() && time_before (jiffies, expire)) | 1061 | if (need_resched() && time_before(jiffies, expire)) |
1048 | /* Can't yield the port. */ | 1062 | /* Can't yield the port. */ |
1049 | schedule (); | 1063 | schedule(); |
1050 | 1064 | ||
1051 | /* At this point, the FIFO may already be full. In | 1065 | /* At this point, the FIFO may already be full. In |
1052 | * that case ECP is already holding back the | 1066 | * that case ECP is already holding back the |
1053 | * peripheral (assuming proper design) with a delayed | 1067 | * peripheral (assuming proper design) with a delayed |
1054 | * handshake. Work fast to avoid a peripheral | 1068 | * handshake. Work fast to avoid a peripheral |
1055 | * timeout. */ | 1069 | * timeout. */ |
1056 | 1070 | ||
1057 | if (ecrval & 0x01) { | 1071 | if (ecrval & 0x01) { |
1058 | /* FIFO is empty. Wait for interrupt. */ | 1072 | /* FIFO is empty. Wait for interrupt. */ |
1059 | dump_parport_state ("FIFO empty", port); | 1073 | dump_parport_state("FIFO empty", port); |
1060 | 1074 | ||
1061 | /* Anyone else waiting for the port? */ | 1075 | /* Anyone else waiting for the port? */ |
1062 | if (port->waithead) { | 1076 | if (port->waithead) { |
1063 | printk (KERN_DEBUG "Somebody wants the port\n"); | 1077 | printk(KERN_DEBUG "Somebody wants the port\n"); |
1064 | break; | 1078 | break; |
1065 | } | 1079 | } |
1066 | 1080 | ||
1067 | /* Clear serviceIntr */ | 1081 | /* Clear serviceIntr */ |
1068 | ECR_WRITE (port, ecrval & ~(1<<2)); | 1082 | ECR_WRITE(port, ecrval & ~(1<<2)); |
1069 | false_alarm: | 1083 | false_alarm: |
1070 | dump_parport_state ("waiting", port); | 1084 | dump_parport_state("waiting", port); |
1071 | ret = parport_wait_event (port, HZ); | 1085 | ret = parport_wait_event(port, HZ); |
1072 | DPRINTK (KERN_DEBUG "parport_wait_event returned %d\n", ret); | 1086 | DPRINTK(KERN_DEBUG "parport_wait_event returned %d\n", |
1087 | ret); | ||
1073 | if (ret < 0) | 1088 | if (ret < 0) |
1074 | break; | 1089 | break; |
1075 | ret = 0; | 1090 | ret = 0; |
1076 | if (!time_before (jiffies, expire)) { | 1091 | if (!time_before(jiffies, expire)) { |
1077 | /* Timed out. */ | 1092 | /* Timed out. */ |
1078 | dump_parport_state ("timeout", port); | 1093 | dump_parport_state("timeout", port); |
1079 | printk (KERN_DEBUG "PIO read timed out\n"); | 1094 | printk(KERN_DEBUG "PIO read timed out\n"); |
1080 | break; | 1095 | break; |
1081 | } | 1096 | } |
1082 | ecrval = inb (ECONTROL (port)); | 1097 | ecrval = inb(ECONTROL(port)); |
1083 | if (!(ecrval & (1<<2))) { | 1098 | if (!(ecrval & (1<<2))) { |
1084 | if (need_resched() && | 1099 | if (need_resched() && |
1085 | time_before (jiffies, expire)) { | 1100 | time_before(jiffies, expire)) { |
1086 | schedule (); | 1101 | schedule(); |
1087 | } | 1102 | } |
1088 | goto false_alarm; | 1103 | goto false_alarm; |
1089 | } | 1104 | } |
1090 | 1105 | ||
1091 | /* Depending on how the FIFO threshold was | 1106 | /* Depending on how the FIFO threshold was |
1092 | * set, how long interrupt service took, and | 1107 | * set, how long interrupt service took, and |
1093 | * how fast the peripheral is, we might be | 1108 | * how fast the peripheral is, we might be |
1094 | * lucky and have a just filled FIFO. */ | 1109 | * lucky and have a just filled FIFO. */ |
1095 | continue; | 1110 | continue; |
1096 | } | 1111 | } |
1097 | 1112 | ||
1098 | if (ecrval & 0x02) { | 1113 | if (ecrval & 0x02) { |
1099 | /* FIFO is full. */ | 1114 | /* FIFO is full. */ |
1100 | dump_parport_state ("FIFO full", port); | 1115 | dump_parport_state("FIFO full", port); |
1101 | insb (fifo, bufp, fifo_depth); | 1116 | insb(fifo, bufp, fifo_depth); |
1102 | bufp += fifo_depth; | 1117 | bufp += fifo_depth; |
1103 | left -= fifo_depth; | 1118 | left -= fifo_depth; |
1104 | continue; | 1119 | continue; |
1105 | } | 1120 | } |
1106 | 1121 | ||
1107 | DPRINTK (KERN_DEBUG "*** ecp_read_block_pio: reading one byte from the FIFO\n"); | 1122 | DPRINTK(KERN_DEBUG "*** ecp_read_block_pio: reading one byte from the FIFO\n"); |
1108 | 1123 | ||
1109 | /* FIFO not filled. We will cycle this loop for a while | 1124 | /* FIFO not filled. We will cycle this loop for a while |
1110 | * and either the peripheral will fill it faster, | 1125 | * and either the peripheral will fill it faster, |
1111 | * tripping a fast empty with insb, or we empty it. */ | 1126 | * tripping a fast empty with insb, or we empty it. */ |
1112 | *bufp++ = inb (fifo); | 1127 | *bufp++ = inb(fifo); |
1113 | left--; | 1128 | left--; |
1114 | } | 1129 | } |
1115 | 1130 | ||
1116 | /* scoop up anything left in the FIFO */ | 1131 | /* scoop up anything left in the FIFO */ |
1117 | while (left && !(inb (ECONTROL (port) & 0x01))) { | 1132 | while (left && !(inb(ECONTROL(port) & 0x01))) { |
1118 | *bufp++ = inb (fifo); | 1133 | *bufp++ = inb(fifo); |
1119 | left--; | 1134 | left--; |
1120 | } | 1135 | } |
1121 | 1136 | ||
1122 | port->ieee1284.phase = IEEE1284_PH_REV_IDLE; | 1137 | port->ieee1284.phase = IEEE1284_PH_REV_IDLE; |
1123 | dump_parport_state ("rev idle2", port); | 1138 | dump_parport_state("rev idle2", port); |
1124 | 1139 | ||
1125 | out_no_data: | 1140 | out_no_data: |
1126 | 1141 | ||
1127 | /* Go to forward idle mode to shut the peripheral up (event 47). */ | 1142 | /* Go to forward idle mode to shut the peripheral up (event 47). */ |
1128 | parport_frob_control (port, PARPORT_CONTROL_INIT, PARPORT_CONTROL_INIT); | 1143 | parport_frob_control(port, PARPORT_CONTROL_INIT, PARPORT_CONTROL_INIT); |
1129 | 1144 | ||
1130 | /* event 49: PError goes high */ | 1145 | /* event 49: PError goes high */ |
1131 | r = parport_wait_peripheral (port, | 1146 | r = parport_wait_peripheral(port, |
1132 | PARPORT_STATUS_PAPEROUT, | 1147 | PARPORT_STATUS_PAPEROUT, |
1133 | PARPORT_STATUS_PAPEROUT); | 1148 | PARPORT_STATUS_PAPEROUT); |
1134 | if (r) { | 1149 | if (r) { |
1135 | printk (KERN_DEBUG | 1150 | printk(KERN_DEBUG |
1136 | "%s: PE timeout FWDIDLE (%d) in ecp_read_block_pio\n", | 1151 | "%s: PE timeout FWDIDLE (%d) in ecp_read_block_pio\n", |
1137 | port->name, r); | 1152 | port->name, r); |
1138 | } | 1153 | } |
@@ -1141,14 +1156,14 @@ out_no_data: | |||
1141 | 1156 | ||
1142 | /* Finish up. */ | 1157 | /* Finish up. */ |
1143 | { | 1158 | { |
1144 | int lost = get_fifo_residue (port); | 1159 | int lost = get_fifo_residue(port); |
1145 | if (lost) | 1160 | if (lost) |
1146 | /* Shouldn't happen with compliant peripherals. */ | 1161 | /* Shouldn't happen with compliant peripherals. */ |
1147 | printk (KERN_DEBUG "%s: DATA LOSS (%d bytes)!\n", | 1162 | printk(KERN_DEBUG "%s: DATA LOSS (%d bytes)!\n", |
1148 | port->name, lost); | 1163 | port->name, lost); |
1149 | } | 1164 | } |
1150 | 1165 | ||
1151 | dump_parport_state ("fwd idle", port); | 1166 | dump_parport_state("fwd idle", port); |
1152 | return length - left; | 1167 | return length - left; |
1153 | } | 1168 | } |
1154 | #endif /* 0 */ | 1169 | #endif /* 0 */ |
@@ -1164,8 +1179,7 @@ dump_parport_state ("fwd idle", port); | |||
1164 | 1179 | ||
1165 | /* GCC is not inlining extern inline function later overwriten to non-inline, | 1180 | /* GCC is not inlining extern inline function later overwriten to non-inline, |
1166 | so we use outlined_ variants here. */ | 1181 | so we use outlined_ variants here. */ |
1167 | static const struct parport_operations parport_pc_ops = | 1182 | static const struct parport_operations parport_pc_ops = { |
1168 | { | ||
1169 | .write_data = parport_pc_write_data, | 1183 | .write_data = parport_pc_write_data, |
1170 | .read_data = parport_pc_read_data, | 1184 | .read_data = parport_pc_read_data, |
1171 | 1185 | ||
@@ -1205,46 +1219,52 @@ static const struct parport_operations parport_pc_ops = | |||
1205 | /* Super-IO chipset detection, Winbond, SMSC */ | 1219 | /* Super-IO chipset detection, Winbond, SMSC */ |
1206 | static void __devinit show_parconfig_smsc37c669(int io, int key) | 1220 | static void __devinit show_parconfig_smsc37c669(int io, int key) |
1207 | { | 1221 | { |
1208 | int cr1,cr4,cra,cr23,cr26,cr27,i=0; | 1222 | int cr1, cr4, cra, cr23, cr26, cr27, i = 0; |
1209 | static const char *const modes[]={ | 1223 | static const char *const modes[] = { |
1210 | "SPP and Bidirectional (PS/2)", | 1224 | "SPP and Bidirectional (PS/2)", |
1211 | "EPP and SPP", | 1225 | "EPP and SPP", |
1212 | "ECP", | 1226 | "ECP", |
1213 | "ECP and EPP" }; | 1227 | "ECP and EPP" }; |
1214 | 1228 | ||
1215 | outb(key,io); | 1229 | outb(key, io); |
1216 | outb(key,io); | 1230 | outb(key, io); |
1217 | outb(1,io); | 1231 | outb(1, io); |
1218 | cr1=inb(io+1); | 1232 | cr1 = inb(io + 1); |
1219 | outb(4,io); | 1233 | outb(4, io); |
1220 | cr4=inb(io+1); | 1234 | cr4 = inb(io + 1); |
1221 | outb(0x0a,io); | 1235 | outb(0x0a, io); |
1222 | cra=inb(io+1); | 1236 | cra = inb(io + 1); |
1223 | outb(0x23,io); | 1237 | outb(0x23, io); |
1224 | cr23=inb(io+1); | 1238 | cr23 = inb(io + 1); |
1225 | outb(0x26,io); | 1239 | outb(0x26, io); |
1226 | cr26=inb(io+1); | 1240 | cr26 = inb(io + 1); |
1227 | outb(0x27,io); | 1241 | outb(0x27, io); |
1228 | cr27=inb(io+1); | 1242 | cr27 = inb(io + 1); |
1229 | outb(0xaa,io); | 1243 | outb(0xaa, io); |
1230 | 1244 | ||
1231 | if (verbose_probing) { | 1245 | if (verbose_probing) { |
1232 | printk (KERN_INFO "SMSC 37c669 LPT Config: cr_1=0x%02x, 4=0x%02x, " | 1246 | printk(KERN_INFO |
1247 | "SMSC 37c669 LPT Config: cr_1=0x%02x, 4=0x%02x, " | ||
1233 | "A=0x%2x, 23=0x%02x, 26=0x%02x, 27=0x%02x\n", | 1248 | "A=0x%2x, 23=0x%02x, 26=0x%02x, 27=0x%02x\n", |
1234 | cr1,cr4,cra,cr23,cr26,cr27); | 1249 | cr1, cr4, cra, cr23, cr26, cr27); |
1235 | 1250 | ||
1236 | /* The documentation calls DMA and IRQ-Lines by letters, so | 1251 | /* The documentation calls DMA and IRQ-Lines by letters, so |
1237 | the board maker can/will wire them | 1252 | the board maker can/will wire them |
1238 | appropriately/randomly... G=reserved H=IDE-irq, */ | 1253 | appropriately/randomly... G=reserved H=IDE-irq, */ |
1239 | printk (KERN_INFO "SMSC LPT Config: io=0x%04x, irq=%c, dma=%c, " | 1254 | printk(KERN_INFO |
1240 | "fifo threshold=%d\n", cr23*4, | 1255 | "SMSC LPT Config: io=0x%04x, irq=%c, dma=%c, fifo threshold=%d\n", |
1241 | (cr27 &0x0f) ? 'A'-1+(cr27 &0x0f): '-', | 1256 | cr23 * 4, |
1242 | (cr26 &0x0f) ? 'A'-1+(cr26 &0x0f): '-', cra & 0x0f); | 1257 | (cr27 & 0x0f) ? 'A' - 1 + (cr27 & 0x0f) : '-', |
1258 | (cr26 & 0x0f) ? 'A' - 1 + (cr26 & 0x0f) : '-', | ||
1259 | cra & 0x0f); | ||
1243 | printk(KERN_INFO "SMSC LPT Config: enabled=%s power=%s\n", | 1260 | printk(KERN_INFO "SMSC LPT Config: enabled=%s power=%s\n", |
1244 | (cr23*4 >=0x100) ?"yes":"no", (cr1 & 4) ? "yes" : "no"); | 1261 | (cr23 * 4 >= 0x100) ? "yes" : "no", |
1245 | printk(KERN_INFO "SMSC LPT Config: Port mode=%s, EPP version =%s\n", | 1262 | (cr1 & 4) ? "yes" : "no"); |
1246 | (cr1 & 0x08 ) ? "Standard mode only (SPP)" : modes[cr4 & 0x03], | 1263 | printk(KERN_INFO |
1247 | (cr4 & 0x40) ? "1.7" : "1.9"); | 1264 | "SMSC LPT Config: Port mode=%s, EPP version =%s\n", |
1265 | (cr1 & 0x08) ? "Standard mode only (SPP)" | ||
1266 | : modes[cr4 & 0x03], | ||
1267 | (cr4 & 0x40) ? "1.7" : "1.9"); | ||
1248 | } | 1268 | } |
1249 | 1269 | ||
1250 | /* Heuristics ! BIOS setup for this mainboard device limits | 1270 | /* Heuristics ! BIOS setup for this mainboard device limits |
@@ -1258,32 +1278,32 @@ static void __devinit show_parconfig_smsc37c669(int io, int key) | |||
1258 | printk(KERN_INFO "Super-IO: too many chips!\n"); | 1278 | printk(KERN_INFO "Super-IO: too many chips!\n"); |
1259 | } else { | 1279 | } else { |
1260 | int d; | 1280 | int d; |
1261 | switch (cr23*4) { | 1281 | switch (cr23 * 4) { |
1262 | case 0x3bc: | 1282 | case 0x3bc: |
1263 | superios[i].io = 0x3bc; | 1283 | superios[i].io = 0x3bc; |
1264 | superios[i].irq = 7; | 1284 | superios[i].irq = 7; |
1265 | break; | 1285 | break; |
1266 | case 0x378: | 1286 | case 0x378: |
1267 | superios[i].io = 0x378; | 1287 | superios[i].io = 0x378; |
1268 | superios[i].irq = 7; | 1288 | superios[i].irq = 7; |
1269 | break; | 1289 | break; |
1270 | case 0x278: | 1290 | case 0x278: |
1271 | superios[i].io = 0x278; | 1291 | superios[i].io = 0x278; |
1272 | superios[i].irq = 5; | 1292 | superios[i].irq = 5; |
1273 | } | 1293 | } |
1274 | d=(cr26 &0x0f); | 1294 | d = (cr26 & 0x0f); |
1275 | if((d==1) || (d==3)) | 1295 | if (d == 1 || d == 3) |
1276 | superios[i].dma= d; | 1296 | superios[i].dma = d; |
1277 | else | 1297 | else |
1278 | superios[i].dma= PARPORT_DMA_NONE; | 1298 | superios[i].dma = PARPORT_DMA_NONE; |
1279 | } | 1299 | } |
1280 | } | 1300 | } |
1281 | } | 1301 | } |
1282 | 1302 | ||
1283 | 1303 | ||
1284 | static void __devinit show_parconfig_winbond(int io, int key) | 1304 | static void __devinit show_parconfig_winbond(int io, int key) |
1285 | { | 1305 | { |
1286 | int cr30,cr60,cr61,cr70,cr74,crf0,i=0; | 1306 | int cr30, cr60, cr61, cr70, cr74, crf0, i = 0; |
1287 | static const char *const modes[] = { | 1307 | static const char *const modes[] = { |
1288 | "Standard (SPP) and Bidirectional(PS/2)", /* 0 */ | 1308 | "Standard (SPP) and Bidirectional(PS/2)", /* 0 */ |
1289 | "EPP-1.9 and SPP", | 1309 | "EPP-1.9 and SPP", |
@@ -1296,40 +1316,43 @@ static void __devinit show_parconfig_winbond(int io, int key) | |||
1296 | static char *const irqtypes[] = { | 1316 | static char *const irqtypes[] = { |
1297 | "pulsed low, high-Z", | 1317 | "pulsed low, high-Z", |
1298 | "follows nACK" }; | 1318 | "follows nACK" }; |
1299 | 1319 | ||
1300 | /* The registers are called compatible-PnP because the | 1320 | /* The registers are called compatible-PnP because the |
1301 | register layout is modelled after ISA-PnP, the access | 1321 | register layout is modelled after ISA-PnP, the access |
1302 | method is just another ... */ | 1322 | method is just another ... */ |
1303 | outb(key,io); | 1323 | outb(key, io); |
1304 | outb(key,io); | 1324 | outb(key, io); |
1305 | outb(0x07,io); /* Register 7: Select Logical Device */ | 1325 | outb(0x07, io); /* Register 7: Select Logical Device */ |
1306 | outb(0x01,io+1); /* LD1 is Parallel Port */ | 1326 | outb(0x01, io + 1); /* LD1 is Parallel Port */ |
1307 | outb(0x30,io); | 1327 | outb(0x30, io); |
1308 | cr30=inb(io+1); | 1328 | cr30 = inb(io + 1); |
1309 | outb(0x60,io); | 1329 | outb(0x60, io); |
1310 | cr60=inb(io+1); | 1330 | cr60 = inb(io + 1); |
1311 | outb(0x61,io); | 1331 | outb(0x61, io); |
1312 | cr61=inb(io+1); | 1332 | cr61 = inb(io + 1); |
1313 | outb(0x70,io); | 1333 | outb(0x70, io); |
1314 | cr70=inb(io+1); | 1334 | cr70 = inb(io + 1); |
1315 | outb(0x74,io); | 1335 | outb(0x74, io); |
1316 | cr74=inb(io+1); | 1336 | cr74 = inb(io + 1); |
1317 | outb(0xf0,io); | 1337 | outb(0xf0, io); |
1318 | crf0=inb(io+1); | 1338 | crf0 = inb(io + 1); |
1319 | outb(0xaa,io); | 1339 | outb(0xaa, io); |
1320 | 1340 | ||
1321 | if (verbose_probing) { | 1341 | if (verbose_probing) { |
1322 | printk(KERN_INFO "Winbond LPT Config: cr_30=%02x 60,61=%02x%02x " | 1342 | printk(KERN_INFO |
1323 | "70=%02x 74=%02x, f0=%02x\n", cr30,cr60,cr61,cr70,cr74,crf0); | 1343 | "Winbond LPT Config: cr_30=%02x 60,61=%02x%02x 70=%02x 74=%02x, f0=%02x\n", |
1324 | printk(KERN_INFO "Winbond LPT Config: active=%s, io=0x%02x%02x irq=%d, ", | 1344 | cr30, cr60, cr61, cr70, cr74, crf0); |
1325 | (cr30 & 0x01) ? "yes":"no", cr60,cr61,cr70&0x0f ); | 1345 | printk(KERN_INFO "Winbond LPT Config: active=%s, io=0x%02x%02x irq=%d, ", |
1346 | (cr30 & 0x01) ? "yes" : "no", cr60, cr61, cr70 & 0x0f); | ||
1326 | if ((cr74 & 0x07) > 3) | 1347 | if ((cr74 & 0x07) > 3) |
1327 | printk("dma=none\n"); | 1348 | printk("dma=none\n"); |
1328 | else | 1349 | else |
1329 | printk("dma=%d\n",cr74 & 0x07); | 1350 | printk("dma=%d\n", cr74 & 0x07); |
1330 | printk(KERN_INFO "Winbond LPT Config: irqtype=%s, ECP fifo threshold=%d\n", | 1351 | printk(KERN_INFO |
1331 | irqtypes[crf0>>7], (crf0>>3)&0x0f); | 1352 | "Winbond LPT Config: irqtype=%s, ECP fifo threshold=%d\n", |
1332 | printk(KERN_INFO "Winbond LPT Config: Port mode=%s\n", modes[crf0 & 0x07]); | 1353 | irqtypes[crf0>>7], (crf0>>3)&0x0f); |
1354 | printk(KERN_INFO "Winbond LPT Config: Port mode=%s\n", | ||
1355 | modes[crf0 & 0x07]); | ||
1333 | } | 1356 | } |
1334 | 1357 | ||
1335 | if (cr30 & 0x01) { /* the settings can be interrogated later ... */ | 1358 | if (cr30 & 0x01) { /* the settings can be interrogated later ... */ |
@@ -1346,60 +1369,82 @@ static void __devinit show_parconfig_winbond(int io, int key) | |||
1346 | } | 1369 | } |
1347 | } | 1370 | } |
1348 | 1371 | ||
1349 | static void __devinit decode_winbond(int efer, int key, int devid, int devrev, int oldid) | 1372 | static void __devinit decode_winbond(int efer, int key, int devid, |
1373 | int devrev, int oldid) | ||
1350 | { | 1374 | { |
1351 | const char *type = "unknown"; | 1375 | const char *type = "unknown"; |
1352 | int id,progif=2; | 1376 | int id, progif = 2; |
1353 | 1377 | ||
1354 | if (devid == devrev) | 1378 | if (devid == devrev) |
1355 | /* simple heuristics, we happened to read some | 1379 | /* simple heuristics, we happened to read some |
1356 | non-winbond register */ | 1380 | non-winbond register */ |
1357 | return; | 1381 | return; |
1358 | 1382 | ||
1359 | id=(devid<<8) | devrev; | 1383 | id = (devid << 8) | devrev; |
1360 | 1384 | ||
1361 | /* Values are from public data sheets pdf files, I can just | 1385 | /* Values are from public data sheets pdf files, I can just |
1362 | confirm 83977TF is correct :-) */ | 1386 | confirm 83977TF is correct :-) */ |
1363 | if (id == 0x9771) type="83977F/AF"; | 1387 | if (id == 0x9771) |
1364 | else if (id == 0x9773) type="83977TF / SMSC 97w33x/97w34x"; | 1388 | type = "83977F/AF"; |
1365 | else if (id == 0x9774) type="83977ATF"; | 1389 | else if (id == 0x9773) |
1366 | else if ((id & ~0x0f) == 0x5270) type="83977CTF / SMSC 97w36x"; | 1390 | type = "83977TF / SMSC 97w33x/97w34x"; |
1367 | else if ((id & ~0x0f) == 0x52f0) type="83977EF / SMSC 97w35x"; | 1391 | else if (id == 0x9774) |
1368 | else if ((id & ~0x0f) == 0x5210) type="83627"; | 1392 | type = "83977ATF"; |
1369 | else if ((id & ~0x0f) == 0x6010) type="83697HF"; | 1393 | else if ((id & ~0x0f) == 0x5270) |
1370 | else if ((oldid &0x0f ) == 0x0a) { type="83877F"; progif=1;} | 1394 | type = "83977CTF / SMSC 97w36x"; |
1371 | else if ((oldid &0x0f ) == 0x0b) { type="83877AF"; progif=1;} | 1395 | else if ((id & ~0x0f) == 0x52f0) |
1372 | else if ((oldid &0x0f ) == 0x0c) { type="83877TF"; progif=1;} | 1396 | type = "83977EF / SMSC 97w35x"; |
1373 | else if ((oldid &0x0f ) == 0x0d) { type="83877ATF"; progif=1;} | 1397 | else if ((id & ~0x0f) == 0x5210) |
1374 | else progif=0; | 1398 | type = "83627"; |
1399 | else if ((id & ~0x0f) == 0x6010) | ||
1400 | type = "83697HF"; | ||
1401 | else if ((oldid & 0x0f) == 0x0a) { | ||
1402 | type = "83877F"; | ||
1403 | progif = 1; | ||
1404 | } else if ((oldid & 0x0f) == 0x0b) { | ||
1405 | type = "83877AF"; | ||
1406 | progif = 1; | ||
1407 | } else if ((oldid & 0x0f) == 0x0c) { | ||
1408 | type = "83877TF"; | ||
1409 | progif = 1; | ||
1410 | } else if ((oldid & 0x0f) == 0x0d) { | ||
1411 | type = "83877ATF"; | ||
1412 | progif = 1; | ||
1413 | } else | ||
1414 | progif = 0; | ||
1375 | 1415 | ||
1376 | if (verbose_probing) | 1416 | if (verbose_probing) |
1377 | printk(KERN_INFO "Winbond chip at EFER=0x%x key=0x%02x " | 1417 | printk(KERN_INFO "Winbond chip at EFER=0x%x key=0x%02x " |
1378 | "devid=%02x devrev=%02x oldid=%02x type=%s\n", | 1418 | "devid=%02x devrev=%02x oldid=%02x type=%s\n", |
1379 | efer, key, devid, devrev, oldid, type); | 1419 | efer, key, devid, devrev, oldid, type); |
1380 | 1420 | ||
1381 | if (progif == 2) | 1421 | if (progif == 2) |
1382 | show_parconfig_winbond(efer,key); | 1422 | show_parconfig_winbond(efer, key); |
1383 | } | 1423 | } |
1384 | 1424 | ||
1385 | static void __devinit decode_smsc(int efer, int key, int devid, int devrev) | 1425 | static void __devinit decode_smsc(int efer, int key, int devid, int devrev) |
1386 | { | 1426 | { |
1387 | const char *type = "unknown"; | 1427 | const char *type = "unknown"; |
1388 | void (*func)(int io, int key); | 1428 | void (*func)(int io, int key); |
1389 | int id; | 1429 | int id; |
1390 | 1430 | ||
1391 | if (devid == devrev) | 1431 | if (devid == devrev) |
1392 | /* simple heuristics, we happened to read some | 1432 | /* simple heuristics, we happened to read some |
1393 | non-smsc register */ | 1433 | non-smsc register */ |
1394 | return; | 1434 | return; |
1395 | 1435 | ||
1396 | func=NULL; | 1436 | func = NULL; |
1397 | id=(devid<<8) | devrev; | 1437 | id = (devid << 8) | devrev; |
1398 | 1438 | ||
1399 | if (id==0x0302) {type="37c669"; func=show_parconfig_smsc37c669;} | 1439 | if (id == 0x0302) { |
1400 | else if (id==0x6582) type="37c665IR"; | 1440 | type = "37c669"; |
1401 | else if (devid==0x65) type="37c665GT"; | 1441 | func = show_parconfig_smsc37c669; |
1402 | else if (devid==0x66) type="37c666GT"; | 1442 | } else if (id == 0x6582) |
1443 | type = "37c665IR"; | ||
1444 | else if (devid == 0x65) | ||
1445 | type = "37c665GT"; | ||
1446 | else if (devid == 0x66) | ||
1447 | type = "37c666GT"; | ||
1403 | 1448 | ||
1404 | if (verbose_probing) | 1449 | if (verbose_probing) |
1405 | printk(KERN_INFO "SMSC chip at EFER=0x%x " | 1450 | printk(KERN_INFO "SMSC chip at EFER=0x%x " |
@@ -1407,138 +1452,138 @@ static void __devinit decode_smsc(int efer, int key, int devid, int devrev) | |||
1407 | efer, key, devid, devrev, type); | 1452 | efer, key, devid, devrev, type); |
1408 | 1453 | ||
1409 | if (func) | 1454 | if (func) |
1410 | func(efer,key); | 1455 | func(efer, key); |
1411 | } | 1456 | } |
1412 | 1457 | ||
1413 | 1458 | ||
1414 | static void __devinit winbond_check(int io, int key) | 1459 | static void __devinit winbond_check(int io, int key) |
1415 | { | 1460 | { |
1416 | int devid,devrev,oldid,x_devid,x_devrev,x_oldid; | 1461 | int devid, devrev, oldid, x_devid, x_devrev, x_oldid; |
1417 | 1462 | ||
1418 | if (!request_region(io, 3, __func__)) | 1463 | if (!request_region(io, 3, __func__)) |
1419 | return; | 1464 | return; |
1420 | 1465 | ||
1421 | /* First probe without key */ | 1466 | /* First probe without key */ |
1422 | outb(0x20,io); | 1467 | outb(0x20, io); |
1423 | x_devid=inb(io+1); | 1468 | x_devid = inb(io + 1); |
1424 | outb(0x21,io); | 1469 | outb(0x21, io); |
1425 | x_devrev=inb(io+1); | 1470 | x_devrev = inb(io + 1); |
1426 | outb(0x09,io); | 1471 | outb(0x09, io); |
1427 | x_oldid=inb(io+1); | 1472 | x_oldid = inb(io + 1); |
1428 | 1473 | ||
1429 | outb(key,io); | 1474 | outb(key, io); |
1430 | outb(key,io); /* Write Magic Sequence to EFER, extended | 1475 | outb(key, io); /* Write Magic Sequence to EFER, extended |
1431 | funtion enable register */ | 1476 | funtion enable register */ |
1432 | outb(0x20,io); /* Write EFIR, extended function index register */ | 1477 | outb(0x20, io); /* Write EFIR, extended function index register */ |
1433 | devid=inb(io+1); /* Read EFDR, extended function data register */ | 1478 | devid = inb(io + 1); /* Read EFDR, extended function data register */ |
1434 | outb(0x21,io); | 1479 | outb(0x21, io); |
1435 | devrev=inb(io+1); | 1480 | devrev = inb(io + 1); |
1436 | outb(0x09,io); | 1481 | outb(0x09, io); |
1437 | oldid=inb(io+1); | 1482 | oldid = inb(io + 1); |
1438 | outb(0xaa,io); /* Magic Seal */ | 1483 | outb(0xaa, io); /* Magic Seal */ |
1439 | 1484 | ||
1440 | if ((x_devid == devid) && (x_devrev == devrev) && (x_oldid == oldid)) | 1485 | if ((x_devid == devid) && (x_devrev == devrev) && (x_oldid == oldid)) |
1441 | goto out; /* protection against false positives */ | 1486 | goto out; /* protection against false positives */ |
1442 | 1487 | ||
1443 | decode_winbond(io,key,devid,devrev,oldid); | 1488 | decode_winbond(io, key, devid, devrev, oldid); |
1444 | out: | 1489 | out: |
1445 | release_region(io, 3); | 1490 | release_region(io, 3); |
1446 | } | 1491 | } |
1447 | 1492 | ||
1448 | static void __devinit winbond_check2(int io,int key) | 1493 | static void __devinit winbond_check2(int io, int key) |
1449 | { | 1494 | { |
1450 | int devid,devrev,oldid,x_devid,x_devrev,x_oldid; | 1495 | int devid, devrev, oldid, x_devid, x_devrev, x_oldid; |
1451 | 1496 | ||
1452 | if (!request_region(io, 3, __func__)) | 1497 | if (!request_region(io, 3, __func__)) |
1453 | return; | 1498 | return; |
1454 | 1499 | ||
1455 | /* First probe without the key */ | 1500 | /* First probe without the key */ |
1456 | outb(0x20,io+2); | 1501 | outb(0x20, io + 2); |
1457 | x_devid=inb(io+2); | 1502 | x_devid = inb(io + 2); |
1458 | outb(0x21,io+1); | 1503 | outb(0x21, io + 1); |
1459 | x_devrev=inb(io+2); | 1504 | x_devrev = inb(io + 2); |
1460 | outb(0x09,io+1); | 1505 | outb(0x09, io + 1); |
1461 | x_oldid=inb(io+2); | 1506 | x_oldid = inb(io + 2); |
1462 | 1507 | ||
1463 | outb(key,io); /* Write Magic Byte to EFER, extended | 1508 | outb(key, io); /* Write Magic Byte to EFER, extended |
1464 | funtion enable register */ | 1509 | funtion enable register */ |
1465 | outb(0x20,io+2); /* Write EFIR, extended function index register */ | 1510 | outb(0x20, io + 2); /* Write EFIR, extended function index register */ |
1466 | devid=inb(io+2); /* Read EFDR, extended function data register */ | 1511 | devid = inb(io + 2); /* Read EFDR, extended function data register */ |
1467 | outb(0x21,io+1); | 1512 | outb(0x21, io + 1); |
1468 | devrev=inb(io+2); | 1513 | devrev = inb(io + 2); |
1469 | outb(0x09,io+1); | 1514 | outb(0x09, io + 1); |
1470 | oldid=inb(io+2); | 1515 | oldid = inb(io + 2); |
1471 | outb(0xaa,io); /* Magic Seal */ | 1516 | outb(0xaa, io); /* Magic Seal */ |
1472 | 1517 | ||
1473 | if ((x_devid == devid) && (x_devrev == devrev) && (x_oldid == oldid)) | 1518 | if (x_devid == devid && x_devrev == devrev && x_oldid == oldid) |
1474 | goto out; /* protection against false positives */ | 1519 | goto out; /* protection against false positives */ |
1475 | 1520 | ||
1476 | decode_winbond(io,key,devid,devrev,oldid); | 1521 | decode_winbond(io, key, devid, devrev, oldid); |
1477 | out: | 1522 | out: |
1478 | release_region(io, 3); | 1523 | release_region(io, 3); |
1479 | } | 1524 | } |
1480 | 1525 | ||
1481 | static void __devinit smsc_check(int io, int key) | 1526 | static void __devinit smsc_check(int io, int key) |
1482 | { | 1527 | { |
1483 | int id,rev,oldid,oldrev,x_id,x_rev,x_oldid,x_oldrev; | 1528 | int id, rev, oldid, oldrev, x_id, x_rev, x_oldid, x_oldrev; |
1484 | 1529 | ||
1485 | if (!request_region(io, 3, __func__)) | 1530 | if (!request_region(io, 3, __func__)) |
1486 | return; | 1531 | return; |
1487 | 1532 | ||
1488 | /* First probe without the key */ | 1533 | /* First probe without the key */ |
1489 | outb(0x0d,io); | 1534 | outb(0x0d, io); |
1490 | x_oldid=inb(io+1); | 1535 | x_oldid = inb(io + 1); |
1491 | outb(0x0e,io); | 1536 | outb(0x0e, io); |
1492 | x_oldrev=inb(io+1); | 1537 | x_oldrev = inb(io + 1); |
1493 | outb(0x20,io); | 1538 | outb(0x20, io); |
1494 | x_id=inb(io+1); | 1539 | x_id = inb(io + 1); |
1495 | outb(0x21,io); | 1540 | outb(0x21, io); |
1496 | x_rev=inb(io+1); | 1541 | x_rev = inb(io + 1); |
1497 | 1542 | ||
1498 | outb(key,io); | 1543 | outb(key, io); |
1499 | outb(key,io); /* Write Magic Sequence to EFER, extended | 1544 | outb(key, io); /* Write Magic Sequence to EFER, extended |
1500 | funtion enable register */ | 1545 | funtion enable register */ |
1501 | outb(0x0d,io); /* Write EFIR, extended function index register */ | 1546 | outb(0x0d, io); /* Write EFIR, extended function index register */ |
1502 | oldid=inb(io+1); /* Read EFDR, extended function data register */ | 1547 | oldid = inb(io + 1); /* Read EFDR, extended function data register */ |
1503 | outb(0x0e,io); | 1548 | outb(0x0e, io); |
1504 | oldrev=inb(io+1); | 1549 | oldrev = inb(io + 1); |
1505 | outb(0x20,io); | 1550 | outb(0x20, io); |
1506 | id=inb(io+1); | 1551 | id = inb(io + 1); |
1507 | outb(0x21,io); | 1552 | outb(0x21, io); |
1508 | rev=inb(io+1); | 1553 | rev = inb(io + 1); |
1509 | outb(0xaa,io); /* Magic Seal */ | 1554 | outb(0xaa, io); /* Magic Seal */ |
1510 | 1555 | ||
1511 | if ((x_id == id) && (x_oldrev == oldrev) && | 1556 | if (x_id == id && x_oldrev == oldrev && |
1512 | (x_oldid == oldid) && (x_rev == rev)) | 1557 | x_oldid == oldid && x_rev == rev) |
1513 | goto out; /* protection against false positives */ | 1558 | goto out; /* protection against false positives */ |
1514 | 1559 | ||
1515 | decode_smsc(io,key,oldid,oldrev); | 1560 | decode_smsc(io, key, oldid, oldrev); |
1516 | out: | 1561 | out: |
1517 | release_region(io, 3); | 1562 | release_region(io, 3); |
1518 | } | 1563 | } |
1519 | 1564 | ||
1520 | 1565 | ||
1521 | static void __devinit detect_and_report_winbond (void) | 1566 | static void __devinit detect_and_report_winbond(void) |
1522 | { | 1567 | { |
1523 | if (verbose_probing) | 1568 | if (verbose_probing) |
1524 | printk(KERN_DEBUG "Winbond Super-IO detection, now testing ports 3F0,370,250,4E,2E ...\n"); | 1569 | printk(KERN_DEBUG "Winbond Super-IO detection, now testing ports 3F0,370,250,4E,2E ...\n"); |
1525 | winbond_check(0x3f0,0x87); | 1570 | winbond_check(0x3f0, 0x87); |
1526 | winbond_check(0x370,0x87); | 1571 | winbond_check(0x370, 0x87); |
1527 | winbond_check(0x2e ,0x87); | 1572 | winbond_check(0x2e , 0x87); |
1528 | winbond_check(0x4e ,0x87); | 1573 | winbond_check(0x4e , 0x87); |
1529 | winbond_check(0x3f0,0x86); | 1574 | winbond_check(0x3f0, 0x86); |
1530 | winbond_check2(0x250,0x88); | 1575 | winbond_check2(0x250, 0x88); |
1531 | winbond_check2(0x250,0x89); | 1576 | winbond_check2(0x250, 0x89); |
1532 | } | 1577 | } |
1533 | 1578 | ||
1534 | static void __devinit detect_and_report_smsc (void) | 1579 | static void __devinit detect_and_report_smsc(void) |
1535 | { | 1580 | { |
1536 | if (verbose_probing) | 1581 | if (verbose_probing) |
1537 | printk(KERN_DEBUG "SMSC Super-IO detection, now testing Ports 2F0, 370 ...\n"); | 1582 | printk(KERN_DEBUG "SMSC Super-IO detection, now testing Ports 2F0, 370 ...\n"); |
1538 | smsc_check(0x3f0,0x55); | 1583 | smsc_check(0x3f0, 0x55); |
1539 | smsc_check(0x370,0x55); | 1584 | smsc_check(0x370, 0x55); |
1540 | smsc_check(0x3f0,0x44); | 1585 | smsc_check(0x3f0, 0x44); |
1541 | smsc_check(0x370,0x44); | 1586 | smsc_check(0x370, 0x44); |
1542 | } | 1587 | } |
1543 | 1588 | ||
1544 | static void __devinit detect_and_report_it87(void) | 1589 | static void __devinit detect_and_report_it87(void) |
@@ -1573,7 +1618,7 @@ static void __devinit detect_and_report_it87(void) | |||
1573 | } | 1618 | } |
1574 | #endif /* CONFIG_PARPORT_PC_SUPERIO */ | 1619 | #endif /* CONFIG_PARPORT_PC_SUPERIO */ |
1575 | 1620 | ||
1576 | static int get_superio_dma (struct parport *p) | 1621 | static int get_superio_dma(struct parport *p) |
1577 | { | 1622 | { |
1578 | int i = 0; | 1623 | int i = 0; |
1579 | 1624 | ||
@@ -1584,15 +1629,15 @@ static int get_superio_dma (struct parport *p) | |||
1584 | return PARPORT_DMA_NONE; | 1629 | return PARPORT_DMA_NONE; |
1585 | } | 1630 | } |
1586 | 1631 | ||
1587 | static int get_superio_irq (struct parport *p) | 1632 | static int get_superio_irq(struct parport *p) |
1588 | { | 1633 | { |
1589 | int i = 0; | 1634 | int i = 0; |
1590 | 1635 | ||
1591 | while ((i < NR_SUPERIOS) && (superios[i].io != p->base)) | 1636 | while ((i < NR_SUPERIOS) && (superios[i].io != p->base)) |
1592 | i++; | 1637 | i++; |
1593 | if (i != NR_SUPERIOS) | 1638 | if (i != NR_SUPERIOS) |
1594 | return superios[i].irq; | 1639 | return superios[i].irq; |
1595 | return PARPORT_IRQ_NONE; | 1640 | return PARPORT_IRQ_NONE; |
1596 | } | 1641 | } |
1597 | 1642 | ||
1598 | 1643 | ||
@@ -1600,9 +1645,9 @@ static int get_superio_irq (struct parport *p) | |||
1600 | 1645 | ||
1601 | /* | 1646 | /* |
1602 | * Checks for port existence, all ports support SPP MODE | 1647 | * Checks for port existence, all ports support SPP MODE |
1603 | * Returns: | 1648 | * Returns: |
1604 | * 0 : No parallel port at this address | 1649 | * 0 : No parallel port at this address |
1605 | * PARPORT_MODE_PCSPP : SPP port detected | 1650 | * PARPORT_MODE_PCSPP : SPP port detected |
1606 | * (if the user specified an ioport himself, | 1651 | * (if the user specified an ioport himself, |
1607 | * this shall always be the case!) | 1652 | * this shall always be the case!) |
1608 | * | 1653 | * |
@@ -1612,7 +1657,7 @@ static int parport_SPP_supported(struct parport *pb) | |||
1612 | unsigned char r, w; | 1657 | unsigned char r, w; |
1613 | 1658 | ||
1614 | /* | 1659 | /* |
1615 | * first clear an eventually pending EPP timeout | 1660 | * first clear an eventually pending EPP timeout |
1616 | * I (sailer@ife.ee.ethz.ch) have an SMSC chipset | 1661 | * I (sailer@ife.ee.ethz.ch) have an SMSC chipset |
1617 | * that does not even respond to SPP cycles if an EPP | 1662 | * that does not even respond to SPP cycles if an EPP |
1618 | * timeout is pending | 1663 | * timeout is pending |
@@ -1621,19 +1666,19 @@ static int parport_SPP_supported(struct parport *pb) | |||
1621 | 1666 | ||
1622 | /* Do a simple read-write test to make sure the port exists. */ | 1667 | /* Do a simple read-write test to make sure the port exists. */ |
1623 | w = 0xc; | 1668 | w = 0xc; |
1624 | outb (w, CONTROL (pb)); | 1669 | outb(w, CONTROL(pb)); |
1625 | 1670 | ||
1626 | /* Is there a control register that we can read from? Some | 1671 | /* Is there a control register that we can read from? Some |
1627 | * ports don't allow reads, so read_control just returns a | 1672 | * ports don't allow reads, so read_control just returns a |
1628 | * software copy. Some ports _do_ allow reads, so bypass the | 1673 | * software copy. Some ports _do_ allow reads, so bypass the |
1629 | * software copy here. In addition, some bits aren't | 1674 | * software copy here. In addition, some bits aren't |
1630 | * writable. */ | 1675 | * writable. */ |
1631 | r = inb (CONTROL (pb)); | 1676 | r = inb(CONTROL(pb)); |
1632 | if ((r & 0xf) == w) { | 1677 | if ((r & 0xf) == w) { |
1633 | w = 0xe; | 1678 | w = 0xe; |
1634 | outb (w, CONTROL (pb)); | 1679 | outb(w, CONTROL(pb)); |
1635 | r = inb (CONTROL (pb)); | 1680 | r = inb(CONTROL(pb)); |
1636 | outb (0xc, CONTROL (pb)); | 1681 | outb(0xc, CONTROL(pb)); |
1637 | if ((r & 0xf) == w) | 1682 | if ((r & 0xf) == w) |
1638 | return PARPORT_MODE_PCSPP; | 1683 | return PARPORT_MODE_PCSPP; |
1639 | } | 1684 | } |
@@ -1641,18 +1686,18 @@ static int parport_SPP_supported(struct parport *pb) | |||
1641 | if (user_specified) | 1686 | if (user_specified) |
1642 | /* That didn't work, but the user thinks there's a | 1687 | /* That didn't work, but the user thinks there's a |
1643 | * port here. */ | 1688 | * port here. */ |
1644 | printk (KERN_INFO "parport 0x%lx (WARNING): CTR: " | 1689 | printk(KERN_INFO "parport 0x%lx (WARNING): CTR: " |
1645 | "wrote 0x%02x, read 0x%02x\n", pb->base, w, r); | 1690 | "wrote 0x%02x, read 0x%02x\n", pb->base, w, r); |
1646 | 1691 | ||
1647 | /* Try the data register. The data lines aren't tri-stated at | 1692 | /* Try the data register. The data lines aren't tri-stated at |
1648 | * this stage, so we expect back what we wrote. */ | 1693 | * this stage, so we expect back what we wrote. */ |
1649 | w = 0xaa; | 1694 | w = 0xaa; |
1650 | parport_pc_write_data (pb, w); | 1695 | parport_pc_write_data(pb, w); |
1651 | r = parport_pc_read_data (pb); | 1696 | r = parport_pc_read_data(pb); |
1652 | if (r == w) { | 1697 | if (r == w) { |
1653 | w = 0x55; | 1698 | w = 0x55; |
1654 | parport_pc_write_data (pb, w); | 1699 | parport_pc_write_data(pb, w); |
1655 | r = parport_pc_read_data (pb); | 1700 | r = parport_pc_read_data(pb); |
1656 | if (r == w) | 1701 | if (r == w) |
1657 | return PARPORT_MODE_PCSPP; | 1702 | return PARPORT_MODE_PCSPP; |
1658 | } | 1703 | } |
@@ -1660,9 +1705,9 @@ static int parport_SPP_supported(struct parport *pb) | |||
1660 | if (user_specified) { | 1705 | if (user_specified) { |
1661 | /* Didn't work, but the user is convinced this is the | 1706 | /* Didn't work, but the user is convinced this is the |
1662 | * place. */ | 1707 | * place. */ |
1663 | printk (KERN_INFO "parport 0x%lx (WARNING): DATA: " | 1708 | printk(KERN_INFO "parport 0x%lx (WARNING): DATA: " |
1664 | "wrote 0x%02x, read 0x%02x\n", pb->base, w, r); | 1709 | "wrote 0x%02x, read 0x%02x\n", pb->base, w, r); |
1665 | printk (KERN_INFO "parport 0x%lx: You gave this address, " | 1710 | printk(KERN_INFO "parport 0x%lx: You gave this address, " |
1666 | "but there is probably no parallel port there!\n", | 1711 | "but there is probably no parallel port there!\n", |
1667 | pb->base); | 1712 | pb->base); |
1668 | } | 1713 | } |
@@ -1693,33 +1738,33 @@ static int parport_ECR_present(struct parport *pb) | |||
1693 | struct parport_pc_private *priv = pb->private_data; | 1738 | struct parport_pc_private *priv = pb->private_data; |
1694 | unsigned char r = 0xc; | 1739 | unsigned char r = 0xc; |
1695 | 1740 | ||
1696 | outb (r, CONTROL (pb)); | 1741 | outb(r, CONTROL(pb)); |
1697 | if ((inb (ECONTROL (pb)) & 0x3) == (r & 0x3)) { | 1742 | if ((inb(ECONTROL(pb)) & 0x3) == (r & 0x3)) { |
1698 | outb (r ^ 0x2, CONTROL (pb)); /* Toggle bit 1 */ | 1743 | outb(r ^ 0x2, CONTROL(pb)); /* Toggle bit 1 */ |
1699 | 1744 | ||
1700 | r = inb (CONTROL (pb)); | 1745 | r = inb(CONTROL(pb)); |
1701 | if ((inb (ECONTROL (pb)) & 0x2) == (r & 0x2)) | 1746 | if ((inb(ECONTROL(pb)) & 0x2) == (r & 0x2)) |
1702 | goto no_reg; /* Sure that no ECR register exists */ | 1747 | goto no_reg; /* Sure that no ECR register exists */ |
1703 | } | 1748 | } |
1704 | 1749 | ||
1705 | if ((inb (ECONTROL (pb)) & 0x3 ) != 0x1) | 1750 | if ((inb(ECONTROL(pb)) & 0x3) != 0x1) |
1706 | goto no_reg; | 1751 | goto no_reg; |
1707 | 1752 | ||
1708 | ECR_WRITE (pb, 0x34); | 1753 | ECR_WRITE(pb, 0x34); |
1709 | if (inb (ECONTROL (pb)) != 0x35) | 1754 | if (inb(ECONTROL(pb)) != 0x35) |
1710 | goto no_reg; | 1755 | goto no_reg; |
1711 | 1756 | ||
1712 | priv->ecr = 1; | 1757 | priv->ecr = 1; |
1713 | outb (0xc, CONTROL (pb)); | 1758 | outb(0xc, CONTROL(pb)); |
1714 | 1759 | ||
1715 | /* Go to mode 000 */ | 1760 | /* Go to mode 000 */ |
1716 | frob_set_mode (pb, ECR_SPP); | 1761 | frob_set_mode(pb, ECR_SPP); |
1717 | 1762 | ||
1718 | return 1; | 1763 | return 1; |
1719 | 1764 | ||
1720 | no_reg: | 1765 | no_reg: |
1721 | outb (0xc, CONTROL (pb)); | 1766 | outb(0xc, CONTROL(pb)); |
1722 | return 0; | 1767 | return 0; |
1723 | } | 1768 | } |
1724 | 1769 | ||
1725 | #ifdef CONFIG_PARPORT_1284 | 1770 | #ifdef CONFIG_PARPORT_1284 |
@@ -1729,7 +1774,7 @@ static int parport_ECR_present(struct parport *pb) | |||
1729 | * allows us to read data from the data lines. In theory we would get back | 1774 | * allows us to read data from the data lines. In theory we would get back |
1730 | * 0xff but any peripheral attached to the port may drag some or all of the | 1775 | * 0xff but any peripheral attached to the port may drag some or all of the |
1731 | * lines down to zero. So if we get back anything that isn't the contents | 1776 | * lines down to zero. So if we get back anything that isn't the contents |
1732 | * of the data register we deem PS/2 support to be present. | 1777 | * of the data register we deem PS/2 support to be present. |
1733 | * | 1778 | * |
1734 | * Some SPP ports have "half PS/2" ability - you can't turn off the line | 1779 | * Some SPP ports have "half PS/2" ability - you can't turn off the line |
1735 | * drivers, but an external peripheral with sufficiently beefy drivers of | 1780 | * drivers, but an external peripheral with sufficiently beefy drivers of |
@@ -1737,26 +1782,28 @@ static int parport_ECR_present(struct parport *pb) | |||
1737 | * where they can then be read back as normal. Ports with this property | 1782 | * where they can then be read back as normal. Ports with this property |
1738 | * and the right type of device attached are likely to fail the SPP test, | 1783 | * and the right type of device attached are likely to fail the SPP test, |
1739 | * (as they will appear to have stuck bits) and so the fact that they might | 1784 | * (as they will appear to have stuck bits) and so the fact that they might |
1740 | * be misdetected here is rather academic. | 1785 | * be misdetected here is rather academic. |
1741 | */ | 1786 | */ |
1742 | 1787 | ||
1743 | static int parport_PS2_supported(struct parport *pb) | 1788 | static int parport_PS2_supported(struct parport *pb) |
1744 | { | 1789 | { |
1745 | int ok = 0; | 1790 | int ok = 0; |
1746 | 1791 | ||
1747 | clear_epp_timeout(pb); | 1792 | clear_epp_timeout(pb); |
1748 | 1793 | ||
1749 | /* try to tri-state the buffer */ | 1794 | /* try to tri-state the buffer */ |
1750 | parport_pc_data_reverse (pb); | 1795 | parport_pc_data_reverse(pb); |
1751 | 1796 | ||
1752 | parport_pc_write_data(pb, 0x55); | 1797 | parport_pc_write_data(pb, 0x55); |
1753 | if (parport_pc_read_data(pb) != 0x55) ok++; | 1798 | if (parport_pc_read_data(pb) != 0x55) |
1799 | ok++; | ||
1754 | 1800 | ||
1755 | parport_pc_write_data(pb, 0xaa); | 1801 | parport_pc_write_data(pb, 0xaa); |
1756 | if (parport_pc_read_data(pb) != 0xaa) ok++; | 1802 | if (parport_pc_read_data(pb) != 0xaa) |
1803 | ok++; | ||
1757 | 1804 | ||
1758 | /* cancel input mode */ | 1805 | /* cancel input mode */ |
1759 | parport_pc_data_forward (pb); | 1806 | parport_pc_data_forward(pb); |
1760 | 1807 | ||
1761 | if (ok) { | 1808 | if (ok) { |
1762 | pb->modes |= PARPORT_MODE_TRISTATE; | 1809 | pb->modes |= PARPORT_MODE_TRISTATE; |
@@ -1775,68 +1822,68 @@ static int parport_ECP_supported(struct parport *pb) | |||
1775 | int config, configb; | 1822 | int config, configb; |
1776 | int pword; | 1823 | int pword; |
1777 | struct parport_pc_private *priv = pb->private_data; | 1824 | struct parport_pc_private *priv = pb->private_data; |
1778 | /* Translate ECP intrLine to ISA irq value */ | 1825 | /* Translate ECP intrLine to ISA irq value */ |
1779 | static const int intrline[]= { 0, 7, 9, 10, 11, 14, 15, 5 }; | 1826 | static const int intrline[] = { 0, 7, 9, 10, 11, 14, 15, 5 }; |
1780 | 1827 | ||
1781 | /* If there is no ECR, we have no hope of supporting ECP. */ | 1828 | /* If there is no ECR, we have no hope of supporting ECP. */ |
1782 | if (!priv->ecr) | 1829 | if (!priv->ecr) |
1783 | return 0; | 1830 | return 0; |
1784 | 1831 | ||
1785 | /* Find out FIFO depth */ | 1832 | /* Find out FIFO depth */ |
1786 | ECR_WRITE (pb, ECR_SPP << 5); /* Reset FIFO */ | 1833 | ECR_WRITE(pb, ECR_SPP << 5); /* Reset FIFO */ |
1787 | ECR_WRITE (pb, ECR_TST << 5); /* TEST FIFO */ | 1834 | ECR_WRITE(pb, ECR_TST << 5); /* TEST FIFO */ |
1788 | for (i=0; i < 1024 && !(inb (ECONTROL (pb)) & 0x02); i++) | 1835 | for (i = 0; i < 1024 && !(inb(ECONTROL(pb)) & 0x02); i++) |
1789 | outb (0xaa, FIFO (pb)); | 1836 | outb(0xaa, FIFO(pb)); |
1790 | 1837 | ||
1791 | /* | 1838 | /* |
1792 | * Using LGS chipset it uses ECR register, but | 1839 | * Using LGS chipset it uses ECR register, but |
1793 | * it doesn't support ECP or FIFO MODE | 1840 | * it doesn't support ECP or FIFO MODE |
1794 | */ | 1841 | */ |
1795 | if (i == 1024) { | 1842 | if (i == 1024) { |
1796 | ECR_WRITE (pb, ECR_SPP << 5); | 1843 | ECR_WRITE(pb, ECR_SPP << 5); |
1797 | return 0; | 1844 | return 0; |
1798 | } | 1845 | } |
1799 | 1846 | ||
1800 | priv->fifo_depth = i; | 1847 | priv->fifo_depth = i; |
1801 | if (verbose_probing) | 1848 | if (verbose_probing) |
1802 | printk (KERN_DEBUG "0x%lx: FIFO is %d bytes\n", pb->base, i); | 1849 | printk(KERN_DEBUG "0x%lx: FIFO is %d bytes\n", pb->base, i); |
1803 | 1850 | ||
1804 | /* Find out writeIntrThreshold */ | 1851 | /* Find out writeIntrThreshold */ |
1805 | frob_econtrol (pb, 1<<2, 1<<2); | 1852 | frob_econtrol(pb, 1<<2, 1<<2); |
1806 | frob_econtrol (pb, 1<<2, 0); | 1853 | frob_econtrol(pb, 1<<2, 0); |
1807 | for (i = 1; i <= priv->fifo_depth; i++) { | 1854 | for (i = 1; i <= priv->fifo_depth; i++) { |
1808 | inb (FIFO (pb)); | 1855 | inb(FIFO(pb)); |
1809 | udelay (50); | 1856 | udelay(50); |
1810 | if (inb (ECONTROL (pb)) & (1<<2)) | 1857 | if (inb(ECONTROL(pb)) & (1<<2)) |
1811 | break; | 1858 | break; |
1812 | } | 1859 | } |
1813 | 1860 | ||
1814 | if (i <= priv->fifo_depth) { | 1861 | if (i <= priv->fifo_depth) { |
1815 | if (verbose_probing) | 1862 | if (verbose_probing) |
1816 | printk (KERN_DEBUG "0x%lx: writeIntrThreshold is %d\n", | 1863 | printk(KERN_DEBUG "0x%lx: writeIntrThreshold is %d\n", |
1817 | pb->base, i); | 1864 | pb->base, i); |
1818 | } else | 1865 | } else |
1819 | /* Number of bytes we know we can write if we get an | 1866 | /* Number of bytes we know we can write if we get an |
1820 | interrupt. */ | 1867 | interrupt. */ |
1821 | i = 0; | 1868 | i = 0; |
1822 | 1869 | ||
1823 | priv->writeIntrThreshold = i; | 1870 | priv->writeIntrThreshold = i; |
1824 | 1871 | ||
1825 | /* Find out readIntrThreshold */ | 1872 | /* Find out readIntrThreshold */ |
1826 | frob_set_mode (pb, ECR_PS2); /* Reset FIFO and enable PS2 */ | 1873 | frob_set_mode(pb, ECR_PS2); /* Reset FIFO and enable PS2 */ |
1827 | parport_pc_data_reverse (pb); /* Must be in PS2 mode */ | 1874 | parport_pc_data_reverse(pb); /* Must be in PS2 mode */ |
1828 | frob_set_mode (pb, ECR_TST); /* Test FIFO */ | 1875 | frob_set_mode(pb, ECR_TST); /* Test FIFO */ |
1829 | frob_econtrol (pb, 1<<2, 1<<2); | 1876 | frob_econtrol(pb, 1<<2, 1<<2); |
1830 | frob_econtrol (pb, 1<<2, 0); | 1877 | frob_econtrol(pb, 1<<2, 0); |
1831 | for (i = 1; i <= priv->fifo_depth; i++) { | 1878 | for (i = 1; i <= priv->fifo_depth; i++) { |
1832 | outb (0xaa, FIFO (pb)); | 1879 | outb(0xaa, FIFO(pb)); |
1833 | if (inb (ECONTROL (pb)) & (1<<2)) | 1880 | if (inb(ECONTROL(pb)) & (1<<2)) |
1834 | break; | 1881 | break; |
1835 | } | 1882 | } |
1836 | 1883 | ||
1837 | if (i <= priv->fifo_depth) { | 1884 | if (i <= priv->fifo_depth) { |
1838 | if (verbose_probing) | 1885 | if (verbose_probing) |
1839 | printk (KERN_INFO "0x%lx: readIntrThreshold is %d\n", | 1886 | printk(KERN_INFO "0x%lx: readIntrThreshold is %d\n", |
1840 | pb->base, i); | 1887 | pb->base, i); |
1841 | } else | 1888 | } else |
1842 | /* Number of bytes we can read if we get an interrupt. */ | 1889 | /* Number of bytes we can read if we get an interrupt. */ |
@@ -1844,23 +1891,23 @@ static int parport_ECP_supported(struct parport *pb) | |||
1844 | 1891 | ||
1845 | priv->readIntrThreshold = i; | 1892 | priv->readIntrThreshold = i; |
1846 | 1893 | ||
1847 | ECR_WRITE (pb, ECR_SPP << 5); /* Reset FIFO */ | 1894 | ECR_WRITE(pb, ECR_SPP << 5); /* Reset FIFO */ |
1848 | ECR_WRITE (pb, 0xf4); /* Configuration mode */ | 1895 | ECR_WRITE(pb, 0xf4); /* Configuration mode */ |
1849 | config = inb (CONFIGA (pb)); | 1896 | config = inb(CONFIGA(pb)); |
1850 | pword = (config >> 4) & 0x7; | 1897 | pword = (config >> 4) & 0x7; |
1851 | switch (pword) { | 1898 | switch (pword) { |
1852 | case 0: | 1899 | case 0: |
1853 | pword = 2; | 1900 | pword = 2; |
1854 | printk (KERN_WARNING "0x%lx: Unsupported pword size!\n", | 1901 | printk(KERN_WARNING "0x%lx: Unsupported pword size!\n", |
1855 | pb->base); | 1902 | pb->base); |
1856 | break; | 1903 | break; |
1857 | case 2: | 1904 | case 2: |
1858 | pword = 4; | 1905 | pword = 4; |
1859 | printk (KERN_WARNING "0x%lx: Unsupported pword size!\n", | 1906 | printk(KERN_WARNING "0x%lx: Unsupported pword size!\n", |
1860 | pb->base); | 1907 | pb->base); |
1861 | break; | 1908 | break; |
1862 | default: | 1909 | default: |
1863 | printk (KERN_WARNING "0x%lx: Unknown implementation ID\n", | 1910 | printk(KERN_WARNING "0x%lx: Unknown implementation ID\n", |
1864 | pb->base); | 1911 | pb->base); |
1865 | /* Assume 1 */ | 1912 | /* Assume 1 */ |
1866 | case 1: | 1913 | case 1: |
@@ -1869,28 +1916,29 @@ static int parport_ECP_supported(struct parport *pb) | |||
1869 | priv->pword = pword; | 1916 | priv->pword = pword; |
1870 | 1917 | ||
1871 | if (verbose_probing) { | 1918 | if (verbose_probing) { |
1872 | printk (KERN_DEBUG "0x%lx: PWord is %d bits\n", pb->base, 8 * pword); | 1919 | printk(KERN_DEBUG "0x%lx: PWord is %d bits\n", |
1873 | 1920 | pb->base, 8 * pword); | |
1874 | printk (KERN_DEBUG "0x%lx: Interrupts are ISA-%s\n", pb->base, | 1921 | |
1922 | printk(KERN_DEBUG "0x%lx: Interrupts are ISA-%s\n", pb->base, | ||
1875 | config & 0x80 ? "Level" : "Pulses"); | 1923 | config & 0x80 ? "Level" : "Pulses"); |
1876 | 1924 | ||
1877 | configb = inb (CONFIGB (pb)); | 1925 | configb = inb(CONFIGB(pb)); |
1878 | printk (KERN_DEBUG "0x%lx: ECP port cfgA=0x%02x cfgB=0x%02x\n", | 1926 | printk(KERN_DEBUG "0x%lx: ECP port cfgA=0x%02x cfgB=0x%02x\n", |
1879 | pb->base, config, configb); | 1927 | pb->base, config, configb); |
1880 | printk (KERN_DEBUG "0x%lx: ECP settings irq=", pb->base); | 1928 | printk(KERN_DEBUG "0x%lx: ECP settings irq=", pb->base); |
1881 | if ((configb >>3) & 0x07) | 1929 | if ((configb >> 3) & 0x07) |
1882 | printk("%d",intrline[(configb >>3) & 0x07]); | 1930 | printk("%d", intrline[(configb >> 3) & 0x07]); |
1883 | else | 1931 | else |
1884 | printk("<none or set by other means>"); | 1932 | printk("<none or set by other means>"); |
1885 | printk (" dma="); | 1933 | printk(" dma="); |
1886 | if( (configb & 0x03 ) == 0x00) | 1934 | if ((configb & 0x03) == 0x00) |
1887 | printk("<none or set by other means>\n"); | 1935 | printk("<none or set by other means>\n"); |
1888 | else | 1936 | else |
1889 | printk("%d\n",configb & 0x07); | 1937 | printk("%d\n", configb & 0x07); |
1890 | } | 1938 | } |
1891 | 1939 | ||
1892 | /* Go back to mode 000 */ | 1940 | /* Go back to mode 000 */ |
1893 | frob_set_mode (pb, ECR_SPP); | 1941 | frob_set_mode(pb, ECR_SPP); |
1894 | 1942 | ||
1895 | return 1; | 1943 | return 1; |
1896 | } | 1944 | } |
@@ -1905,10 +1953,10 @@ static int parport_ECPPS2_supported(struct parport *pb) | |||
1905 | if (!priv->ecr) | 1953 | if (!priv->ecr) |
1906 | return 0; | 1954 | return 0; |
1907 | 1955 | ||
1908 | oecr = inb (ECONTROL (pb)); | 1956 | oecr = inb(ECONTROL(pb)); |
1909 | ECR_WRITE (pb, ECR_PS2 << 5); | 1957 | ECR_WRITE(pb, ECR_PS2 << 5); |
1910 | result = parport_PS2_supported(pb); | 1958 | result = parport_PS2_supported(pb); |
1911 | ECR_WRITE (pb, oecr); | 1959 | ECR_WRITE(pb, oecr); |
1912 | return result; | 1960 | return result; |
1913 | } | 1961 | } |
1914 | 1962 | ||
@@ -1932,16 +1980,15 @@ static int parport_EPP_supported(struct parport *pb) | |||
1932 | */ | 1980 | */ |
1933 | 1981 | ||
1934 | /* If EPP timeout bit clear then EPP available */ | 1982 | /* If EPP timeout bit clear then EPP available */ |
1935 | if (!clear_epp_timeout(pb)) { | 1983 | if (!clear_epp_timeout(pb)) |
1936 | return 0; /* No way to clear timeout */ | 1984 | return 0; /* No way to clear timeout */ |
1937 | } | ||
1938 | 1985 | ||
1939 | /* Check for Intel bug. */ | 1986 | /* Check for Intel bug. */ |
1940 | if (priv->ecr) { | 1987 | if (priv->ecr) { |
1941 | unsigned char i; | 1988 | unsigned char i; |
1942 | for (i = 0x00; i < 0x80; i += 0x20) { | 1989 | for (i = 0x00; i < 0x80; i += 0x20) { |
1943 | ECR_WRITE (pb, i); | 1990 | ECR_WRITE(pb, i); |
1944 | if (clear_epp_timeout (pb)) { | 1991 | if (clear_epp_timeout(pb)) { |
1945 | /* Phony EPP in ECP. */ | 1992 | /* Phony EPP in ECP. */ |
1946 | return 0; | 1993 | return 0; |
1947 | } | 1994 | } |
@@ -1965,17 +2012,16 @@ static int parport_ECPEPP_supported(struct parport *pb) | |||
1965 | int result; | 2012 | int result; |
1966 | unsigned char oecr; | 2013 | unsigned char oecr; |
1967 | 2014 | ||
1968 | if (!priv->ecr) { | 2015 | if (!priv->ecr) |
1969 | return 0; | 2016 | return 0; |
1970 | } | ||
1971 | 2017 | ||
1972 | oecr = inb (ECONTROL (pb)); | 2018 | oecr = inb(ECONTROL(pb)); |
1973 | /* Search for SMC style EPP+ECP mode */ | 2019 | /* Search for SMC style EPP+ECP mode */ |
1974 | ECR_WRITE (pb, 0x80); | 2020 | ECR_WRITE(pb, 0x80); |
1975 | outb (0x04, CONTROL (pb)); | 2021 | outb(0x04, CONTROL(pb)); |
1976 | result = parport_EPP_supported(pb); | 2022 | result = parport_EPP_supported(pb); |
1977 | 2023 | ||
1978 | ECR_WRITE (pb, oecr); | 2024 | ECR_WRITE(pb, oecr); |
1979 | 2025 | ||
1980 | if (result) { | 2026 | if (result) { |
1981 | /* Set up access functions to use ECP+EPP hardware. */ | 2027 | /* Set up access functions to use ECP+EPP hardware. */ |
@@ -1993,11 +2039,25 @@ static int parport_ECPEPP_supported(struct parport *pb) | |||
1993 | /* Don't bother probing for modes we know we won't use. */ | 2039 | /* Don't bother probing for modes we know we won't use. */ |
1994 | static int __devinit parport_PS2_supported(struct parport *pb) { return 0; } | 2040 | static int __devinit parport_PS2_supported(struct parport *pb) { return 0; } |
1995 | #ifdef CONFIG_PARPORT_PC_FIFO | 2041 | #ifdef CONFIG_PARPORT_PC_FIFO |
1996 | static int parport_ECP_supported(struct parport *pb) { return 0; } | 2042 | static int parport_ECP_supported(struct parport *pb) |
2043 | { | ||
2044 | return 0; | ||
2045 | } | ||
1997 | #endif | 2046 | #endif |
1998 | static int __devinit parport_EPP_supported(struct parport *pb) { return 0; } | 2047 | static int __devinit parport_EPP_supported(struct parport *pb) |
1999 | static int __devinit parport_ECPEPP_supported(struct parport *pb){return 0;} | 2048 | { |
2000 | static int __devinit parport_ECPPS2_supported(struct parport *pb){return 0;} | 2049 | return 0; |
2050 | } | ||
2051 | |||
2052 | static int __devinit parport_ECPEPP_supported(struct parport *pb) | ||
2053 | { | ||
2054 | return 0; | ||
2055 | } | ||
2056 | |||
2057 | static int __devinit parport_ECPPS2_supported(struct parport *pb) | ||
2058 | { | ||
2059 | return 0; | ||
2060 | } | ||
2001 | 2061 | ||
2002 | #endif /* No IEEE 1284 support */ | 2062 | #endif /* No IEEE 1284 support */ |
2003 | 2063 | ||
@@ -2007,17 +2067,17 @@ static int __devinit parport_ECPPS2_supported(struct parport *pb){return 0;} | |||
2007 | static int programmable_irq_support(struct parport *pb) | 2067 | static int programmable_irq_support(struct parport *pb) |
2008 | { | 2068 | { |
2009 | int irq, intrLine; | 2069 | int irq, intrLine; |
2010 | unsigned char oecr = inb (ECONTROL (pb)); | 2070 | unsigned char oecr = inb(ECONTROL(pb)); |
2011 | static const int lookup[8] = { | 2071 | static const int lookup[8] = { |
2012 | PARPORT_IRQ_NONE, 7, 9, 10, 11, 14, 15, 5 | 2072 | PARPORT_IRQ_NONE, 7, 9, 10, 11, 14, 15, 5 |
2013 | }; | 2073 | }; |
2014 | 2074 | ||
2015 | ECR_WRITE (pb, ECR_CNF << 5); /* Configuration MODE */ | 2075 | ECR_WRITE(pb, ECR_CNF << 5); /* Configuration MODE */ |
2016 | 2076 | ||
2017 | intrLine = (inb (CONFIGB (pb)) >> 3) & 0x07; | 2077 | intrLine = (inb(CONFIGB(pb)) >> 3) & 0x07; |
2018 | irq = lookup[intrLine]; | 2078 | irq = lookup[intrLine]; |
2019 | 2079 | ||
2020 | ECR_WRITE (pb, oecr); | 2080 | ECR_WRITE(pb, oecr); |
2021 | return irq; | 2081 | return irq; |
2022 | } | 2082 | } |
2023 | 2083 | ||
@@ -2027,17 +2087,17 @@ static int irq_probe_ECP(struct parport *pb) | |||
2027 | unsigned long irqs; | 2087 | unsigned long irqs; |
2028 | 2088 | ||
2029 | irqs = probe_irq_on(); | 2089 | irqs = probe_irq_on(); |
2030 | 2090 | ||
2031 | ECR_WRITE (pb, ECR_SPP << 5); /* Reset FIFO */ | 2091 | ECR_WRITE(pb, ECR_SPP << 5); /* Reset FIFO */ |
2032 | ECR_WRITE (pb, (ECR_TST << 5) | 0x04); | 2092 | ECR_WRITE(pb, (ECR_TST << 5) | 0x04); |
2033 | ECR_WRITE (pb, ECR_TST << 5); | 2093 | ECR_WRITE(pb, ECR_TST << 5); |
2034 | 2094 | ||
2035 | /* If Full FIFO sure that writeIntrThreshold is generated */ | 2095 | /* If Full FIFO sure that writeIntrThreshold is generated */ |
2036 | for (i=0; i < 1024 && !(inb (ECONTROL (pb)) & 0x02) ; i++) | 2096 | for (i = 0; i < 1024 && !(inb(ECONTROL(pb)) & 0x02) ; i++) |
2037 | outb (0xaa, FIFO (pb)); | 2097 | outb(0xaa, FIFO(pb)); |
2038 | 2098 | ||
2039 | pb->irq = probe_irq_off(irqs); | 2099 | pb->irq = probe_irq_off(irqs); |
2040 | ECR_WRITE (pb, ECR_SPP << 5); | 2100 | ECR_WRITE(pb, ECR_SPP << 5); |
2041 | 2101 | ||
2042 | if (pb->irq <= 0) | 2102 | if (pb->irq <= 0) |
2043 | pb->irq = PARPORT_IRQ_NONE; | 2103 | pb->irq = PARPORT_IRQ_NONE; |
@@ -2047,7 +2107,7 @@ static int irq_probe_ECP(struct parport *pb) | |||
2047 | 2107 | ||
2048 | /* | 2108 | /* |
2049 | * This detection seems that only works in National Semiconductors | 2109 | * This detection seems that only works in National Semiconductors |
2050 | * This doesn't work in SMC, LGS, and Winbond | 2110 | * This doesn't work in SMC, LGS, and Winbond |
2051 | */ | 2111 | */ |
2052 | static int irq_probe_EPP(struct parport *pb) | 2112 | static int irq_probe_EPP(struct parport *pb) |
2053 | { | 2113 | { |
@@ -2058,16 +2118,16 @@ static int irq_probe_EPP(struct parport *pb) | |||
2058 | unsigned char oecr; | 2118 | unsigned char oecr; |
2059 | 2119 | ||
2060 | if (pb->modes & PARPORT_MODE_PCECR) | 2120 | if (pb->modes & PARPORT_MODE_PCECR) |
2061 | oecr = inb (ECONTROL (pb)); | 2121 | oecr = inb(ECONTROL(pb)); |
2062 | 2122 | ||
2063 | irqs = probe_irq_on(); | 2123 | irqs = probe_irq_on(); |
2064 | 2124 | ||
2065 | if (pb->modes & PARPORT_MODE_PCECR) | 2125 | if (pb->modes & PARPORT_MODE_PCECR) |
2066 | frob_econtrol (pb, 0x10, 0x10); | 2126 | frob_econtrol(pb, 0x10, 0x10); |
2067 | 2127 | ||
2068 | clear_epp_timeout(pb); | 2128 | clear_epp_timeout(pb); |
2069 | parport_pc_frob_control (pb, 0x20, 0x20); | 2129 | parport_pc_frob_control(pb, 0x20, 0x20); |
2070 | parport_pc_frob_control (pb, 0x10, 0x10); | 2130 | parport_pc_frob_control(pb, 0x10, 0x10); |
2071 | clear_epp_timeout(pb); | 2131 | clear_epp_timeout(pb); |
2072 | 2132 | ||
2073 | /* Device isn't expecting an EPP read | 2133 | /* Device isn't expecting an EPP read |
@@ -2076,9 +2136,9 @@ static int irq_probe_EPP(struct parport *pb) | |||
2076 | parport_pc_read_epp(pb); | 2136 | parport_pc_read_epp(pb); |
2077 | udelay(20); | 2137 | udelay(20); |
2078 | 2138 | ||
2079 | pb->irq = probe_irq_off (irqs); | 2139 | pb->irq = probe_irq_off(irqs); |
2080 | if (pb->modes & PARPORT_MODE_PCECR) | 2140 | if (pb->modes & PARPORT_MODE_PCECR) |
2081 | ECR_WRITE (pb, oecr); | 2141 | ECR_WRITE(pb, oecr); |
2082 | parport_pc_write_control(pb, 0xc); | 2142 | parport_pc_write_control(pb, 0xc); |
2083 | 2143 | ||
2084 | if (pb->irq <= 0) | 2144 | if (pb->irq <= 0) |
@@ -2135,28 +2195,28 @@ static int parport_irq_probe(struct parport *pb) | |||
2135 | /* --- DMA detection -------------------------------------- */ | 2195 | /* --- DMA detection -------------------------------------- */ |
2136 | 2196 | ||
2137 | /* Only if chipset conforms to ECP ISA Interface Standard */ | 2197 | /* Only if chipset conforms to ECP ISA Interface Standard */ |
2138 | static int programmable_dma_support (struct parport *p) | 2198 | static int programmable_dma_support(struct parport *p) |
2139 | { | 2199 | { |
2140 | unsigned char oecr = inb (ECONTROL (p)); | 2200 | unsigned char oecr = inb(ECONTROL(p)); |
2141 | int dma; | 2201 | int dma; |
2142 | 2202 | ||
2143 | frob_set_mode (p, ECR_CNF); | 2203 | frob_set_mode(p, ECR_CNF); |
2144 | 2204 | ||
2145 | dma = inb (CONFIGB(p)) & 0x07; | 2205 | dma = inb(CONFIGB(p)) & 0x07; |
2146 | /* 000: Indicates jumpered 8-bit DMA if read-only. | 2206 | /* 000: Indicates jumpered 8-bit DMA if read-only. |
2147 | 100: Indicates jumpered 16-bit DMA if read-only. */ | 2207 | 100: Indicates jumpered 16-bit DMA if read-only. */ |
2148 | if ((dma & 0x03) == 0) | 2208 | if ((dma & 0x03) == 0) |
2149 | dma = PARPORT_DMA_NONE; | 2209 | dma = PARPORT_DMA_NONE; |
2150 | 2210 | ||
2151 | ECR_WRITE (p, oecr); | 2211 | ECR_WRITE(p, oecr); |
2152 | return dma; | 2212 | return dma; |
2153 | } | 2213 | } |
2154 | 2214 | ||
2155 | static int parport_dma_probe (struct parport *p) | 2215 | static int parport_dma_probe(struct parport *p) |
2156 | { | 2216 | { |
2157 | const struct parport_pc_private *priv = p->private_data; | 2217 | const struct parport_pc_private *priv = p->private_data; |
2158 | if (priv->ecr) | 2218 | if (priv->ecr) /* ask ECP chipset first */ |
2159 | p->dma = programmable_dma_support(p); /* ask ECP chipset first */ | 2219 | p->dma = programmable_dma_support(p); |
2160 | if (p->dma == PARPORT_DMA_NONE) { | 2220 | if (p->dma == PARPORT_DMA_NONE) { |
2161 | /* ask known Super-IO chips proper, although these | 2221 | /* ask known Super-IO chips proper, although these |
2162 | claim ECP compatible, some don't report their DMA | 2222 | claim ECP compatible, some don't report their DMA |
@@ -2214,7 +2274,7 @@ struct parport *parport_pc_probe_port(unsigned long int base, | |||
2214 | if (!base_res) | 2274 | if (!base_res) |
2215 | goto out4; | 2275 | goto out4; |
2216 | 2276 | ||
2217 | memcpy(ops, &parport_pc_ops, sizeof (struct parport_operations)); | 2277 | memcpy(ops, &parport_pc_ops, sizeof(struct parport_operations)); |
2218 | priv->ctr = 0xc; | 2278 | priv->ctr = 0xc; |
2219 | priv->ctr_writable = ~0x10; | 2279 | priv->ctr_writable = ~0x10; |
2220 | priv->ecr = 0; | 2280 | priv->ecr = 0; |
@@ -2241,7 +2301,7 @@ struct parport *parport_pc_probe_port(unsigned long int base, | |||
2241 | if (!parport_EPP_supported(p)) | 2301 | if (!parport_EPP_supported(p)) |
2242 | parport_ECPEPP_supported(p); | 2302 | parport_ECPEPP_supported(p); |
2243 | } | 2303 | } |
2244 | if (!parport_SPP_supported (p)) | 2304 | if (!parport_SPP_supported(p)) |
2245 | /* No port. */ | 2305 | /* No port. */ |
2246 | goto out5; | 2306 | goto out5; |
2247 | if (priv->ecr) | 2307 | if (priv->ecr) |
@@ -2249,7 +2309,7 @@ struct parport *parport_pc_probe_port(unsigned long int base, | |||
2249 | else | 2309 | else |
2250 | parport_PS2_supported(p); | 2310 | parport_PS2_supported(p); |
2251 | 2311 | ||
2252 | p->size = (p->modes & PARPORT_MODE_EPP)?8:3; | 2312 | p->size = (p->modes & PARPORT_MODE_EPP) ? 8 : 3; |
2253 | 2313 | ||
2254 | printk(KERN_INFO "%s: PC-style at 0x%lx", p->name, p->base); | 2314 | printk(KERN_INFO "%s: PC-style at 0x%lx", p->name, p->base); |
2255 | if (p->base_hi && priv->ecr) | 2315 | if (p->base_hi && priv->ecr) |
@@ -2273,7 +2333,7 @@ struct parport *parport_pc_probe_port(unsigned long int base, | |||
2273 | } | 2333 | } |
2274 | } | 2334 | } |
2275 | if (p->dma == PARPORT_DMA_AUTO) /* To use DMA, giving the irq | 2335 | if (p->dma == PARPORT_DMA_AUTO) /* To use DMA, giving the irq |
2276 | is mandatory (see above) */ | 2336 | is mandatory (see above) */ |
2277 | p->dma = PARPORT_DMA_NONE; | 2337 | p->dma = PARPORT_DMA_NONE; |
2278 | 2338 | ||
2279 | #ifdef CONFIG_PARPORT_PC_FIFO | 2339 | #ifdef CONFIG_PARPORT_PC_FIFO |
@@ -2290,16 +2350,23 @@ struct parport *parport_pc_probe_port(unsigned long int base, | |||
2290 | if (p->dma != PARPORT_DMA_NONE) { | 2350 | if (p->dma != PARPORT_DMA_NONE) { |
2291 | printk(", dma %d", p->dma); | 2351 | printk(", dma %d", p->dma); |
2292 | p->modes |= PARPORT_MODE_DMA; | 2352 | p->modes |= PARPORT_MODE_DMA; |
2293 | } | 2353 | } else |
2294 | else printk(", using FIFO"); | 2354 | printk(", using FIFO"); |
2295 | } | 2355 | } else |
2296 | else | ||
2297 | /* We can't use the DMA channel after all. */ | 2356 | /* We can't use the DMA channel after all. */ |
2298 | p->dma = PARPORT_DMA_NONE; | 2357 | p->dma = PARPORT_DMA_NONE; |
2299 | #endif /* Allowed to use FIFO/DMA */ | 2358 | #endif /* Allowed to use FIFO/DMA */ |
2300 | 2359 | ||
2301 | printk(" ["); | 2360 | printk(" ["); |
2302 | #define printmode(x) {if(p->modes&PARPORT_MODE_##x){printk("%s%s",f?",":"",#x);f++;}} | 2361 | |
2362 | #define printmode(x) \ | ||
2363 | {\ | ||
2364 | if (p->modes & PARPORT_MODE_##x) {\ | ||
2365 | printk("%s%s", f ? "," : "", #x);\ | ||
2366 | f++;\ | ||
2367 | } \ | ||
2368 | } | ||
2369 | |||
2303 | { | 2370 | { |
2304 | int f = 0; | 2371 | int f = 0; |
2305 | printmode(PCSPP); | 2372 | printmode(PCSPP); |
@@ -2311,10 +2378,10 @@ struct parport *parport_pc_probe_port(unsigned long int base, | |||
2311 | } | 2378 | } |
2312 | #undef printmode | 2379 | #undef printmode |
2313 | #ifndef CONFIG_PARPORT_1284 | 2380 | #ifndef CONFIG_PARPORT_1284 |
2314 | printk ("(,...)"); | 2381 | printk("(,...)"); |
2315 | #endif /* CONFIG_PARPORT_1284 */ | 2382 | #endif /* CONFIG_PARPORT_1284 */ |
2316 | printk("]\n"); | 2383 | printk("]\n"); |
2317 | if (probedirq != PARPORT_IRQ_NONE) | 2384 | if (probedirq != PARPORT_IRQ_NONE) |
2318 | printk(KERN_INFO "%s: irq %d detected\n", p->name, probedirq); | 2385 | printk(KERN_INFO "%s: irq %d detected\n", p->name, probedirq); |
2319 | 2386 | ||
2320 | /* If No ECP release the ports grabbed above. */ | 2387 | /* If No ECP release the ports grabbed above. */ |
@@ -2330,7 +2397,7 @@ struct parport *parport_pc_probe_port(unsigned long int base, | |||
2330 | if (p->irq != PARPORT_IRQ_NONE) { | 2397 | if (p->irq != PARPORT_IRQ_NONE) { |
2331 | if (request_irq(p->irq, parport_irq_handler, | 2398 | if (request_irq(p->irq, parport_irq_handler, |
2332 | irqflags, p->name, p)) { | 2399 | irqflags, p->name, p)) { |
2333 | printk (KERN_WARNING "%s: irq %d in use, " | 2400 | printk(KERN_WARNING "%s: irq %d in use, " |
2334 | "resorting to polled operation\n", | 2401 | "resorting to polled operation\n", |
2335 | p->name, p->irq); | 2402 | p->name, p->irq); |
2336 | p->irq = PARPORT_IRQ_NONE; | 2403 | p->irq = PARPORT_IRQ_NONE; |
@@ -2340,8 +2407,8 @@ struct parport *parport_pc_probe_port(unsigned long int base, | |||
2340 | #ifdef CONFIG_PARPORT_PC_FIFO | 2407 | #ifdef CONFIG_PARPORT_PC_FIFO |
2341 | #ifdef HAS_DMA | 2408 | #ifdef HAS_DMA |
2342 | if (p->dma != PARPORT_DMA_NONE) { | 2409 | if (p->dma != PARPORT_DMA_NONE) { |
2343 | if (request_dma (p->dma, p->name)) { | 2410 | if (request_dma(p->dma, p->name)) { |
2344 | printk (KERN_WARNING "%s: dma %d in use, " | 2411 | printk(KERN_WARNING "%s: dma %d in use, " |
2345 | "resorting to PIO operation\n", | 2412 | "resorting to PIO operation\n", |
2346 | p->name, p->dma); | 2413 | p->name, p->dma); |
2347 | p->dma = PARPORT_DMA_NONE; | 2414 | p->dma = PARPORT_DMA_NONE; |
@@ -2351,8 +2418,8 @@ struct parport *parport_pc_probe_port(unsigned long int base, | |||
2351 | PAGE_SIZE, | 2418 | PAGE_SIZE, |
2352 | &priv->dma_handle, | 2419 | &priv->dma_handle, |
2353 | GFP_KERNEL); | 2420 | GFP_KERNEL); |
2354 | if (! priv->dma_buf) { | 2421 | if (!priv->dma_buf) { |
2355 | printk (KERN_WARNING "%s: " | 2422 | printk(KERN_WARNING "%s: " |
2356 | "cannot get buffer for DMA, " | 2423 | "cannot get buffer for DMA, " |
2357 | "resorting to PIO operation\n", | 2424 | "resorting to PIO operation\n", |
2358 | p->name); | 2425 | p->name); |
@@ -2371,10 +2438,10 @@ struct parport *parport_pc_probe_port(unsigned long int base, | |||
2371 | * Put the ECP detected port in PS2 mode. | 2438 | * Put the ECP detected port in PS2 mode. |
2372 | * Do this also for ports that have ECR but don't do ECP. | 2439 | * Do this also for ports that have ECR but don't do ECP. |
2373 | */ | 2440 | */ |
2374 | ECR_WRITE (p, 0x34); | 2441 | ECR_WRITE(p, 0x34); |
2375 | 2442 | ||
2376 | parport_pc_write_data(p, 0); | 2443 | parport_pc_write_data(p, 0); |
2377 | parport_pc_data_forward (p); | 2444 | parport_pc_data_forward(p); |
2378 | 2445 | ||
2379 | /* Now that we've told the sharing engine about the port, and | 2446 | /* Now that we've told the sharing engine about the port, and |
2380 | found out its characteristics, let the high-level drivers | 2447 | found out its characteristics, let the high-level drivers |
@@ -2382,7 +2449,7 @@ struct parport *parport_pc_probe_port(unsigned long int base, | |||
2382 | spin_lock(&ports_lock); | 2449 | spin_lock(&ports_lock); |
2383 | list_add(&priv->list, &ports_list); | 2450 | list_add(&priv->list, &ports_list); |
2384 | spin_unlock(&ports_lock); | 2451 | spin_unlock(&ports_lock); |
2385 | parport_announce_port (p); | 2452 | parport_announce_port(p); |
2386 | 2453 | ||
2387 | return p; | 2454 | return p; |
2388 | 2455 | ||
@@ -2395,18 +2462,17 @@ out5: | |||
2395 | out4: | 2462 | out4: |
2396 | parport_put_port(p); | 2463 | parport_put_port(p); |
2397 | out3: | 2464 | out3: |
2398 | kfree (priv); | 2465 | kfree(priv); |
2399 | out2: | 2466 | out2: |
2400 | kfree (ops); | 2467 | kfree(ops); |
2401 | out1: | 2468 | out1: |
2402 | if (pdev) | 2469 | if (pdev) |
2403 | platform_device_unregister(pdev); | 2470 | platform_device_unregister(pdev); |
2404 | return NULL; | 2471 | return NULL; |
2405 | } | 2472 | } |
2473 | EXPORT_SYMBOL(parport_pc_probe_port); | ||
2406 | 2474 | ||
2407 | EXPORT_SYMBOL (parport_pc_probe_port); | 2475 | void parport_pc_unregister_port(struct parport *p) |
2408 | |||
2409 | void parport_pc_unregister_port (struct parport *p) | ||
2410 | { | 2476 | { |
2411 | struct parport_pc_private *priv = p->private_data; | 2477 | struct parport_pc_private *priv = p->private_data; |
2412 | struct parport_operations *ops = p->ops; | 2478 | struct parport_operations *ops = p->ops; |
@@ -2432,17 +2498,16 @@ void parport_pc_unregister_port (struct parport *p) | |||
2432 | priv->dma_buf, | 2498 | priv->dma_buf, |
2433 | priv->dma_handle); | 2499 | priv->dma_handle); |
2434 | #endif | 2500 | #endif |
2435 | kfree (p->private_data); | 2501 | kfree(p->private_data); |
2436 | parport_put_port(p); | 2502 | parport_put_port(p); |
2437 | kfree (ops); /* hope no-one cached it */ | 2503 | kfree(ops); /* hope no-one cached it */ |
2438 | } | 2504 | } |
2439 | 2505 | EXPORT_SYMBOL(parport_pc_unregister_port); | |
2440 | EXPORT_SYMBOL (parport_pc_unregister_port); | ||
2441 | 2506 | ||
2442 | #ifdef CONFIG_PCI | 2507 | #ifdef CONFIG_PCI |
2443 | 2508 | ||
2444 | /* ITE support maintained by Rich Liu <richliu@poorman.org> */ | 2509 | /* ITE support maintained by Rich Liu <richliu@poorman.org> */ |
2445 | static int __devinit sio_ite_8872_probe (struct pci_dev *pdev, int autoirq, | 2510 | static int __devinit sio_ite_8872_probe(struct pci_dev *pdev, int autoirq, |
2446 | int autodma, | 2511 | int autodma, |
2447 | const struct parport_pc_via_data *via) | 2512 | const struct parport_pc_via_data *via) |
2448 | { | 2513 | { |
@@ -2454,73 +2519,74 @@ static int __devinit sio_ite_8872_probe (struct pci_dev *pdev, int autoirq, | |||
2454 | int irq; | 2519 | int irq; |
2455 | int i; | 2520 | int i; |
2456 | 2521 | ||
2457 | DPRINTK (KERN_DEBUG "sio_ite_8872_probe()\n"); | 2522 | DPRINTK(KERN_DEBUG "sio_ite_8872_probe()\n"); |
2458 | 2523 | ||
2459 | // make sure which one chip | 2524 | /* make sure which one chip */ |
2460 | for(i = 0; i < 5; i++) { | 2525 | for (i = 0; i < 5; i++) { |
2461 | base_res = request_region(inta_addr[i], 32, "it887x"); | 2526 | base_res = request_region(inta_addr[i], 32, "it887x"); |
2462 | if (base_res) { | 2527 | if (base_res) { |
2463 | int test; | 2528 | int test; |
2464 | pci_write_config_dword (pdev, 0x60, | 2529 | pci_write_config_dword(pdev, 0x60, |
2465 | 0xe5000000 | inta_addr[i]); | 2530 | 0xe5000000 | inta_addr[i]); |
2466 | pci_write_config_dword (pdev, 0x78, | 2531 | pci_write_config_dword(pdev, 0x78, |
2467 | 0x00000000 | inta_addr[i]); | 2532 | 0x00000000 | inta_addr[i]); |
2468 | test = inb (inta_addr[i]); | 2533 | test = inb(inta_addr[i]); |
2469 | if (test != 0xff) break; | 2534 | if (test != 0xff) |
2535 | break; | ||
2470 | release_region(inta_addr[i], 0x8); | 2536 | release_region(inta_addr[i], 0x8); |
2471 | } | 2537 | } |
2472 | } | 2538 | } |
2473 | if(i >= 5) { | 2539 | if (i >= 5) { |
2474 | printk (KERN_INFO "parport_pc: cannot find ITE8872 INTA\n"); | 2540 | printk(KERN_INFO "parport_pc: cannot find ITE8872 INTA\n"); |
2475 | return 0; | 2541 | return 0; |
2476 | } | 2542 | } |
2477 | 2543 | ||
2478 | type = inb (inta_addr[i] + 0x18); | 2544 | type = inb(inta_addr[i] + 0x18); |
2479 | type &= 0x0f; | 2545 | type &= 0x0f; |
2480 | 2546 | ||
2481 | switch (type) { | 2547 | switch (type) { |
2482 | case 0x2: | 2548 | case 0x2: |
2483 | printk (KERN_INFO "parport_pc: ITE8871 found (1P)\n"); | 2549 | printk(KERN_INFO "parport_pc: ITE8871 found (1P)\n"); |
2484 | ite8872set = 0x64200000; | 2550 | ite8872set = 0x64200000; |
2485 | break; | 2551 | break; |
2486 | case 0xa: | 2552 | case 0xa: |
2487 | printk (KERN_INFO "parport_pc: ITE8875 found (1P)\n"); | 2553 | printk(KERN_INFO "parport_pc: ITE8875 found (1P)\n"); |
2488 | ite8872set = 0x64200000; | 2554 | ite8872set = 0x64200000; |
2489 | break; | 2555 | break; |
2490 | case 0xe: | 2556 | case 0xe: |
2491 | printk (KERN_INFO "parport_pc: ITE8872 found (2S1P)\n"); | 2557 | printk(KERN_INFO "parport_pc: ITE8872 found (2S1P)\n"); |
2492 | ite8872set = 0x64e00000; | 2558 | ite8872set = 0x64e00000; |
2493 | break; | 2559 | break; |
2494 | case 0x6: | 2560 | case 0x6: |
2495 | printk (KERN_INFO "parport_pc: ITE8873 found (1S)\n"); | 2561 | printk(KERN_INFO "parport_pc: ITE8873 found (1S)\n"); |
2496 | return 0; | 2562 | return 0; |
2497 | case 0x8: | 2563 | case 0x8: |
2498 | DPRINTK (KERN_DEBUG "parport_pc: ITE8874 found (2S)\n"); | 2564 | DPRINTK(KERN_DEBUG "parport_pc: ITE8874 found (2S)\n"); |
2499 | return 0; | 2565 | return 0; |
2500 | default: | 2566 | default: |
2501 | printk (KERN_INFO "parport_pc: unknown ITE887x\n"); | 2567 | printk(KERN_INFO "parport_pc: unknown ITE887x\n"); |
2502 | printk (KERN_INFO "parport_pc: please mail 'lspci -nvv' " | 2568 | printk(KERN_INFO "parport_pc: please mail 'lspci -nvv' " |
2503 | "output to Rich.Liu@ite.com.tw\n"); | 2569 | "output to Rich.Liu@ite.com.tw\n"); |
2504 | return 0; | 2570 | return 0; |
2505 | } | 2571 | } |
2506 | 2572 | ||
2507 | pci_read_config_byte (pdev, 0x3c, &ite8872_irq); | 2573 | pci_read_config_byte(pdev, 0x3c, &ite8872_irq); |
2508 | pci_read_config_dword (pdev, 0x1c, &ite8872_lpt); | 2574 | pci_read_config_dword(pdev, 0x1c, &ite8872_lpt); |
2509 | ite8872_lpt &= 0x0000ff00; | 2575 | ite8872_lpt &= 0x0000ff00; |
2510 | pci_read_config_dword (pdev, 0x20, &ite8872_lpthi); | 2576 | pci_read_config_dword(pdev, 0x20, &ite8872_lpthi); |
2511 | ite8872_lpthi &= 0x0000ff00; | 2577 | ite8872_lpthi &= 0x0000ff00; |
2512 | pci_write_config_dword (pdev, 0x6c, 0xe3000000 | ite8872_lpt); | 2578 | pci_write_config_dword(pdev, 0x6c, 0xe3000000 | ite8872_lpt); |
2513 | pci_write_config_dword (pdev, 0x70, 0xe3000000 | ite8872_lpthi); | 2579 | pci_write_config_dword(pdev, 0x70, 0xe3000000 | ite8872_lpthi); |
2514 | pci_write_config_dword (pdev, 0x80, (ite8872_lpthi<<16) | ite8872_lpt); | 2580 | pci_write_config_dword(pdev, 0x80, (ite8872_lpthi<<16) | ite8872_lpt); |
2515 | // SET SPP&EPP , Parallel Port NO DMA , Enable All Function | 2581 | /* SET SPP&EPP , Parallel Port NO DMA , Enable All Function */ |
2516 | // SET Parallel IRQ | 2582 | /* SET Parallel IRQ */ |
2517 | pci_write_config_dword (pdev, 0x9c, | 2583 | pci_write_config_dword(pdev, 0x9c, |
2518 | ite8872set | (ite8872_irq * 0x11111)); | 2584 | ite8872set | (ite8872_irq * 0x11111)); |
2519 | 2585 | ||
2520 | DPRINTK (KERN_DEBUG "ITE887x: The IRQ is %d.\n", ite8872_irq); | 2586 | DPRINTK(KERN_DEBUG "ITE887x: The IRQ is %d.\n", ite8872_irq); |
2521 | DPRINTK (KERN_DEBUG "ITE887x: The PARALLEL I/O port is 0x%x.\n", | 2587 | DPRINTK(KERN_DEBUG "ITE887x: The PARALLEL I/O port is 0x%x.\n", |
2522 | ite8872_lpt); | 2588 | ite8872_lpt); |
2523 | DPRINTK (KERN_DEBUG "ITE887x: The PARALLEL I/O porthi is 0x%x.\n", | 2589 | DPRINTK(KERN_DEBUG "ITE887x: The PARALLEL I/O porthi is 0x%x.\n", |
2524 | ite8872_lpthi); | 2590 | ite8872_lpthi); |
2525 | 2591 | ||
2526 | /* Let the user (or defaults) steer us away from interrupts */ | 2592 | /* Let the user (or defaults) steer us away from interrupts */ |
@@ -2532,14 +2598,14 @@ static int __devinit sio_ite_8872_probe (struct pci_dev *pdev, int autoirq, | |||
2532 | * Release the resource so that parport_pc_probe_port can get it. | 2598 | * Release the resource so that parport_pc_probe_port can get it. |
2533 | */ | 2599 | */ |
2534 | release_resource(base_res); | 2600 | release_resource(base_res); |
2535 | if (parport_pc_probe_port (ite8872_lpt, ite8872_lpthi, | 2601 | if (parport_pc_probe_port(ite8872_lpt, ite8872_lpthi, |
2536 | irq, PARPORT_DMA_NONE, &pdev->dev, 0)) { | 2602 | irq, PARPORT_DMA_NONE, &pdev->dev, 0)) { |
2537 | printk (KERN_INFO | 2603 | printk(KERN_INFO |
2538 | "parport_pc: ITE 8872 parallel port: io=0x%X", | 2604 | "parport_pc: ITE 8872 parallel port: io=0x%X", |
2539 | ite8872_lpt); | 2605 | ite8872_lpt); |
2540 | if (irq != PARPORT_IRQ_NONE) | 2606 | if (irq != PARPORT_IRQ_NONE) |
2541 | printk (", irq=%d", irq); | 2607 | printk(", irq=%d", irq); |
2542 | printk ("\n"); | 2608 | printk("\n"); |
2543 | return 1; | 2609 | return 1; |
2544 | } | 2610 | } |
2545 | 2611 | ||
@@ -2548,7 +2614,7 @@ static int __devinit sio_ite_8872_probe (struct pci_dev *pdev, int autoirq, | |||
2548 | 2614 | ||
2549 | /* VIA 8231 support by Pavel Fedin <sonic_amiga@rambler.ru> | 2615 | /* VIA 8231 support by Pavel Fedin <sonic_amiga@rambler.ru> |
2550 | based on VIA 686a support code by Jeff Garzik <jgarzik@pobox.com> */ | 2616 | based on VIA 686a support code by Jeff Garzik <jgarzik@pobox.com> */ |
2551 | static int __devinitdata parport_init_mode = 0; | 2617 | static int __devinitdata parport_init_mode; |
2552 | 2618 | ||
2553 | /* Data for two known VIA chips */ | 2619 | /* Data for two known VIA chips */ |
2554 | static struct parport_pc_via_data via_686a_data __devinitdata = { | 2620 | static struct parport_pc_via_data via_686a_data __devinitdata = { |
@@ -2570,7 +2636,7 @@ static struct parport_pc_via_data via_8231_data __devinitdata = { | |||
2570 | 0xF6 | 2636 | 0xF6 |
2571 | }; | 2637 | }; |
2572 | 2638 | ||
2573 | static int __devinit sio_via_probe (struct pci_dev *pdev, int autoirq, | 2639 | static int __devinit sio_via_probe(struct pci_dev *pdev, int autoirq, |
2574 | int autodma, | 2640 | int autodma, |
2575 | const struct parport_pc_via_data *via) | 2641 | const struct parport_pc_via_data *via) |
2576 | { | 2642 | { |
@@ -2582,38 +2648,38 @@ static int __devinit sio_via_probe (struct pci_dev *pdev, int autoirq, | |||
2582 | 2648 | ||
2583 | printk(KERN_DEBUG "parport_pc: VIA 686A/8231 detected\n"); | 2649 | printk(KERN_DEBUG "parport_pc: VIA 686A/8231 detected\n"); |
2584 | 2650 | ||
2585 | switch(parport_init_mode) | 2651 | switch (parport_init_mode) { |
2586 | { | ||
2587 | case 1: | 2652 | case 1: |
2588 | printk(KERN_DEBUG "parport_pc: setting SPP mode\n"); | 2653 | printk(KERN_DEBUG "parport_pc: setting SPP mode\n"); |
2589 | siofunc = VIA_FUNCTION_PARPORT_SPP; | 2654 | siofunc = VIA_FUNCTION_PARPORT_SPP; |
2590 | break; | 2655 | break; |
2591 | case 2: | 2656 | case 2: |
2592 | printk(KERN_DEBUG "parport_pc: setting PS/2 mode\n"); | 2657 | printk(KERN_DEBUG "parport_pc: setting PS/2 mode\n"); |
2593 | siofunc = VIA_FUNCTION_PARPORT_SPP; | 2658 | siofunc = VIA_FUNCTION_PARPORT_SPP; |
2594 | ppcontrol = VIA_PARPORT_BIDIR; | 2659 | ppcontrol = VIA_PARPORT_BIDIR; |
2595 | break; | 2660 | break; |
2596 | case 3: | 2661 | case 3: |
2597 | printk(KERN_DEBUG "parport_pc: setting EPP mode\n"); | 2662 | printk(KERN_DEBUG "parport_pc: setting EPP mode\n"); |
2598 | siofunc = VIA_FUNCTION_PARPORT_EPP; | 2663 | siofunc = VIA_FUNCTION_PARPORT_EPP; |
2599 | ppcontrol = VIA_PARPORT_BIDIR; | 2664 | ppcontrol = VIA_PARPORT_BIDIR; |
2600 | have_epp = 1; | 2665 | have_epp = 1; |
2601 | break; | 2666 | break; |
2602 | case 4: | 2667 | case 4: |
2603 | printk(KERN_DEBUG "parport_pc: setting ECP mode\n"); | 2668 | printk(KERN_DEBUG "parport_pc: setting ECP mode\n"); |
2604 | siofunc = VIA_FUNCTION_PARPORT_ECP; | 2669 | siofunc = VIA_FUNCTION_PARPORT_ECP; |
2605 | ppcontrol = VIA_PARPORT_BIDIR; | 2670 | ppcontrol = VIA_PARPORT_BIDIR; |
2606 | break; | 2671 | break; |
2607 | case 5: | 2672 | case 5: |
2608 | printk(KERN_DEBUG "parport_pc: setting EPP+ECP mode\n"); | 2673 | printk(KERN_DEBUG "parport_pc: setting EPP+ECP mode\n"); |
2609 | siofunc = VIA_FUNCTION_PARPORT_ECP; | 2674 | siofunc = VIA_FUNCTION_PARPORT_ECP; |
2610 | ppcontrol = VIA_PARPORT_BIDIR|VIA_PARPORT_ECPEPP; | 2675 | ppcontrol = VIA_PARPORT_BIDIR|VIA_PARPORT_ECPEPP; |
2611 | have_epp = 1; | 2676 | have_epp = 1; |
2612 | break; | 2677 | break; |
2613 | default: | 2678 | default: |
2614 | printk(KERN_DEBUG "parport_pc: probing current configuration\n"); | 2679 | printk(KERN_DEBUG |
2615 | siofunc = VIA_FUNCTION_PROBE; | 2680 | "parport_pc: probing current configuration\n"); |
2616 | break; | 2681 | siofunc = VIA_FUNCTION_PROBE; |
2682 | break; | ||
2617 | } | 2683 | } |
2618 | /* | 2684 | /* |
2619 | * unlock super i/o configuration | 2685 | * unlock super i/o configuration |
@@ -2624,38 +2690,36 @@ static int __devinit sio_via_probe (struct pci_dev *pdev, int autoirq, | |||
2624 | 2690 | ||
2625 | /* Bits 1-0: Parallel Port Mode / Enable */ | 2691 | /* Bits 1-0: Parallel Port Mode / Enable */ |
2626 | outb(via->viacfg_function, VIA_CONFIG_INDEX); | 2692 | outb(via->viacfg_function, VIA_CONFIG_INDEX); |
2627 | tmp = inb (VIA_CONFIG_DATA); | 2693 | tmp = inb(VIA_CONFIG_DATA); |
2628 | /* Bit 5: EPP+ECP enable; bit 7: PS/2 bidirectional port enable */ | 2694 | /* Bit 5: EPP+ECP enable; bit 7: PS/2 bidirectional port enable */ |
2629 | outb(via->viacfg_parport_control, VIA_CONFIG_INDEX); | 2695 | outb(via->viacfg_parport_control, VIA_CONFIG_INDEX); |
2630 | tmp2 = inb (VIA_CONFIG_DATA); | 2696 | tmp2 = inb(VIA_CONFIG_DATA); |
2631 | if (siofunc == VIA_FUNCTION_PROBE) | 2697 | if (siofunc == VIA_FUNCTION_PROBE) { |
2632 | { | 2698 | siofunc = tmp & VIA_FUNCTION_PARPORT_DISABLE; |
2633 | siofunc = tmp & VIA_FUNCTION_PARPORT_DISABLE; | 2699 | ppcontrol = tmp2; |
2634 | ppcontrol = tmp2; | 2700 | } else { |
2701 | tmp &= ~VIA_FUNCTION_PARPORT_DISABLE; | ||
2702 | tmp |= siofunc; | ||
2703 | outb(via->viacfg_function, VIA_CONFIG_INDEX); | ||
2704 | outb(tmp, VIA_CONFIG_DATA); | ||
2705 | tmp2 &= ~(VIA_PARPORT_BIDIR|VIA_PARPORT_ECPEPP); | ||
2706 | tmp2 |= ppcontrol; | ||
2707 | outb(via->viacfg_parport_control, VIA_CONFIG_INDEX); | ||
2708 | outb(tmp2, VIA_CONFIG_DATA); | ||
2635 | } | 2709 | } |
2636 | else | 2710 | |
2637 | { | ||
2638 | tmp &= ~VIA_FUNCTION_PARPORT_DISABLE; | ||
2639 | tmp |= siofunc; | ||
2640 | outb(via->viacfg_function, VIA_CONFIG_INDEX); | ||
2641 | outb(tmp, VIA_CONFIG_DATA); | ||
2642 | tmp2 &= ~(VIA_PARPORT_BIDIR|VIA_PARPORT_ECPEPP); | ||
2643 | tmp2 |= ppcontrol; | ||
2644 | outb(via->viacfg_parport_control, VIA_CONFIG_INDEX); | ||
2645 | outb(tmp2, VIA_CONFIG_DATA); | ||
2646 | } | ||
2647 | |||
2648 | /* Parallel Port I/O Base Address, bits 9-2 */ | 2711 | /* Parallel Port I/O Base Address, bits 9-2 */ |
2649 | outb(via->viacfg_parport_base, VIA_CONFIG_INDEX); | 2712 | outb(via->viacfg_parport_base, VIA_CONFIG_INDEX); |
2650 | port1 = inb(VIA_CONFIG_DATA) << 2; | 2713 | port1 = inb(VIA_CONFIG_DATA) << 2; |
2651 | 2714 | ||
2652 | printk (KERN_DEBUG "parport_pc: Current parallel port base: 0x%X\n",port1); | 2715 | printk(KERN_DEBUG "parport_pc: Current parallel port base: 0x%X\n", |
2653 | if ((port1 == 0x3BC) && have_epp) | 2716 | port1); |
2654 | { | 2717 | if (port1 == 0x3BC && have_epp) { |
2655 | outb(via->viacfg_parport_base, VIA_CONFIG_INDEX); | 2718 | outb(via->viacfg_parport_base, VIA_CONFIG_INDEX); |
2656 | outb((0x378 >> 2), VIA_CONFIG_DATA); | 2719 | outb((0x378 >> 2), VIA_CONFIG_DATA); |
2657 | printk(KERN_DEBUG "parport_pc: Parallel port base changed to 0x378\n"); | 2720 | printk(KERN_DEBUG |
2658 | port1 = 0x378; | 2721 | "parport_pc: Parallel port base changed to 0x378\n"); |
2722 | port1 = 0x378; | ||
2659 | } | 2723 | } |
2660 | 2724 | ||
2661 | /* | 2725 | /* |
@@ -2669,36 +2733,39 @@ static int __devinit sio_via_probe (struct pci_dev *pdev, int autoirq, | |||
2669 | printk(KERN_INFO "parport_pc: VIA parallel port disabled in BIOS\n"); | 2733 | printk(KERN_INFO "parport_pc: VIA parallel port disabled in BIOS\n"); |
2670 | return 0; | 2734 | return 0; |
2671 | } | 2735 | } |
2672 | 2736 | ||
2673 | /* Bits 7-4: PnP Routing for Parallel Port IRQ */ | 2737 | /* Bits 7-4: PnP Routing for Parallel Port IRQ */ |
2674 | pci_read_config_byte(pdev, via->via_pci_parport_irq_reg, &tmp); | 2738 | pci_read_config_byte(pdev, via->via_pci_parport_irq_reg, &tmp); |
2675 | irq = ((tmp & VIA_IRQCONTROL_PARALLEL) >> 4); | 2739 | irq = ((tmp & VIA_IRQCONTROL_PARALLEL) >> 4); |
2676 | 2740 | ||
2677 | if (siofunc == VIA_FUNCTION_PARPORT_ECP) | 2741 | if (siofunc == VIA_FUNCTION_PARPORT_ECP) { |
2678 | { | 2742 | /* Bits 3-2: PnP Routing for Parallel Port DMA */ |
2679 | /* Bits 3-2: PnP Routing for Parallel Port DMA */ | 2743 | pci_read_config_byte(pdev, via->via_pci_parport_dma_reg, &tmp); |
2680 | pci_read_config_byte(pdev, via->via_pci_parport_dma_reg, &tmp); | 2744 | dma = ((tmp & VIA_DMACONTROL_PARALLEL) >> 2); |
2681 | dma = ((tmp & VIA_DMACONTROL_PARALLEL) >> 2); | 2745 | } else |
2682 | } | 2746 | /* if ECP not enabled, DMA is not enabled, assumed |
2683 | else | 2747 | bogus 'dma' value */ |
2684 | /* if ECP not enabled, DMA is not enabled, assumed bogus 'dma' value */ | 2748 | dma = PARPORT_DMA_NONE; |
2685 | dma = PARPORT_DMA_NONE; | ||
2686 | 2749 | ||
2687 | /* Let the user (or defaults) steer us away from interrupts and DMA */ | 2750 | /* Let the user (or defaults) steer us away from interrupts and DMA */ |
2688 | if (autoirq == PARPORT_IRQ_NONE) { | 2751 | if (autoirq == PARPORT_IRQ_NONE) { |
2689 | irq = PARPORT_IRQ_NONE; | 2752 | irq = PARPORT_IRQ_NONE; |
2690 | dma = PARPORT_DMA_NONE; | 2753 | dma = PARPORT_DMA_NONE; |
2691 | } | 2754 | } |
2692 | if (autodma == PARPORT_DMA_NONE) | 2755 | if (autodma == PARPORT_DMA_NONE) |
2693 | dma = PARPORT_DMA_NONE; | 2756 | dma = PARPORT_DMA_NONE; |
2694 | 2757 | ||
2695 | switch (port1) { | 2758 | switch (port1) { |
2696 | case 0x3bc: port2 = 0x7bc; break; | 2759 | case 0x3bc: |
2697 | case 0x378: port2 = 0x778; break; | 2760 | port2 = 0x7bc; break; |
2698 | case 0x278: port2 = 0x678; break; | 2761 | case 0x378: |
2762 | port2 = 0x778; break; | ||
2763 | case 0x278: | ||
2764 | port2 = 0x678; break; | ||
2699 | default: | 2765 | default: |
2700 | printk(KERN_INFO "parport_pc: Weird VIA parport base 0x%X, ignoring\n", | 2766 | printk(KERN_INFO |
2701 | port1); | 2767 | "parport_pc: Weird VIA parport base 0x%X, ignoring\n", |
2768 | port1); | ||
2702 | return 0; | 2769 | return 0; |
2703 | } | 2770 | } |
2704 | 2771 | ||
@@ -2716,17 +2783,17 @@ static int __devinit sio_via_probe (struct pci_dev *pdev, int autoirq, | |||
2716 | } | 2783 | } |
2717 | 2784 | ||
2718 | /* finally, do the probe with values obtained */ | 2785 | /* finally, do the probe with values obtained */ |
2719 | if (parport_pc_probe_port (port1, port2, irq, dma, &pdev->dev, 0)) { | 2786 | if (parport_pc_probe_port(port1, port2, irq, dma, &pdev->dev, 0)) { |
2720 | printk (KERN_INFO | 2787 | printk(KERN_INFO |
2721 | "parport_pc: VIA parallel port: io=0x%X", port1); | 2788 | "parport_pc: VIA parallel port: io=0x%X", port1); |
2722 | if (irq != PARPORT_IRQ_NONE) | 2789 | if (irq != PARPORT_IRQ_NONE) |
2723 | printk (", irq=%d", irq); | 2790 | printk(", irq=%d", irq); |
2724 | if (dma != PARPORT_DMA_NONE) | 2791 | if (dma != PARPORT_DMA_NONE) |
2725 | printk (", dma=%d", dma); | 2792 | printk(", dma=%d", dma); |
2726 | printk ("\n"); | 2793 | printk("\n"); |
2727 | return 1; | 2794 | return 1; |
2728 | } | 2795 | } |
2729 | 2796 | ||
2730 | printk(KERN_WARNING "parport_pc: Strange, can't probe VIA parallel port: io=0x%X, irq=%d, dma=%d\n", | 2797 | printk(KERN_WARNING "parport_pc: Strange, can't probe VIA parallel port: io=0x%X, irq=%d, dma=%d\n", |
2731 | port1, irq, dma); | 2798 | port1, irq, dma); |
2732 | return 0; | 2799 | return 0; |
@@ -2734,8 +2801,8 @@ static int __devinit sio_via_probe (struct pci_dev *pdev, int autoirq, | |||
2734 | 2801 | ||
2735 | 2802 | ||
2736 | enum parport_pc_sio_types { | 2803 | enum parport_pc_sio_types { |
2737 | sio_via_686a = 0, /* Via VT82C686A motherboard Super I/O */ | 2804 | sio_via_686a = 0, /* Via VT82C686A motherboard Super I/O */ |
2738 | sio_via_8231, /* Via VT8231 south bridge integrated Super IO */ | 2805 | sio_via_8231, /* Via VT8231 south bridge integrated Super IO */ |
2739 | sio_ite_8872, | 2806 | sio_ite_8872, |
2740 | last_sio | 2807 | last_sio |
2741 | }; | 2808 | }; |
@@ -2806,15 +2873,15 @@ enum parport_pc_pci_cards { | |||
2806 | }; | 2873 | }; |
2807 | 2874 | ||
2808 | 2875 | ||
2809 | /* each element directly indexed from enum list, above | 2876 | /* each element directly indexed from enum list, above |
2810 | * (but offset by last_sio) */ | 2877 | * (but offset by last_sio) */ |
2811 | static struct parport_pc_pci { | 2878 | static struct parport_pc_pci { |
2812 | int numports; | 2879 | int numports; |
2813 | struct { /* BAR (base address registers) numbers in the config | 2880 | struct { /* BAR (base address registers) numbers in the config |
2814 | space header */ | 2881 | space header */ |
2815 | int lo; | 2882 | int lo; |
2816 | int hi; /* -1 if not there, >6 for offset-method (max | 2883 | int hi; |
2817 | BAR is 6) */ | 2884 | /* -1 if not there, >6 for offset-method (max BAR is 6) */ |
2818 | } addr[4]; | 2885 | } addr[4]; |
2819 | 2886 | ||
2820 | /* If set, this is called immediately after pci_enable_device. | 2887 | /* If set, this is called immediately after pci_enable_device. |
@@ -2859,7 +2926,7 @@ static struct parport_pc_pci { | |||
2859 | /* timedia_4018 */ { 2, { { 0, 1 }, { 2, 3 }, } }, | 2926 | /* timedia_4018 */ { 2, { { 0, 1 }, { 2, 3 }, } }, |
2860 | /* timedia_9018a */ { 2, { { 0, 1 }, { 2, 3 }, } }, | 2927 | /* timedia_9018a */ { 2, { { 0, 1 }, { 2, 3 }, } }, |
2861 | /* SYBA uses fixed offsets in | 2928 | /* SYBA uses fixed offsets in |
2862 | a 1K io window */ | 2929 | a 1K io window */ |
2863 | /* syba_2p_epp AP138B */ { 2, { { 0, 0x078 }, { 0, 0x178 }, } }, | 2930 | /* syba_2p_epp AP138B */ { 2, { { 0, 0x078 }, { 0, 0x178 }, } }, |
2864 | /* syba_1p_ecp W83787 */ { 1, { { 0, 0x078 }, } }, | 2931 | /* syba_1p_ecp W83787 */ { 1, { { 0, 0x078 }, } }, |
2865 | /* titan_010l */ { 1, { { 3, -1 }, } }, | 2932 | /* titan_010l */ { 1, { { 3, -1 }, } }, |
@@ -2875,11 +2942,14 @@ static struct parport_pc_pci { | |||
2875 | /* oxsemi_pcie_pport */ { 1, { { 0, 1 }, } }, | 2942 | /* oxsemi_pcie_pport */ { 1, { { 0, 1 }, } }, |
2876 | /* aks_0100 */ { 1, { { 0, -1 }, } }, | 2943 | /* aks_0100 */ { 1, { { 0, -1 }, } }, |
2877 | /* mobility_pp */ { 1, { { 0, 1 }, } }, | 2944 | /* mobility_pp */ { 1, { { 0, 1 }, } }, |
2878 | /* netmos_9705 */ { 1, { { 0, -1 }, } }, /* untested */ | 2945 | |
2879 | /* netmos_9715 */ { 2, { { 0, 1 }, { 2, 3 },} }, /* untested */ | 2946 | /* The netmos entries below are untested */ |
2880 | /* netmos_9755 */ { 2, { { 0, 1 }, { 2, 3 },} }, /* untested */ | 2947 | /* netmos_9705 */ { 1, { { 0, -1 }, } }, |
2881 | /* netmos_9805 */ { 1, { { 0, -1 }, } }, /* untested */ | 2948 | /* netmos_9715 */ { 2, { { 0, 1 }, { 2, 3 },} }, |
2882 | /* netmos_9815 */ { 2, { { 0, -1 }, { 2, -1 }, } }, /* untested */ | 2949 | /* netmos_9755 */ { 2, { { 0, 1 }, { 2, 3 },} }, |
2950 | /* netmos_9805 */ { 1, { { 0, -1 }, } }, | ||
2951 | /* netmos_9815 */ { 2, { { 0, -1 }, { 2, -1 }, } }, | ||
2952 | |||
2883 | /* quatech_sppxp100 */ { 1, { { 0, 1 }, } }, | 2953 | /* quatech_sppxp100 */ { 1, { { 0, 1 }, } }, |
2884 | }; | 2954 | }; |
2885 | 2955 | ||
@@ -2908,7 +2978,7 @@ static const struct pci_device_id parport_pc_pci_tbl[] = { | |||
2908 | { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_BOCA_IOPPAR, | 2978 | { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_BOCA_IOPPAR, |
2909 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, boca_ioppar }, | 2979 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, boca_ioppar }, |
2910 | { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, | 2980 | { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, |
2911 | PCI_SUBVENDOR_ID_EXSYS, PCI_SUBDEVICE_ID_EXSYS_4014, 0,0, plx_9050 }, | 2981 | PCI_SUBVENDOR_ID_EXSYS, PCI_SUBDEVICE_ID_EXSYS_4014, 0, 0, plx_9050 }, |
2912 | /* PCI_VENDOR_ID_TIMEDIA/SUNIX has many differing cards ...*/ | 2982 | /* PCI_VENDOR_ID_TIMEDIA/SUNIX has many differing cards ...*/ |
2913 | { 0x1409, 0x7168, 0x1409, 0x4078, 0, 0, timedia_4078a }, | 2983 | { 0x1409, 0x7168, 0x1409, 0x4078, 0, 0, timedia_4078a }, |
2914 | { 0x1409, 0x7168, 0x1409, 0x4079, 0, 0, timedia_4079h }, | 2984 | { 0x1409, 0x7168, 0x1409, 0x4079, 0, 0, timedia_4079h }, |
@@ -2942,7 +3012,8 @@ static const struct pci_device_id parport_pc_pci_tbl[] = { | |||
2942 | { 0x9710, 0x9805, 0x1000, 0x0010, 0, 0, titan_1284p1 }, | 3012 | { 0x9710, 0x9805, 0x1000, 0x0010, 0, 0, titan_1284p1 }, |
2943 | { 0x9710, 0x9815, 0x1000, 0x0020, 0, 0, titan_1284p2 }, | 3013 | { 0x9710, 0x9815, 0x1000, 0x0020, 0, 0, titan_1284p2 }, |
2944 | /* PCI_VENDOR_ID_AVLAB/Intek21 has another bunch of cards ...*/ | 3014 | /* PCI_VENDOR_ID_AVLAB/Intek21 has another bunch of cards ...*/ |
2945 | { 0x14db, 0x2120, PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_1p}, /* AFAVLAB_TK9902 */ | 3015 | /* AFAVLAB_TK9902 */ |
3016 | { 0x14db, 0x2120, PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_1p}, | ||
2946 | { 0x14db, 0x2121, PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_2p}, | 3017 | { 0x14db, 0x2121, PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_2p}, |
2947 | { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI952PP, | 3018 | { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI952PP, |
2948 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, oxsemi_952 }, | 3019 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, oxsemi_952 }, |
@@ -2985,14 +3056,14 @@ static const struct pci_device_id parport_pc_pci_tbl[] = { | |||
2985 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, quatech_sppxp100 }, | 3056 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, quatech_sppxp100 }, |
2986 | { 0, } /* terminate list */ | 3057 | { 0, } /* terminate list */ |
2987 | }; | 3058 | }; |
2988 | MODULE_DEVICE_TABLE(pci,parport_pc_pci_tbl); | 3059 | MODULE_DEVICE_TABLE(pci, parport_pc_pci_tbl); |
2989 | 3060 | ||
2990 | struct pci_parport_data { | 3061 | struct pci_parport_data { |
2991 | int num; | 3062 | int num; |
2992 | struct parport *ports[2]; | 3063 | struct parport *ports[2]; |
2993 | }; | 3064 | }; |
2994 | 3065 | ||
2995 | static int parport_pc_pci_probe (struct pci_dev *dev, | 3066 | static int parport_pc_pci_probe(struct pci_dev *dev, |
2996 | const struct pci_device_id *id) | 3067 | const struct pci_device_id *id) |
2997 | { | 3068 | { |
2998 | int err, count, n, i = id->driver_data; | 3069 | int err, count, n, i = id->driver_data; |
@@ -3005,7 +3076,8 @@ static int parport_pc_pci_probe (struct pci_dev *dev, | |||
3005 | /* This is a PCI card */ | 3076 | /* This is a PCI card */ |
3006 | i -= last_sio; | 3077 | i -= last_sio; |
3007 | count = 0; | 3078 | count = 0; |
3008 | if ((err = pci_enable_device (dev)) != 0) | 3079 | err = pci_enable_device(dev); |
3080 | if (err) | ||
3009 | return err; | 3081 | return err; |
3010 | 3082 | ||
3011 | data = kmalloc(sizeof(struct pci_parport_data), GFP_KERNEL); | 3083 | data = kmalloc(sizeof(struct pci_parport_data), GFP_KERNEL); |
@@ -3013,7 +3085,7 @@ static int parport_pc_pci_probe (struct pci_dev *dev, | |||
3013 | return -ENOMEM; | 3085 | return -ENOMEM; |
3014 | 3086 | ||
3015 | if (cards[i].preinit_hook && | 3087 | if (cards[i].preinit_hook && |
3016 | cards[i].preinit_hook (dev, PARPORT_IRQ_NONE, PARPORT_DMA_NONE)) { | 3088 | cards[i].preinit_hook(dev, PARPORT_IRQ_NONE, PARPORT_DMA_NONE)) { |
3017 | kfree(data); | 3089 | kfree(data); |
3018 | return -ENODEV; | 3090 | return -ENODEV; |
3019 | } | 3091 | } |
@@ -3023,25 +3095,25 @@ static int parport_pc_pci_probe (struct pci_dev *dev, | |||
3023 | int hi = cards[i].addr[n].hi; | 3095 | int hi = cards[i].addr[n].hi; |
3024 | int irq; | 3096 | int irq; |
3025 | unsigned long io_lo, io_hi; | 3097 | unsigned long io_lo, io_hi; |
3026 | io_lo = pci_resource_start (dev, lo); | 3098 | io_lo = pci_resource_start(dev, lo); |
3027 | io_hi = 0; | 3099 | io_hi = 0; |
3028 | if ((hi >= 0) && (hi <= 6)) | 3100 | if ((hi >= 0) && (hi <= 6)) |
3029 | io_hi = pci_resource_start (dev, hi); | 3101 | io_hi = pci_resource_start(dev, hi); |
3030 | else if (hi > 6) | 3102 | else if (hi > 6) |
3031 | io_lo += hi; /* Reinterpret the meaning of | 3103 | io_lo += hi; /* Reinterpret the meaning of |
3032 | "hi" as an offset (see SYBA | 3104 | "hi" as an offset (see SYBA |
3033 | def.) */ | 3105 | def.) */ |
3034 | /* TODO: test if sharing interrupts works */ | 3106 | /* TODO: test if sharing interrupts works */ |
3035 | irq = dev->irq; | 3107 | irq = dev->irq; |
3036 | if (irq == IRQ_NONE) { | 3108 | if (irq == IRQ_NONE) { |
3037 | printk (KERN_DEBUG | 3109 | printk(KERN_DEBUG |
3038 | "PCI parallel port detected: %04x:%04x, I/O at %#lx(%#lx)\n", | 3110 | "PCI parallel port detected: %04x:%04x, I/O at %#lx(%#lx)\n", |
3039 | parport_pc_pci_tbl[i + last_sio].vendor, | 3111 | parport_pc_pci_tbl[i + last_sio].vendor, |
3040 | parport_pc_pci_tbl[i + last_sio].device, | 3112 | parport_pc_pci_tbl[i + last_sio].device, |
3041 | io_lo, io_hi); | 3113 | io_lo, io_hi); |
3042 | irq = PARPORT_IRQ_NONE; | 3114 | irq = PARPORT_IRQ_NONE; |
3043 | } else { | 3115 | } else { |
3044 | printk (KERN_DEBUG | 3116 | printk(KERN_DEBUG |
3045 | "PCI parallel port detected: %04x:%04x, I/O at %#lx(%#lx), IRQ %d\n", | 3117 | "PCI parallel port detected: %04x:%04x, I/O at %#lx(%#lx), IRQ %d\n", |
3046 | parport_pc_pci_tbl[i + last_sio].vendor, | 3118 | parport_pc_pci_tbl[i + last_sio].vendor, |
3047 | parport_pc_pci_tbl[i + last_sio].device, | 3119 | parport_pc_pci_tbl[i + last_sio].device, |
@@ -3058,7 +3130,7 @@ static int parport_pc_pci_probe (struct pci_dev *dev, | |||
3058 | data->num = count; | 3130 | data->num = count; |
3059 | 3131 | ||
3060 | if (cards[i].postinit_hook) | 3132 | if (cards[i].postinit_hook) |
3061 | cards[i].postinit_hook (dev, count == 0); | 3133 | cards[i].postinit_hook(dev, count == 0); |
3062 | 3134 | ||
3063 | if (count) { | 3135 | if (count) { |
3064 | pci_set_drvdata(dev, data); | 3136 | pci_set_drvdata(dev, data); |
@@ -3092,7 +3164,7 @@ static struct pci_driver parport_pc_pci_driver = { | |||
3092 | .remove = __devexit_p(parport_pc_pci_remove), | 3164 | .remove = __devexit_p(parport_pc_pci_remove), |
3093 | }; | 3165 | }; |
3094 | 3166 | ||
3095 | static int __init parport_pc_init_superio (int autoirq, int autodma) | 3167 | static int __init parport_pc_init_superio(int autoirq, int autodma) |
3096 | { | 3168 | { |
3097 | const struct pci_device_id *id; | 3169 | const struct pci_device_id *id; |
3098 | struct pci_dev *pdev = NULL; | 3170 | struct pci_dev *pdev = NULL; |
@@ -3103,8 +3175,9 @@ static int __init parport_pc_init_superio (int autoirq, int autodma) | |||
3103 | if (id == NULL || id->driver_data >= last_sio) | 3175 | if (id == NULL || id->driver_data >= last_sio) |
3104 | continue; | 3176 | continue; |
3105 | 3177 | ||
3106 | if (parport_pc_superio_info[id->driver_data].probe | 3178 | if (parport_pc_superio_info[id->driver_data].probe( |
3107 | (pdev, autoirq, autodma,parport_pc_superio_info[id->driver_data].via)) { | 3179 | pdev, autoirq, autodma, |
3180 | parport_pc_superio_info[id->driver_data].via)) { | ||
3108 | ret++; | 3181 | ret++; |
3109 | } | 3182 | } |
3110 | } | 3183 | } |
@@ -3113,7 +3186,10 @@ static int __init parport_pc_init_superio (int autoirq, int autodma) | |||
3113 | } | 3186 | } |
3114 | #else | 3187 | #else |
3115 | static struct pci_driver parport_pc_pci_driver; | 3188 | static struct pci_driver parport_pc_pci_driver; |
3116 | static int __init parport_pc_init_superio(int autoirq, int autodma) {return 0;} | 3189 | static int __init parport_pc_init_superio(int autoirq, int autodma) |
3190 | { | ||
3191 | return 0; | ||
3192 | } | ||
3117 | #endif /* CONFIG_PCI */ | 3193 | #endif /* CONFIG_PCI */ |
3118 | 3194 | ||
3119 | #ifdef CONFIG_PNP | 3195 | #ifdef CONFIG_PNP |
@@ -3126,44 +3202,45 @@ static const struct pnp_device_id parport_pc_pnp_tbl[] = { | |||
3126 | { } | 3202 | { } |
3127 | }; | 3203 | }; |
3128 | 3204 | ||
3129 | MODULE_DEVICE_TABLE(pnp,parport_pc_pnp_tbl); | 3205 | MODULE_DEVICE_TABLE(pnp, parport_pc_pnp_tbl); |
3130 | 3206 | ||
3131 | static int parport_pc_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *id) | 3207 | static int parport_pc_pnp_probe(struct pnp_dev *dev, |
3208 | const struct pnp_device_id *id) | ||
3132 | { | 3209 | { |
3133 | struct parport *pdata; | 3210 | struct parport *pdata; |
3134 | unsigned long io_lo, io_hi; | 3211 | unsigned long io_lo, io_hi; |
3135 | int dma, irq; | 3212 | int dma, irq; |
3136 | 3213 | ||
3137 | if (pnp_port_valid(dev,0) && | 3214 | if (pnp_port_valid(dev, 0) && |
3138 | !(pnp_port_flags(dev,0) & IORESOURCE_DISABLED)) { | 3215 | !(pnp_port_flags(dev, 0) & IORESOURCE_DISABLED)) { |
3139 | io_lo = pnp_port_start(dev,0); | 3216 | io_lo = pnp_port_start(dev, 0); |
3140 | } else | 3217 | } else |
3141 | return -EINVAL; | 3218 | return -EINVAL; |
3142 | 3219 | ||
3143 | if (pnp_port_valid(dev,1) && | 3220 | if (pnp_port_valid(dev, 1) && |
3144 | !(pnp_port_flags(dev,1) & IORESOURCE_DISABLED)) { | 3221 | !(pnp_port_flags(dev, 1) & IORESOURCE_DISABLED)) { |
3145 | io_hi = pnp_port_start(dev,1); | 3222 | io_hi = pnp_port_start(dev, 1); |
3146 | } else | 3223 | } else |
3147 | io_hi = 0; | 3224 | io_hi = 0; |
3148 | 3225 | ||
3149 | if (pnp_irq_valid(dev,0) && | 3226 | if (pnp_irq_valid(dev, 0) && |
3150 | !(pnp_irq_flags(dev,0) & IORESOURCE_DISABLED)) { | 3227 | !(pnp_irq_flags(dev, 0) & IORESOURCE_DISABLED)) { |
3151 | irq = pnp_irq(dev,0); | 3228 | irq = pnp_irq(dev, 0); |
3152 | } else | 3229 | } else |
3153 | irq = PARPORT_IRQ_NONE; | 3230 | irq = PARPORT_IRQ_NONE; |
3154 | 3231 | ||
3155 | if (pnp_dma_valid(dev,0) && | 3232 | if (pnp_dma_valid(dev, 0) && |
3156 | !(pnp_dma_flags(dev,0) & IORESOURCE_DISABLED)) { | 3233 | !(pnp_dma_flags(dev, 0) & IORESOURCE_DISABLED)) { |
3157 | dma = pnp_dma(dev,0); | 3234 | dma = pnp_dma(dev, 0); |
3158 | } else | 3235 | } else |
3159 | dma = PARPORT_DMA_NONE; | 3236 | dma = PARPORT_DMA_NONE; |
3160 | 3237 | ||
3161 | dev_info(&dev->dev, "reported by %s\n", dev->protocol->name); | 3238 | dev_info(&dev->dev, "reported by %s\n", dev->protocol->name); |
3162 | if (!(pdata = parport_pc_probe_port(io_lo, io_hi, | 3239 | pdata = parport_pc_probe_port(io_lo, io_hi, irq, dma, &dev->dev, 0); |
3163 | irq, dma, &dev->dev, 0))) | 3240 | if (pdata == NULL) |
3164 | return -ENODEV; | 3241 | return -ENODEV; |
3165 | 3242 | ||
3166 | pnp_set_drvdata(dev,pdata); | 3243 | pnp_set_drvdata(dev, pdata); |
3167 | return 0; | 3244 | return 0; |
3168 | } | 3245 | } |
3169 | 3246 | ||
@@ -3205,7 +3282,7 @@ static struct platform_driver parport_pc_platform_driver = { | |||
3205 | 3282 | ||
3206 | /* This is called by parport_pc_find_nonpci_ports (in asm/parport.h) */ | 3283 | /* This is called by parport_pc_find_nonpci_ports (in asm/parport.h) */ |
3207 | static int __devinit __attribute__((unused)) | 3284 | static int __devinit __attribute__((unused)) |
3208 | parport_pc_find_isa_ports (int autoirq, int autodma) | 3285 | parport_pc_find_isa_ports(int autoirq, int autodma) |
3209 | { | 3286 | { |
3210 | int count = 0; | 3287 | int count = 0; |
3211 | 3288 | ||
@@ -3229,7 +3306,7 @@ parport_pc_find_isa_ports (int autoirq, int autodma) | |||
3229 | * autoirq is PARPORT_IRQ_NONE, PARPORT_IRQ_AUTO, or PARPORT_IRQ_PROBEONLY | 3306 | * autoirq is PARPORT_IRQ_NONE, PARPORT_IRQ_AUTO, or PARPORT_IRQ_PROBEONLY |
3230 | * autodma is PARPORT_DMA_NONE or PARPORT_DMA_AUTO | 3307 | * autodma is PARPORT_DMA_NONE or PARPORT_DMA_AUTO |
3231 | */ | 3308 | */ |
3232 | static void __init parport_pc_find_ports (int autoirq, int autodma) | 3309 | static void __init parport_pc_find_ports(int autoirq, int autodma) |
3233 | { | 3310 | { |
3234 | int count = 0, err; | 3311 | int count = 0, err; |
3235 | 3312 | ||
@@ -3263,11 +3340,18 @@ static void __init parport_pc_find_ports (int autoirq, int autodma) | |||
3263 | * syntax and keep in mind that code below is a cleaned up version. | 3340 | * syntax and keep in mind that code below is a cleaned up version. |
3264 | */ | 3341 | */ |
3265 | 3342 | ||
3266 | static int __initdata io[PARPORT_PC_MAX_PORTS+1] = { [0 ... PARPORT_PC_MAX_PORTS] = 0 }; | 3343 | static int __initdata io[PARPORT_PC_MAX_PORTS+1] = { |
3267 | static int __initdata io_hi[PARPORT_PC_MAX_PORTS+1] = | 3344 | [0 ... PARPORT_PC_MAX_PORTS] = 0 |
3268 | { [0 ... PARPORT_PC_MAX_PORTS] = PARPORT_IOHI_AUTO }; | 3345 | }; |
3269 | static int __initdata dmaval[PARPORT_PC_MAX_PORTS] = { [0 ... PARPORT_PC_MAX_PORTS-1] = PARPORT_DMA_NONE }; | 3346 | static int __initdata io_hi[PARPORT_PC_MAX_PORTS+1] = { |
3270 | static int __initdata irqval[PARPORT_PC_MAX_PORTS] = { [0 ... PARPORT_PC_MAX_PORTS-1] = PARPORT_IRQ_PROBEONLY }; | 3347 | [0 ... PARPORT_PC_MAX_PORTS] = PARPORT_IOHI_AUTO |
3348 | }; | ||
3349 | static int __initdata dmaval[PARPORT_PC_MAX_PORTS] = { | ||
3350 | [0 ... PARPORT_PC_MAX_PORTS-1] = PARPORT_DMA_NONE | ||
3351 | }; | ||
3352 | static int __initdata irqval[PARPORT_PC_MAX_PORTS] = { | ||
3353 | [0 ... PARPORT_PC_MAX_PORTS-1] = PARPORT_IRQ_PROBEONLY | ||
3354 | }; | ||
3271 | 3355 | ||
3272 | static int __init parport_parse_param(const char *s, int *val, | 3356 | static int __init parport_parse_param(const char *s, int *val, |
3273 | int automatic, int none, int nofifo) | 3357 | int automatic, int none, int nofifo) |
@@ -3308,18 +3392,19 @@ static int __init parport_parse_dma(const char *dmastr, int *val) | |||
3308 | #ifdef CONFIG_PCI | 3392 | #ifdef CONFIG_PCI |
3309 | static int __init parport_init_mode_setup(char *str) | 3393 | static int __init parport_init_mode_setup(char *str) |
3310 | { | 3394 | { |
3311 | printk(KERN_DEBUG "parport_pc.c: Specified parameter parport_init_mode=%s\n", str); | 3395 | printk(KERN_DEBUG |
3312 | 3396 | "parport_pc.c: Specified parameter parport_init_mode=%s\n", str); | |
3313 | if (!strcmp (str, "spp")) | 3397 | |
3314 | parport_init_mode=1; | 3398 | if (!strcmp(str, "spp")) |
3315 | if (!strcmp (str, "ps2")) | 3399 | parport_init_mode = 1; |
3316 | parport_init_mode=2; | 3400 | if (!strcmp(str, "ps2")) |
3317 | if (!strcmp (str, "epp")) | 3401 | parport_init_mode = 2; |
3318 | parport_init_mode=3; | 3402 | if (!strcmp(str, "epp")) |
3319 | if (!strcmp (str, "ecp")) | 3403 | parport_init_mode = 3; |
3320 | parport_init_mode=4; | 3404 | if (!strcmp(str, "ecp")) |
3321 | if (!strcmp (str, "ecpepp")) | 3405 | parport_init_mode = 4; |
3322 | parport_init_mode=5; | 3406 | if (!strcmp(str, "ecpepp")) |
3407 | parport_init_mode = 5; | ||
3323 | return 1; | 3408 | return 1; |
3324 | } | 3409 | } |
3325 | #endif | 3410 | #endif |
@@ -3343,7 +3428,8 @@ module_param(verbose_probing, int, 0644); | |||
3343 | #endif | 3428 | #endif |
3344 | #ifdef CONFIG_PCI | 3429 | #ifdef CONFIG_PCI |
3345 | static char *init_mode; | 3430 | static char *init_mode; |
3346 | MODULE_PARM_DESC(init_mode, "Initialise mode for VIA VT8231 port (spp, ps2, epp, ecp or ecpepp)"); | 3431 | MODULE_PARM_DESC(init_mode, |
3432 | "Initialise mode for VIA VT8231 port (spp, ps2, epp, ecp or ecpepp)"); | ||
3347 | module_param(init_mode, charp, 0); | 3433 | module_param(init_mode, charp, 0); |
3348 | #endif | 3434 | #endif |
3349 | 3435 | ||
@@ -3374,7 +3460,7 @@ static int __init parse_parport_params(void) | |||
3374 | irqval[0] = val; | 3460 | irqval[0] = val; |
3375 | break; | 3461 | break; |
3376 | default: | 3462 | default: |
3377 | printk (KERN_WARNING | 3463 | printk(KERN_WARNING |
3378 | "parport_pc: irq specified " | 3464 | "parport_pc: irq specified " |
3379 | "without base address. Use 'io=' " | 3465 | "without base address. Use 'io=' " |
3380 | "to specify one\n"); | 3466 | "to specify one\n"); |
@@ -3387,7 +3473,7 @@ static int __init parse_parport_params(void) | |||
3387 | dmaval[0] = val; | 3473 | dmaval[0] = val; |
3388 | break; | 3474 | break; |
3389 | default: | 3475 | default: |
3390 | printk (KERN_WARNING | 3476 | printk(KERN_WARNING |
3391 | "parport_pc: dma specified " | 3477 | "parport_pc: dma specified " |
3392 | "without base address. Use 'io=' " | 3478 | "without base address. Use 'io=' " |
3393 | "to specify one\n"); | 3479 | "to specify one\n"); |
@@ -3398,7 +3484,7 @@ static int __init parse_parport_params(void) | |||
3398 | 3484 | ||
3399 | #else | 3485 | #else |
3400 | 3486 | ||
3401 | static int parport_setup_ptr __initdata = 0; | 3487 | static int parport_setup_ptr __initdata; |
3402 | 3488 | ||
3403 | /* | 3489 | /* |
3404 | * Acceptable parameters: | 3490 | * Acceptable parameters: |
@@ -3409,7 +3495,7 @@ static int parport_setup_ptr __initdata = 0; | |||
3409 | * | 3495 | * |
3410 | * IRQ/DMA may be numeric or 'auto' or 'none' | 3496 | * IRQ/DMA may be numeric or 'auto' or 'none' |
3411 | */ | 3497 | */ |
3412 | static int __init parport_setup (char *str) | 3498 | static int __init parport_setup(char *str) |
3413 | { | 3499 | { |
3414 | char *endptr; | 3500 | char *endptr; |
3415 | char *sep; | 3501 | char *sep; |
@@ -3421,15 +3507,15 @@ static int __init parport_setup (char *str) | |||
3421 | return 1; | 3507 | return 1; |
3422 | } | 3508 | } |
3423 | 3509 | ||
3424 | if (!strncmp (str, "auto", 4)) { | 3510 | if (!strncmp(str, "auto", 4)) { |
3425 | irqval[0] = PARPORT_IRQ_AUTO; | 3511 | irqval[0] = PARPORT_IRQ_AUTO; |
3426 | dmaval[0] = PARPORT_DMA_AUTO; | 3512 | dmaval[0] = PARPORT_DMA_AUTO; |
3427 | return 1; | 3513 | return 1; |
3428 | } | 3514 | } |
3429 | 3515 | ||
3430 | val = simple_strtoul (str, &endptr, 0); | 3516 | val = simple_strtoul(str, &endptr, 0); |
3431 | if (endptr == str) { | 3517 | if (endptr == str) { |
3432 | printk (KERN_WARNING "parport=%s not understood\n", str); | 3518 | printk(KERN_WARNING "parport=%s not understood\n", str); |
3433 | return 1; | 3519 | return 1; |
3434 | } | 3520 | } |
3435 | 3521 | ||
@@ -3463,7 +3549,7 @@ static int __init parse_parport_params(void) | |||
3463 | return io[0] == PARPORT_DISABLE; | 3549 | return io[0] == PARPORT_DISABLE; |
3464 | } | 3550 | } |
3465 | 3551 | ||
3466 | __setup ("parport=", parport_setup); | 3552 | __setup("parport=", parport_setup); |
3467 | 3553 | ||
3468 | /* | 3554 | /* |
3469 | * Acceptable parameters: | 3555 | * Acceptable parameters: |
@@ -3471,7 +3557,7 @@ __setup ("parport=", parport_setup); | |||
3471 | * parport_init_mode=[spp|ps2|epp|ecp|ecpepp] | 3557 | * parport_init_mode=[spp|ps2|epp|ecp|ecpepp] |
3472 | */ | 3558 | */ |
3473 | #ifdef CONFIG_PCI | 3559 | #ifdef CONFIG_PCI |
3474 | __setup("parport_init_mode=",parport_init_mode_setup); | 3560 | __setup("parport_init_mode=", parport_init_mode_setup); |
3475 | #endif | 3561 | #endif |
3476 | #endif | 3562 | #endif |
3477 | 3563 | ||
@@ -3495,13 +3581,13 @@ static int __init parport_pc_init(void) | |||
3495 | for (i = 0; i < PARPORT_PC_MAX_PORTS; i++) { | 3581 | for (i = 0; i < PARPORT_PC_MAX_PORTS; i++) { |
3496 | if (!io[i]) | 3582 | if (!io[i]) |
3497 | break; | 3583 | break; |
3498 | if ((io_hi[i]) == PARPORT_IOHI_AUTO) | 3584 | if (io_hi[i] == PARPORT_IOHI_AUTO) |
3499 | io_hi[i] = 0x400 + io[i]; | 3585 | io_hi[i] = 0x400 + io[i]; |
3500 | parport_pc_probe_port(io[i], io_hi[i], | 3586 | parport_pc_probe_port(io[i], io_hi[i], |
3501 | irqval[i], dmaval[i], NULL, 0); | 3587 | irqval[i], dmaval[i], NULL, 0); |
3502 | } | 3588 | } |
3503 | } else | 3589 | } else |
3504 | parport_pc_find_ports (irqval[0], dmaval[0]); | 3590 | parport_pc_find_ports(irqval[0], dmaval[0]); |
3505 | 3591 | ||
3506 | return 0; | 3592 | return 0; |
3507 | } | 3593 | } |
@@ -3509,9 +3595,9 @@ static int __init parport_pc_init(void) | |||
3509 | static void __exit parport_pc_exit(void) | 3595 | static void __exit parport_pc_exit(void) |
3510 | { | 3596 | { |
3511 | if (pci_registered_parport) | 3597 | if (pci_registered_parport) |
3512 | pci_unregister_driver (&parport_pc_pci_driver); | 3598 | pci_unregister_driver(&parport_pc_pci_driver); |
3513 | if (pnp_registered_parport) | 3599 | if (pnp_registered_parport) |
3514 | pnp_unregister_driver (&parport_pc_pnp_driver); | 3600 | pnp_unregister_driver(&parport_pc_pnp_driver); |
3515 | platform_driver_unregister(&parport_pc_platform_driver); | 3601 | platform_driver_unregister(&parport_pc_platform_driver); |
3516 | 3602 | ||
3517 | while (!list_empty(&ports_list)) { | 3603 | while (!list_empty(&ports_list)) { |