1 // SPDX-License-Identifier: GPL-2.0
2 /* IEEE-1284 operations for parport.
4 * This file is for generic IEEE 1284 operations. The idea is that
5 * they are used by the low-level drivers. If they have a special way
6 * of doing something, they can provide their own routines (and put
7 * the function pointers in port->ops); if not, they can just use these
10 * Note: Make no assumptions about hardware or architecture in this file!
12 * Author: Tim Waugh <tim@cyberelk.demon.co.uk>
13 * Fixed AUTOFD polarity in ecp_forward_to_reverse(). Fred Barnes, 1999
14 * Software emulated EPP fixes, Fred Barnes, 04/2001.
18 #include <linux/module.h>
19 #include <linux/parport.h>
20 #include <linux/delay.h>
21 #include <linux/sched/signal.h>
22 #include <linux/uaccess.h>
24 #undef DEBUG /* undef me for production */
26 #ifdef CONFIG_LP_CONSOLE
27 #undef DEBUG /* Don't want a garbled console */
31 * One-way data transfer functions. *
34 /* Compatibility mode. */
35 size_t parport_ieee1284_write_compat (struct parport
*port
,
36 const void *buffer
, size_t len
,
41 const unsigned char *addr
= buffer
;
43 struct pardevice
*dev
= port
->physport
->cad
;
44 unsigned char ctl
= (PARPORT_CONTROL_SELECT
45 | PARPORT_CONTROL_INIT
);
47 if (port
->irq
!= PARPORT_IRQ_NONE
) {
48 parport_enable_irq (port
);
52 port
->physport
->ieee1284
.phase
= IEEE1284_PH_FWD_DATA
;
53 parport_write_control (port
, ctl
);
54 parport_data_forward (port
);
56 unsigned long expire
= jiffies
+ dev
->timeout
;
57 long wait
= msecs_to_jiffies(10);
58 unsigned char mask
= (PARPORT_STATUS_ERROR
59 | PARPORT_STATUS_BUSY
);
60 unsigned char val
= (PARPORT_STATUS_ERROR
61 | PARPORT_STATUS_BUSY
);
63 /* Wait until the peripheral's ready */
65 /* Is the peripheral ready yet? */
66 if (!parport_wait_peripheral (port
, mask
, val
))
70 /* Is the peripheral upset? */
71 if ((parport_read_status (port
) &
72 (PARPORT_STATUS_PAPEROUT
|
73 PARPORT_STATUS_SELECT
|
74 PARPORT_STATUS_ERROR
))
75 != (PARPORT_STATUS_SELECT
|
76 PARPORT_STATUS_ERROR
))
77 /* If nFault is asserted (i.e. no
78 * error) and PAPEROUT and SELECT are
79 * just red herrings, give the driver
80 * a chance to check it's happy with
81 * that before continuing. */
84 /* Have we run out of time? */
85 if (!time_before (jiffies
, expire
))
88 /* Yield the port for a while. If this is the
89 first time around the loop, don't let go of
90 the port. This way, we find out if we have
91 our interrupt handler called. */
92 if (count
&& no_irq
) {
93 parport_release (dev
);
94 schedule_timeout_interruptible(wait
);
95 parport_claim_or_block (dev
);
98 /* We must have the device claimed here */
99 parport_wait_event (port
, wait
);
101 /* Is there a signal pending? */
102 if (signal_pending (current
))
105 /* Wait longer next time. */
107 } while (time_before (jiffies
, expire
));
109 if (signal_pending (current
))
112 pr_debug("%s: Timed out\n", port
->name
);
116 /* Write the character to the data lines. */
118 parport_write_data (port
, byte
);
122 parport_write_control (port
, ctl
| PARPORT_CONTROL_STROBE
);
123 udelay (1); /* strobe */
125 parport_write_control (port
, ctl
);
126 udelay (1); /* hold */
128 /* Assume the peripheral received it. */
131 /* Let another process run if it needs to. */
132 if (time_before (jiffies
, expire
))
133 if (!parport_yield_blocking (dev
)
138 port
->physport
->ieee1284
.phase
= IEEE1284_PH_FWD_IDLE
;
144 size_t parport_ieee1284_read_nibble (struct parport
*port
,
145 void *buffer
, size_t len
,
148 #ifndef CONFIG_PARPORT_1284
151 unsigned char *buf
= buffer
;
153 unsigned char byte
= 0;
155 len
*= 2; /* in nibbles */
156 for (i
=0; i
< len
; i
++) {
157 unsigned char nibble
;
159 /* Does the error line indicate end of data? */
160 if (((i
& 1) == 0) &&
161 (parport_read_status(port
) & PARPORT_STATUS_ERROR
)) {
165 /* Event 7: Set nAutoFd low. */
166 parport_frob_control (port
,
167 PARPORT_CONTROL_AUTOFD
,
168 PARPORT_CONTROL_AUTOFD
);
170 /* Event 9: nAck goes low. */
171 port
->ieee1284
.phase
= IEEE1284_PH_REV_DATA
;
172 if (parport_wait_peripheral (port
,
173 PARPORT_STATUS_ACK
, 0)) {
174 /* Timeout -- no more data? */
175 pr_debug("%s: Nibble timeout at event 9 (%d bytes)\n",
177 parport_frob_control (port
, PARPORT_CONTROL_AUTOFD
, 0);
183 nibble
= parport_read_status (port
) >> 3;
185 if ((nibble
& 0x10) == 0)
189 /* Event 10: Set nAutoFd high. */
190 parport_frob_control (port
, PARPORT_CONTROL_AUTOFD
, 0);
192 /* Event 11: nAck goes high. */
193 if (parport_wait_peripheral (port
,
195 PARPORT_STATUS_ACK
)) {
196 /* Timeout -- no more data? */
197 pr_debug("%s: Nibble timeout at event 11\n",
211 /* Read the last nibble without checking data avail. */
212 if (parport_read_status (port
) & PARPORT_STATUS_ERROR
) {
214 pr_debug("%s: No more nibble data (%d bytes)\n",
217 /* Go to reverse idle phase. */
218 parport_frob_control (port
,
219 PARPORT_CONTROL_AUTOFD
,
220 PARPORT_CONTROL_AUTOFD
);
221 port
->physport
->ieee1284
.phase
= IEEE1284_PH_REV_IDLE
;
224 port
->physport
->ieee1284
.phase
= IEEE1284_PH_HBUSY_DAVAIL
;
228 #endif /* IEEE1284 support */
232 size_t parport_ieee1284_read_byte (struct parport
*port
,
233 void *buffer
, size_t len
,
236 #ifndef CONFIG_PARPORT_1284
239 unsigned char *buf
= buffer
;
242 for (count
= 0; count
< len
; count
++) {
245 /* Data available? */
246 if (parport_read_status (port
) & PARPORT_STATUS_ERROR
) {
250 /* Event 14: Place data bus in high impedance state. */
251 parport_data_reverse (port
);
253 /* Event 7: Set nAutoFd low. */
254 parport_frob_control (port
,
255 PARPORT_CONTROL_AUTOFD
,
256 PARPORT_CONTROL_AUTOFD
);
258 /* Event 9: nAck goes low. */
259 port
->physport
->ieee1284
.phase
= IEEE1284_PH_REV_DATA
;
260 if (parport_wait_peripheral (port
,
263 /* Timeout -- no more data? */
264 parport_frob_control (port
, PARPORT_CONTROL_AUTOFD
,
266 pr_debug("%s: Byte timeout at event 9\n", port
->name
);
270 byte
= parport_read_data (port
);
273 /* Event 10: Set nAutoFd high */
274 parport_frob_control (port
, PARPORT_CONTROL_AUTOFD
, 0);
276 /* Event 11: nAck goes high. */
277 if (parport_wait_peripheral (port
,
279 PARPORT_STATUS_ACK
)) {
280 /* Timeout -- no more data? */
281 pr_debug("%s: Byte timeout at event 11\n", port
->name
);
285 /* Event 16: Set nStrobe low. */
286 parport_frob_control (port
,
287 PARPORT_CONTROL_STROBE
,
288 PARPORT_CONTROL_STROBE
);
291 /* Event 17: Set nStrobe high. */
292 parport_frob_control (port
, PARPORT_CONTROL_STROBE
, 0);
296 /* Read the last byte without checking data avail. */
297 if (parport_read_status (port
) & PARPORT_STATUS_ERROR
) {
299 pr_debug("%s: No more byte data (%zd bytes)\n",
302 /* Go to reverse idle phase. */
303 parport_frob_control (port
,
304 PARPORT_CONTROL_AUTOFD
,
305 PARPORT_CONTROL_AUTOFD
);
306 port
->physport
->ieee1284
.phase
= IEEE1284_PH_REV_IDLE
;
309 port
->physport
->ieee1284
.phase
= IEEE1284_PH_HBUSY_DAVAIL
;
313 #endif /* IEEE1284 support */
320 #ifdef CONFIG_PARPORT_1284
323 int ecp_forward_to_reverse (struct parport
*port
)
327 /* Event 38: Set nAutoFd low */
328 parport_frob_control (port
,
329 PARPORT_CONTROL_AUTOFD
,
330 PARPORT_CONTROL_AUTOFD
);
331 parport_data_reverse (port
);
334 /* Event 39: Set nInit low to initiate bus reversal */
335 parport_frob_control (port
,
336 PARPORT_CONTROL_INIT
,
339 /* Event 40: PError goes low */
340 retval
= parport_wait_peripheral (port
,
341 PARPORT_STATUS_PAPEROUT
, 0);
344 pr_debug("%s: ECP direction: reverse\n", port
->name
);
345 port
->ieee1284
.phase
= IEEE1284_PH_REV_IDLE
;
347 pr_debug("%s: ECP direction: failed to reverse\n", port
->name
);
348 port
->ieee1284
.phase
= IEEE1284_PH_ECP_DIR_UNKNOWN
;
355 int ecp_reverse_to_forward (struct parport
*port
)
359 /* Event 47: Set nInit high */
360 parport_frob_control (port
,
362 | PARPORT_CONTROL_AUTOFD
,
364 | PARPORT_CONTROL_AUTOFD
);
366 /* Event 49: PError goes high */
367 retval
= parport_wait_peripheral (port
,
368 PARPORT_STATUS_PAPEROUT
,
369 PARPORT_STATUS_PAPEROUT
);
372 parport_data_forward (port
);
373 pr_debug("%s: ECP direction: forward\n", port
->name
);
374 port
->ieee1284
.phase
= IEEE1284_PH_FWD_IDLE
;
376 pr_debug("%s: ECP direction: failed to switch forward\n",
378 port
->ieee1284
.phase
= IEEE1284_PH_ECP_DIR_UNKNOWN
;
385 #endif /* IEEE1284 support */
387 /* ECP mode, forward channel, data. */
388 size_t parport_ieee1284_ecp_write_data (struct parport
*port
,
389 const void *buffer
, size_t len
,
392 #ifndef CONFIG_PARPORT_1284
395 const unsigned char *buf
= buffer
;
399 port
= port
->physport
;
401 if (port
->ieee1284
.phase
!= IEEE1284_PH_FWD_IDLE
)
402 if (ecp_reverse_to_forward (port
))
405 port
->ieee1284
.phase
= IEEE1284_PH_FWD_DATA
;
407 /* HostAck high (data, not command) */
408 parport_frob_control (port
,
409 PARPORT_CONTROL_AUTOFD
410 | PARPORT_CONTROL_STROBE
411 | PARPORT_CONTROL_INIT
,
412 PARPORT_CONTROL_INIT
);
413 for (written
= 0; written
< len
; written
++, buf
++) {
414 unsigned long expire
= jiffies
+ port
->cad
->timeout
;
419 parport_write_data (port
, byte
);
420 parport_frob_control (port
, PARPORT_CONTROL_STROBE
,
421 PARPORT_CONTROL_STROBE
);
423 for (retry
= 0; retry
< 100; retry
++) {
424 if (!parport_wait_peripheral (port
,
425 PARPORT_STATUS_BUSY
, 0))
428 if (signal_pending (current
)) {
429 parport_frob_control (port
,
430 PARPORT_CONTROL_STROBE
,
436 /* Time for Host Transfer Recovery (page 41 of IEEE1284) */
437 pr_debug("%s: ECP transfer stalled!\n", port
->name
);
439 parport_frob_control (port
, PARPORT_CONTROL_INIT
,
440 PARPORT_CONTROL_INIT
);
442 if (parport_read_status (port
) & PARPORT_STATUS_PAPEROUT
) {
444 parport_frob_control (port
, PARPORT_CONTROL_INIT
, 0);
448 parport_frob_control (port
, PARPORT_CONTROL_INIT
, 0);
450 if (!(parport_read_status (port
) & PARPORT_STATUS_PAPEROUT
))
453 pr_debug("%s: Host transfer recovered\n", port
->name
);
455 if (time_after_eq (jiffies
, expire
)) break;
458 parport_frob_control (port
, PARPORT_CONTROL_STROBE
, 0);
460 if (parport_wait_peripheral (port
,
462 PARPORT_STATUS_BUSY
))
463 /* Peripheral hasn't accepted the data. */
467 port
->ieee1284
.phase
= IEEE1284_PH_FWD_IDLE
;
470 #endif /* IEEE1284 support */
473 /* ECP mode, reverse channel, data. */
474 size_t parport_ieee1284_ecp_read_data (struct parport
*port
,
475 void *buffer
, size_t len
, int flags
)
477 #ifndef CONFIG_PARPORT_1284
480 struct pardevice
*dev
= port
->cad
;
481 unsigned char *buf
= buffer
;
482 int rle_count
= 0; /* shut gcc up */
487 port
= port
->physport
;
489 if (port
->ieee1284
.phase
!= IEEE1284_PH_REV_IDLE
)
490 if (ecp_forward_to_reverse (port
))
493 port
->ieee1284
.phase
= IEEE1284_PH_REV_DATA
;
495 /* Set HostAck low to start accepting data. */
496 ctl
= parport_read_control (port
);
497 ctl
&= ~(PARPORT_CONTROL_STROBE
| PARPORT_CONTROL_INIT
|
498 PARPORT_CONTROL_AUTOFD
);
499 parport_write_control (port
,
500 ctl
| PARPORT_CONTROL_AUTOFD
);
501 while (count
< len
) {
502 unsigned long expire
= jiffies
+ dev
->timeout
;
506 /* Event 43: Peripheral sets nAck low. It can take as
508 while (parport_wait_peripheral (port
, PARPORT_STATUS_ACK
, 0)) {
509 /* The peripheral hasn't given us data in
510 35ms. If we have data to give back to the
511 caller, do it now. */
515 /* If we've used up all the time we were allowed,
516 give up altogether. */
517 if (!time_before (jiffies
, expire
))
520 /* Yield the port for a while. */
521 if (dev
->port
->irq
!= PARPORT_IRQ_NONE
) {
522 parport_release (dev
);
523 schedule_timeout_interruptible(msecs_to_jiffies(40));
524 parport_claim_or_block (dev
);
527 /* We must have the device claimed here. */
528 parport_wait_event (port
, msecs_to_jiffies(40));
530 /* Is there a signal pending? */
531 if (signal_pending (current
))
535 /* Is this a command? */
537 /* The last byte was a run-length count, so
538 this can't be as well. */
541 command
= (parport_read_status (port
) &
542 PARPORT_STATUS_BUSY
) ? 1 : 0;
545 byte
= parport_read_data (port
);
547 /* If this is a channel command, rather than an RLE
548 command or a normal data byte, don't accept it. */
551 pr_debug("%s: stopping short at channel command (%02x)\n",
555 else if (port
->ieee1284
.mode
!= IEEE1284_MODE_ECPRLE
)
556 pr_debug("%s: device illegally using RLE; accepting anyway\n",
559 rle_count
= byte
+ 1;
561 /* Are we allowed to read that many bytes? */
562 if (rle_count
> (len
- count
)) {
563 pr_debug("%s: leaving %d RLE bytes for next time\n",
564 port
->name
, rle_count
);
571 /* Event 44: Set HostAck high, acknowledging handshake. */
572 parport_write_control (port
, ctl
);
574 /* Event 45: The peripheral has 35ms to set nAck high. */
575 if (parport_wait_peripheral (port
, PARPORT_STATUS_ACK
,
576 PARPORT_STATUS_ACK
)) {
577 /* It's gone wrong. Return what data we have
579 pr_debug("ECP read timed out at 45\n");
582 pr_warn("%s: command ignored (%02x)\n",
588 /* Event 46: Set HostAck low and accept the data. */
589 parport_write_control (port
,
590 ctl
| PARPORT_CONTROL_AUTOFD
);
592 /* If we just read a run-length count, fetch the data. */
596 /* If this is the byte after a run-length count, decompress. */
599 memset (buf
, byte
, rle_count
);
602 pr_debug("%s: decompressed to %d bytes\n",
603 port
->name
, rle_count
);
605 /* Normal data byte. */
612 port
->ieee1284
.phase
= IEEE1284_PH_REV_IDLE
;
614 #endif /* IEEE1284 support */
617 /* ECP mode, forward channel, commands. */
618 size_t parport_ieee1284_ecp_write_addr (struct parport
*port
,
619 const void *buffer
, size_t len
,
622 #ifndef CONFIG_PARPORT_1284
625 const unsigned char *buf
= buffer
;
629 port
= port
->physport
;
631 if (port
->ieee1284
.phase
!= IEEE1284_PH_FWD_IDLE
)
632 if (ecp_reverse_to_forward (port
))
635 port
->ieee1284
.phase
= IEEE1284_PH_FWD_DATA
;
637 /* HostAck low (command, not data) */
638 parport_frob_control (port
,
639 PARPORT_CONTROL_AUTOFD
640 | PARPORT_CONTROL_STROBE
641 | PARPORT_CONTROL_INIT
,
642 PARPORT_CONTROL_AUTOFD
643 | PARPORT_CONTROL_INIT
);
644 for (written
= 0; written
< len
; written
++, buf
++) {
645 unsigned long expire
= jiffies
+ port
->cad
->timeout
;
650 parport_write_data (port
, byte
);
651 parport_frob_control (port
, PARPORT_CONTROL_STROBE
,
652 PARPORT_CONTROL_STROBE
);
654 for (retry
= 0; retry
< 100; retry
++) {
655 if (!parport_wait_peripheral (port
,
656 PARPORT_STATUS_BUSY
, 0))
659 if (signal_pending (current
)) {
660 parport_frob_control (port
,
661 PARPORT_CONTROL_STROBE
,
667 /* Time for Host Transfer Recovery (page 41 of IEEE1284) */
668 pr_debug("%s: ECP transfer stalled!\n", port
->name
);
670 parport_frob_control (port
, PARPORT_CONTROL_INIT
,
671 PARPORT_CONTROL_INIT
);
673 if (parport_read_status (port
) & PARPORT_STATUS_PAPEROUT
) {
675 parport_frob_control (port
, PARPORT_CONTROL_INIT
, 0);
679 parport_frob_control (port
, PARPORT_CONTROL_INIT
, 0);
681 if (!(parport_read_status (port
) & PARPORT_STATUS_PAPEROUT
))
684 pr_debug("%s: Host transfer recovered\n", port
->name
);
686 if (time_after_eq (jiffies
, expire
)) break;
689 parport_frob_control (port
, PARPORT_CONTROL_STROBE
, 0);
691 if (parport_wait_peripheral (port
,
693 PARPORT_STATUS_BUSY
))
694 /* Peripheral hasn't accepted the data. */
698 port
->ieee1284
.phase
= IEEE1284_PH_FWD_IDLE
;
701 #endif /* IEEE1284 support */
708 /* EPP mode, forward channel, data. */
709 size_t parport_ieee1284_epp_write_data (struct parport
*port
,
710 const void *buffer
, size_t len
,
713 unsigned char *bp
= (unsigned char *) buffer
;
716 /* set EPP idle state (just to make sure) with strobe low */
717 parport_frob_control (port
,
718 PARPORT_CONTROL_STROBE
|
719 PARPORT_CONTROL_AUTOFD
|
720 PARPORT_CONTROL_SELECT
|
721 PARPORT_CONTROL_INIT
,
722 PARPORT_CONTROL_STROBE
|
723 PARPORT_CONTROL_INIT
);
724 port
->ops
->data_forward (port
);
725 for (; len
> 0; len
--, bp
++) {
726 /* Event 62: Write data and set autofd low */
727 parport_write_data (port
, *bp
);
728 parport_frob_control (port
, PARPORT_CONTROL_AUTOFD
,
729 PARPORT_CONTROL_AUTOFD
);
731 /* Event 58: wait for busy (nWait) to go high */
732 if (parport_poll_peripheral (port
, PARPORT_STATUS_BUSY
, 0, 10))
735 /* Event 63: set nAutoFd (nDStrb) high */
736 parport_frob_control (port
, PARPORT_CONTROL_AUTOFD
, 0);
738 /* Event 60: wait for busy (nWait) to go low */
739 if (parport_poll_peripheral (port
, PARPORT_STATUS_BUSY
,
740 PARPORT_STATUS_BUSY
, 5))
746 /* Event 61: set strobe (nWrite) high */
747 parport_frob_control (port
, PARPORT_CONTROL_STROBE
, 0);
752 /* EPP mode, reverse channel, data. */
753 size_t parport_ieee1284_epp_read_data (struct parport
*port
,
754 void *buffer
, size_t len
,
757 unsigned char *bp
= (unsigned char *) buffer
;
760 /* set EPP idle state (just to make sure) with strobe high */
761 parport_frob_control (port
,
762 PARPORT_CONTROL_STROBE
|
763 PARPORT_CONTROL_AUTOFD
|
764 PARPORT_CONTROL_SELECT
|
765 PARPORT_CONTROL_INIT
,
766 PARPORT_CONTROL_INIT
);
767 port
->ops
->data_reverse (port
);
768 for (; len
> 0; len
--, bp
++) {
769 /* Event 67: set nAutoFd (nDStrb) low */
770 parport_frob_control (port
,
771 PARPORT_CONTROL_AUTOFD
,
772 PARPORT_CONTROL_AUTOFD
);
773 /* Event 58: wait for Busy to go high */
774 if (parport_wait_peripheral (port
, PARPORT_STATUS_BUSY
, 0)) {
778 *bp
= parport_read_data (port
);
780 /* Event 63: set nAutoFd (nDStrb) high */
781 parport_frob_control (port
, PARPORT_CONTROL_AUTOFD
, 0);
783 /* Event 60: wait for Busy to go low */
784 if (parport_poll_peripheral (port
, PARPORT_STATUS_BUSY
,
785 PARPORT_STATUS_BUSY
, 5)) {
791 port
->ops
->data_forward (port
);
796 /* EPP mode, forward channel, addresses. */
797 size_t parport_ieee1284_epp_write_addr (struct parport
*port
,
798 const void *buffer
, size_t len
,
801 unsigned char *bp
= (unsigned char *) buffer
;
804 /* set EPP idle state (just to make sure) with strobe low */
805 parport_frob_control (port
,
806 PARPORT_CONTROL_STROBE
|
807 PARPORT_CONTROL_AUTOFD
|
808 PARPORT_CONTROL_SELECT
|
809 PARPORT_CONTROL_INIT
,
810 PARPORT_CONTROL_STROBE
|
811 PARPORT_CONTROL_INIT
);
812 port
->ops
->data_forward (port
);
813 for (; len
> 0; len
--, bp
++) {
814 /* Event 56: Write data and set nAStrb low. */
815 parport_write_data (port
, *bp
);
816 parport_frob_control (port
, PARPORT_CONTROL_SELECT
,
817 PARPORT_CONTROL_SELECT
);
819 /* Event 58: wait for busy (nWait) to go high */
820 if (parport_poll_peripheral (port
, PARPORT_STATUS_BUSY
, 0, 10))
823 /* Event 59: set nAStrb high */
824 parport_frob_control (port
, PARPORT_CONTROL_SELECT
, 0);
826 /* Event 60: wait for busy (nWait) to go low */
827 if (parport_poll_peripheral (port
, PARPORT_STATUS_BUSY
,
828 PARPORT_STATUS_BUSY
, 5))
834 /* Event 61: set strobe (nWrite) high */
835 parport_frob_control (port
, PARPORT_CONTROL_STROBE
, 0);
840 /* EPP mode, reverse channel, addresses. */
841 size_t parport_ieee1284_epp_read_addr (struct parport
*port
,
842 void *buffer
, size_t len
,
845 unsigned char *bp
= (unsigned char *) buffer
;
848 /* Set EPP idle state (just to make sure) with strobe high */
849 parport_frob_control (port
,
850 PARPORT_CONTROL_STROBE
|
851 PARPORT_CONTROL_AUTOFD
|
852 PARPORT_CONTROL_SELECT
|
853 PARPORT_CONTROL_INIT
,
854 PARPORT_CONTROL_INIT
);
855 port
->ops
->data_reverse (port
);
856 for (; len
> 0; len
--, bp
++) {
857 /* Event 64: set nSelectIn (nAStrb) low */
858 parport_frob_control (port
, PARPORT_CONTROL_SELECT
,
859 PARPORT_CONTROL_SELECT
);
861 /* Event 58: wait for Busy to go high */
862 if (parport_wait_peripheral (port
, PARPORT_STATUS_BUSY
, 0)) {
866 *bp
= parport_read_data (port
);
868 /* Event 59: set nSelectIn (nAStrb) high */
869 parport_frob_control (port
, PARPORT_CONTROL_SELECT
,
872 /* Event 60: wait for Busy to go low */
873 if (parport_poll_peripheral (port
, PARPORT_STATUS_BUSY
,
874 PARPORT_STATUS_BUSY
, 5))
879 port
->ops
->data_forward (port
);
884 EXPORT_SYMBOL(parport_ieee1284_ecp_write_data
);
885 EXPORT_SYMBOL(parport_ieee1284_ecp_read_data
);
886 EXPORT_SYMBOL(parport_ieee1284_ecp_write_addr
);
887 EXPORT_SYMBOL(parport_ieee1284_write_compat
);
888 EXPORT_SYMBOL(parport_ieee1284_read_nibble
);
889 EXPORT_SYMBOL(parport_ieee1284_read_byte
);
890 EXPORT_SYMBOL(parport_ieee1284_epp_write_data
);
891 EXPORT_SYMBOL(parport_ieee1284_epp_read_data
);
892 EXPORT_SYMBOL(parport_ieee1284_epp_write_addr
);
893 EXPORT_SYMBOL(parport_ieee1284_epp_read_addr
);