Lines Matching refs:port
35 size_t parport_ieee1284_write_compat (struct parport *port, in parport_ieee1284_write_compat() argument
43 struct pardevice *dev = port->physport->cad; in parport_ieee1284_write_compat()
47 if (port->irq != PARPORT_IRQ_NONE) { in parport_ieee1284_write_compat()
48 parport_enable_irq (port); in parport_ieee1284_write_compat()
52 port->physport->ieee1284.phase = IEEE1284_PH_FWD_DATA; in parport_ieee1284_write_compat()
53 parport_write_control (port, ctl); in parport_ieee1284_write_compat()
54 parport_data_forward (port); in parport_ieee1284_write_compat()
66 if (!parport_wait_peripheral (port, mask, val)) in parport_ieee1284_write_compat()
71 if ((parport_read_status (port) & in parport_ieee1284_write_compat()
99 parport_wait_event (port, wait); in parport_ieee1284_write_compat()
112 pr_debug("%s: Timed out\n", port->name); in parport_ieee1284_write_compat()
118 parport_write_data (port, byte); in parport_ieee1284_write_compat()
122 parport_write_control (port, ctl | PARPORT_CONTROL_STROBE); in parport_ieee1284_write_compat()
125 parport_write_control (port, ctl); in parport_ieee1284_write_compat()
138 port->physport->ieee1284.phase = IEEE1284_PH_FWD_IDLE; in parport_ieee1284_write_compat()
144 size_t parport_ieee1284_read_nibble (struct parport *port, in parport_ieee1284_read_nibble() argument
161 (parport_read_status(port) & PARPORT_STATUS_ERROR)) { in parport_ieee1284_read_nibble()
166 parport_frob_control (port, in parport_ieee1284_read_nibble()
171 port->ieee1284.phase = IEEE1284_PH_REV_DATA; in parport_ieee1284_read_nibble()
172 if (parport_wait_peripheral (port, in parport_ieee1284_read_nibble()
176 port->name, i / 2); in parport_ieee1284_read_nibble()
177 parport_frob_control (port, PARPORT_CONTROL_AUTOFD, 0); in parport_ieee1284_read_nibble()
183 nibble = parport_read_status (port) >> 3; in parport_ieee1284_read_nibble()
190 parport_frob_control (port, PARPORT_CONTROL_AUTOFD, 0); in parport_ieee1284_read_nibble()
193 if (parport_wait_peripheral (port, in parport_ieee1284_read_nibble()
198 port->name); in parport_ieee1284_read_nibble()
212 if (parport_read_status (port) & PARPORT_STATUS_ERROR) { in parport_ieee1284_read_nibble()
215 port->name, i / 2); in parport_ieee1284_read_nibble()
218 parport_frob_control (port, in parport_ieee1284_read_nibble()
221 port->physport->ieee1284.phase = IEEE1284_PH_REV_IDLE; in parport_ieee1284_read_nibble()
224 port->physport->ieee1284.phase = IEEE1284_PH_HBUSY_DAVAIL; in parport_ieee1284_read_nibble()
232 size_t parport_ieee1284_read_byte (struct parport *port, in parport_ieee1284_read_byte() argument
246 if (parport_read_status (port) & PARPORT_STATUS_ERROR) { in parport_ieee1284_read_byte()
251 parport_data_reverse (port); in parport_ieee1284_read_byte()
254 parport_frob_control (port, in parport_ieee1284_read_byte()
259 port->physport->ieee1284.phase = IEEE1284_PH_REV_DATA; in parport_ieee1284_read_byte()
260 if (parport_wait_peripheral (port, in parport_ieee1284_read_byte()
264 parport_frob_control (port, PARPORT_CONTROL_AUTOFD, in parport_ieee1284_read_byte()
266 pr_debug("%s: Byte timeout at event 9\n", port->name); in parport_ieee1284_read_byte()
270 byte = parport_read_data (port); in parport_ieee1284_read_byte()
274 parport_frob_control (port, PARPORT_CONTROL_AUTOFD, 0); in parport_ieee1284_read_byte()
277 if (parport_wait_peripheral (port, in parport_ieee1284_read_byte()
281 pr_debug("%s: Byte timeout at event 11\n", port->name); in parport_ieee1284_read_byte()
286 parport_frob_control (port, in parport_ieee1284_read_byte()
292 parport_frob_control (port, PARPORT_CONTROL_STROBE, 0); in parport_ieee1284_read_byte()
297 if (parport_read_status (port) & PARPORT_STATUS_ERROR) { in parport_ieee1284_read_byte()
300 port->name, count); in parport_ieee1284_read_byte()
303 parport_frob_control (port, in parport_ieee1284_read_byte()
306 port->physport->ieee1284.phase = IEEE1284_PH_REV_IDLE; in parport_ieee1284_read_byte()
309 port->physport->ieee1284.phase = IEEE1284_PH_HBUSY_DAVAIL; in parport_ieee1284_read_byte()
323 int ecp_forward_to_reverse (struct parport *port) in ecp_forward_to_reverse() argument
328 parport_frob_control (port, in ecp_forward_to_reverse()
331 parport_data_reverse (port); in ecp_forward_to_reverse()
335 parport_frob_control (port, in ecp_forward_to_reverse()
340 retval = parport_wait_peripheral (port, in ecp_forward_to_reverse()
344 pr_debug("%s: ECP direction: reverse\n", port->name); in ecp_forward_to_reverse()
345 port->ieee1284.phase = IEEE1284_PH_REV_IDLE; in ecp_forward_to_reverse()
347 pr_debug("%s: ECP direction: failed to reverse\n", port->name); in ecp_forward_to_reverse()
348 port->ieee1284.phase = IEEE1284_PH_ECP_DIR_UNKNOWN; in ecp_forward_to_reverse()
355 int ecp_reverse_to_forward (struct parport *port) in ecp_reverse_to_forward() argument
360 parport_frob_control (port, in ecp_reverse_to_forward()
367 retval = parport_wait_peripheral (port, in ecp_reverse_to_forward()
372 parport_data_forward (port); in ecp_reverse_to_forward()
373 pr_debug("%s: ECP direction: forward\n", port->name); in ecp_reverse_to_forward()
374 port->ieee1284.phase = IEEE1284_PH_FWD_IDLE; in ecp_reverse_to_forward()
377 port->name); in ecp_reverse_to_forward()
378 port->ieee1284.phase = IEEE1284_PH_ECP_DIR_UNKNOWN; in ecp_reverse_to_forward()
388 size_t parport_ieee1284_ecp_write_data (struct parport *port, in parport_ieee1284_ecp_write_data() argument
399 port = port->physport; in parport_ieee1284_ecp_write_data()
401 if (port->ieee1284.phase != IEEE1284_PH_FWD_IDLE) in parport_ieee1284_ecp_write_data()
402 if (ecp_reverse_to_forward (port)) in parport_ieee1284_ecp_write_data()
405 port->ieee1284.phase = IEEE1284_PH_FWD_DATA; in parport_ieee1284_ecp_write_data()
408 parport_frob_control (port, in parport_ieee1284_ecp_write_data()
414 unsigned long expire = jiffies + port->cad->timeout; in parport_ieee1284_ecp_write_data()
419 parport_write_data (port, byte); in parport_ieee1284_ecp_write_data()
420 parport_frob_control (port, PARPORT_CONTROL_STROBE, in parport_ieee1284_ecp_write_data()
424 if (!parport_wait_peripheral (port, in parport_ieee1284_ecp_write_data()
429 parport_frob_control (port, in parport_ieee1284_ecp_write_data()
437 pr_debug("%s: ECP transfer stalled!\n", port->name); in parport_ieee1284_ecp_write_data()
439 parport_frob_control (port, PARPORT_CONTROL_INIT, in parport_ieee1284_ecp_write_data()
442 if (parport_read_status (port) & PARPORT_STATUS_PAPEROUT) { in parport_ieee1284_ecp_write_data()
444 parport_frob_control (port, PARPORT_CONTROL_INIT, 0); in parport_ieee1284_ecp_write_data()
448 parport_frob_control (port, PARPORT_CONTROL_INIT, 0); in parport_ieee1284_ecp_write_data()
450 if (!(parport_read_status (port) & PARPORT_STATUS_PAPEROUT)) in parport_ieee1284_ecp_write_data()
453 pr_debug("%s: Host transfer recovered\n", port->name); in parport_ieee1284_ecp_write_data()
458 parport_frob_control (port, PARPORT_CONTROL_STROBE, 0); in parport_ieee1284_ecp_write_data()
460 if (parport_wait_peripheral (port, in parport_ieee1284_ecp_write_data()
467 port->ieee1284.phase = IEEE1284_PH_FWD_IDLE; in parport_ieee1284_ecp_write_data()
474 size_t parport_ieee1284_ecp_read_data (struct parport *port, in parport_ieee1284_ecp_read_data() argument
480 struct pardevice *dev = port->cad; in parport_ieee1284_ecp_read_data()
487 port = port->physport; in parport_ieee1284_ecp_read_data()
489 if (port->ieee1284.phase != IEEE1284_PH_REV_IDLE) in parport_ieee1284_ecp_read_data()
490 if (ecp_forward_to_reverse (port)) in parport_ieee1284_ecp_read_data()
493 port->ieee1284.phase = IEEE1284_PH_REV_DATA; in parport_ieee1284_ecp_read_data()
496 ctl = parport_read_control (port); in parport_ieee1284_ecp_read_data()
499 parport_write_control (port, in parport_ieee1284_ecp_read_data()
508 while (parport_wait_peripheral (port, PARPORT_STATUS_ACK, 0)) { in parport_ieee1284_ecp_read_data()
521 if (dev->port->irq != PARPORT_IRQ_NONE) { in parport_ieee1284_ecp_read_data()
528 parport_wait_event (port, msecs_to_jiffies(40)); in parport_ieee1284_ecp_read_data()
541 command = (parport_read_status (port) & in parport_ieee1284_ecp_read_data()
545 byte = parport_read_data (port); in parport_ieee1284_ecp_read_data()
552 port->name, byte); in parport_ieee1284_ecp_read_data()
555 else if (port->ieee1284.mode != IEEE1284_MODE_ECPRLE) in parport_ieee1284_ecp_read_data()
557 port->name); in parport_ieee1284_ecp_read_data()
564 port->name, rle_count); in parport_ieee1284_ecp_read_data()
572 parport_write_control (port, ctl); in parport_ieee1284_ecp_read_data()
575 if (parport_wait_peripheral (port, PARPORT_STATUS_ACK, in parport_ieee1284_ecp_read_data()
583 port->name, byte); in parport_ieee1284_ecp_read_data()
589 parport_write_control (port, in parport_ieee1284_ecp_read_data()
603 port->name, rle_count); in parport_ieee1284_ecp_read_data()
612 port->ieee1284.phase = IEEE1284_PH_REV_IDLE; in parport_ieee1284_ecp_read_data()
618 size_t parport_ieee1284_ecp_write_addr (struct parport *port, in parport_ieee1284_ecp_write_addr() argument
629 port = port->physport; in parport_ieee1284_ecp_write_addr()
631 if (port->ieee1284.phase != IEEE1284_PH_FWD_IDLE) in parport_ieee1284_ecp_write_addr()
632 if (ecp_reverse_to_forward (port)) in parport_ieee1284_ecp_write_addr()
635 port->ieee1284.phase = IEEE1284_PH_FWD_DATA; in parport_ieee1284_ecp_write_addr()
638 parport_frob_control (port, in parport_ieee1284_ecp_write_addr()
645 unsigned long expire = jiffies + port->cad->timeout; in parport_ieee1284_ecp_write_addr()
650 parport_write_data (port, byte); in parport_ieee1284_ecp_write_addr()
651 parport_frob_control (port, PARPORT_CONTROL_STROBE, in parport_ieee1284_ecp_write_addr()
655 if (!parport_wait_peripheral (port, in parport_ieee1284_ecp_write_addr()
660 parport_frob_control (port, in parport_ieee1284_ecp_write_addr()
668 pr_debug("%s: ECP transfer stalled!\n", port->name); in parport_ieee1284_ecp_write_addr()
670 parport_frob_control (port, PARPORT_CONTROL_INIT, in parport_ieee1284_ecp_write_addr()
673 if (parport_read_status (port) & PARPORT_STATUS_PAPEROUT) { in parport_ieee1284_ecp_write_addr()
675 parport_frob_control (port, PARPORT_CONTROL_INIT, 0); in parport_ieee1284_ecp_write_addr()
679 parport_frob_control (port, PARPORT_CONTROL_INIT, 0); in parport_ieee1284_ecp_write_addr()
681 if (!(parport_read_status (port) & PARPORT_STATUS_PAPEROUT)) in parport_ieee1284_ecp_write_addr()
684 pr_debug("%s: Host transfer recovered\n", port->name); in parport_ieee1284_ecp_write_addr()
689 parport_frob_control (port, PARPORT_CONTROL_STROBE, 0); in parport_ieee1284_ecp_write_addr()
691 if (parport_wait_peripheral (port, in parport_ieee1284_ecp_write_addr()
698 port->ieee1284.phase = IEEE1284_PH_FWD_IDLE; in parport_ieee1284_ecp_write_addr()
709 size_t parport_ieee1284_epp_write_data (struct parport *port, in parport_ieee1284_epp_write_data() argument
717 parport_frob_control (port, in parport_ieee1284_epp_write_data()
724 port->ops->data_forward (port); in parport_ieee1284_epp_write_data()
727 parport_write_data (port, *bp); in parport_ieee1284_epp_write_data()
728 parport_frob_control (port, PARPORT_CONTROL_AUTOFD, in parport_ieee1284_epp_write_data()
732 if (parport_poll_peripheral (port, PARPORT_STATUS_BUSY, 0, 10)) in parport_ieee1284_epp_write_data()
736 parport_frob_control (port, PARPORT_CONTROL_AUTOFD, 0); in parport_ieee1284_epp_write_data()
739 if (parport_poll_peripheral (port, PARPORT_STATUS_BUSY, in parport_ieee1284_epp_write_data()
747 parport_frob_control (port, PARPORT_CONTROL_STROBE, 0); in parport_ieee1284_epp_write_data()
753 size_t parport_ieee1284_epp_read_data (struct parport *port, in parport_ieee1284_epp_read_data() argument
761 parport_frob_control (port, in parport_ieee1284_epp_read_data()
767 port->ops->data_reverse (port); in parport_ieee1284_epp_read_data()
770 parport_frob_control (port, in parport_ieee1284_epp_read_data()
774 if (parport_wait_peripheral (port, PARPORT_STATUS_BUSY, 0)) { in parport_ieee1284_epp_read_data()
778 *bp = parport_read_data (port); in parport_ieee1284_epp_read_data()
781 parport_frob_control (port, PARPORT_CONTROL_AUTOFD, 0); in parport_ieee1284_epp_read_data()
784 if (parport_poll_peripheral (port, PARPORT_STATUS_BUSY, in parport_ieee1284_epp_read_data()
791 port->ops->data_forward (port); in parport_ieee1284_epp_read_data()
797 size_t parport_ieee1284_epp_write_addr (struct parport *port, in parport_ieee1284_epp_write_addr() argument
805 parport_frob_control (port, in parport_ieee1284_epp_write_addr()
812 port->ops->data_forward (port); in parport_ieee1284_epp_write_addr()
815 parport_write_data (port, *bp); in parport_ieee1284_epp_write_addr()
816 parport_frob_control (port, PARPORT_CONTROL_SELECT, in parport_ieee1284_epp_write_addr()
820 if (parport_poll_peripheral (port, PARPORT_STATUS_BUSY, 0, 10)) in parport_ieee1284_epp_write_addr()
824 parport_frob_control (port, PARPORT_CONTROL_SELECT, 0); in parport_ieee1284_epp_write_addr()
827 if (parport_poll_peripheral (port, PARPORT_STATUS_BUSY, in parport_ieee1284_epp_write_addr()
835 parport_frob_control (port, PARPORT_CONTROL_STROBE, 0); in parport_ieee1284_epp_write_addr()
841 size_t parport_ieee1284_epp_read_addr (struct parport *port, in parport_ieee1284_epp_read_addr() argument
849 parport_frob_control (port, in parport_ieee1284_epp_read_addr()
855 port->ops->data_reverse (port); in parport_ieee1284_epp_read_addr()
858 parport_frob_control (port, PARPORT_CONTROL_SELECT, in parport_ieee1284_epp_read_addr()
862 if (parport_wait_peripheral (port, PARPORT_STATUS_BUSY, 0)) { in parport_ieee1284_epp_read_addr()
866 *bp = parport_read_data (port); in parport_ieee1284_epp_read_addr()
869 parport_frob_control (port, PARPORT_CONTROL_SELECT, in parport_ieee1284_epp_read_addr()
873 if (parport_poll_peripheral (port, PARPORT_STATUS_BUSY, in parport_ieee1284_epp_read_addr()
879 port->ops->data_forward (port); in parport_ieee1284_epp_read_addr()