Lines Matching refs:port

42 static void parport_ieee1284_wakeup (struct parport *port)  in parport_ieee1284_wakeup()  argument
44 up (&port->physport->ieee1284.irq); in parport_ieee1284_wakeup()
69 int parport_wait_event (struct parport *port, signed long timeout) in parport_wait_event() argument
74 if (!port->physport->cad->timeout) in parport_wait_event()
82 port_from_cookie[port->number % PARPORT_MAX] = port; in parport_wait_event()
83 timer.data = port->number; in parport_wait_event()
86 ret = down_interruptible (&port->physport->ieee1284.irq); in parport_wait_event()
120 int parport_poll_peripheral(struct parport *port, in parport_poll_peripheral() argument
130 status = parport_read_status (port); in parport_poll_peripheral()
169 int parport_wait_peripheral(struct parport *port, in parport_wait_peripheral() argument
178 usec = port->physport->spintime; /* usecs of fast polling */ in parport_wait_peripheral()
179 if (!port->physport->cad->timeout) in parport_wait_peripheral()
190 ret = parport_poll_peripheral (port, mask, result, usec); in parport_wait_peripheral()
194 if (!port->physport->cad->timeout) in parport_wait_peripheral()
207 if ((ret = parport_wait_event (port, msecs_to_jiffies(10))) < 0) in parport_wait_peripheral()
210 status = parport_read_status (port); in parport_wait_peripheral()
227 static void parport_ieee1284_terminate (struct parport *port) in parport_ieee1284_terminate() argument
230 port = port->physport; in parport_ieee1284_terminate()
233 switch (port->ieee1284.mode) { in parport_ieee1284_terminate()
240 parport_frob_control (port, PARPORT_CONTROL_INIT, 0); in parport_ieee1284_terminate()
244 parport_frob_control (port, in parport_ieee1284_terminate()
255 if (port->ieee1284.phase != IEEE1284_PH_FWD_IDLE) { in parport_ieee1284_terminate()
257 parport_frob_control (port, in parport_ieee1284_terminate()
264 r = parport_wait_peripheral (port, in parport_ieee1284_terminate()
269 port->name); in parport_ieee1284_terminate()
271 parport_data_forward (port); in parport_ieee1284_terminate()
273 port->name); in parport_ieee1284_terminate()
274 port->ieee1284.phase = IEEE1284_PH_FWD_IDLE; in parport_ieee1284_terminate()
283 parport_frob_control (port, in parport_ieee1284_terminate()
289 r = parport_wait_peripheral (port, PARPORT_STATUS_ACK, 0); in parport_ieee1284_terminate()
292 port->name); in parport_ieee1284_terminate()
295 parport_frob_control (port, in parport_ieee1284_terminate()
300 r = parport_wait_peripheral (port, in parport_ieee1284_terminate()
305 port->name); in parport_ieee1284_terminate()
308 parport_frob_control (port, PARPORT_CONTROL_AUTOFD, 0); in parport_ieee1284_terminate()
311 port->ieee1284.mode = IEEE1284_MODE_COMPAT; in parport_ieee1284_terminate()
312 port->ieee1284.phase = IEEE1284_PH_FWD_IDLE; in parport_ieee1284_terminate()
315 port->name); in parport_ieee1284_terminate()
334 int parport_negotiate (struct parport *port, int mode) in parport_negotiate() argument
346 port = port->physport; in parport_negotiate()
349 if (port->ieee1284.mode == mode) in parport_negotiate()
353 if ((port->ieee1284.mode & ~IEEE1284_ADDR) == (mode & ~IEEE1284_ADDR)){ in parport_negotiate()
354 port->ieee1284.mode = mode; in parport_negotiate()
359 if (port->ieee1284.mode != IEEE1284_MODE_COMPAT) in parport_negotiate()
360 parport_ieee1284_terminate (port); in parport_negotiate()
381 port->ieee1284.phase = IEEE1284_PH_NEGOTIATION; in parport_negotiate()
384 parport_frob_control (port, in parport_negotiate()
392 parport_data_forward (port); in parport_negotiate()
393 parport_write_data (port, m); in parport_negotiate()
397 parport_frob_control (port, in parport_negotiate()
403 if (parport_wait_peripheral (port, in parport_negotiate()
412 parport_frob_control (port, in parport_negotiate()
418 port->name, parport_read_status (port)); in parport_negotiate()
419 port->ieee1284.phase = IEEE1284_PH_FWD_IDLE; in parport_negotiate()
424 parport_frob_control (port, in parport_negotiate()
430 parport_frob_control (port, in parport_negotiate()
436 if (parport_wait_peripheral (port, in parport_negotiate()
442 port->name, mode, port->ops->read_status (port)); in parport_negotiate()
443 parport_ieee1284_terminate (port); in parport_negotiate()
447 xflag = parport_read_status (port) & PARPORT_STATUS_SELECT; in parport_negotiate()
453 port->name, mode); in parport_negotiate()
454 parport_ieee1284_terminate (port); in parport_negotiate()
462 parport_write_data (port, m); in parport_negotiate()
466 parport_frob_control (port, in parport_negotiate()
471 if (parport_wait_peripheral (port, PARPORT_STATUS_ACK, 0)) { in parport_negotiate()
475 port->name); in parport_negotiate()
476 parport_ieee1284_terminate (port); in parport_negotiate()
481 parport_frob_control (port, in parport_negotiate()
486 if (parport_wait_peripheral (port, in parport_negotiate()
493 port->name, mode, in parport_negotiate()
494 port->ops->read_status (port)); in parport_negotiate()
495 parport_ieee1284_terminate (port); in parport_negotiate()
500 xflag = parport_read_status (port) & PARPORT_STATUS_SELECT; in parport_negotiate()
506 "supported\n", port->name, mode); in parport_negotiate()
507 parport_ieee1284_terminate (port); in parport_negotiate()
515 DPRINTK (KERN_DEBUG "%s: In mode 0x%02x\n", port->name, mode); in parport_negotiate()
516 port->ieee1284.mode = mode; in parport_negotiate()
520 port->ieee1284.phase = IEEE1284_PH_ECP_SETUP; in parport_negotiate()
523 parport_frob_control (port, in parport_negotiate()
528 r = parport_wait_peripheral (port, in parport_negotiate()
533 port->name); in parport_negotiate()
536 port->ieee1284.phase = IEEE1284_PH_FWD_IDLE; in parport_negotiate()
538 port->name); in parport_negotiate()
542 port->ieee1284.phase = IEEE1284_PH_REV_IDLE; in parport_negotiate()
545 port->ieee1284.phase = IEEE1284_PH_FWD_IDLE; in parport_negotiate()
560 static int parport_ieee1284_ack_data_avail (struct parport *port) in parport_ieee1284_ack_data_avail() argument
562 if (parport_read_status (port) & PARPORT_STATUS_ERROR) in parport_ieee1284_ack_data_avail()
567 port->ops->frob_control (port, PARPORT_CONTROL_AUTOFD, 0); in parport_ieee1284_ack_data_avail()
568 port->ieee1284.phase = IEEE1284_PH_HBUSY_DAVAIL; in parport_ieee1284_ack_data_avail()
576 struct parport *port = handle; in parport_ieee1284_interrupt() local
577 parport_ieee1284_wakeup (port); in parport_ieee1284_interrupt()
580 if (port->ieee1284.phase == IEEE1284_PH_REV_IDLE) { in parport_ieee1284_interrupt()
583 DPRINTK (KERN_DEBUG "%s: Data available\n", port->name); in parport_ieee1284_interrupt()
584 parport_ieee1284_ack_data_avail (port); in parport_ieee1284_interrupt()
607 ssize_t parport_write (struct parport *port, const void *buffer, size_t len) in parport_write() argument
610 return port->ops->compat_write_data (port, buffer, len, 0); in parport_write()
613 int mode = port->ieee1284.mode; in parport_write()
624 parport_negotiate (port, IEEE1284_MODE_COMPAT); in parport_write()
627 port->name); in parport_write()
628 fn = port->ops->compat_write_data; in parport_write()
632 DPRINTK (KERN_DEBUG "%s: Using EPP mode\n", port->name); in parport_write()
634 fn = port->ops->epp_write_addr; in parport_write()
636 fn = port->ops->epp_write_data; in parport_write()
641 port->name); in parport_write()
650 DPRINTK (KERN_DEBUG "%s: Using ECP mode\n", port->name); in parport_write()
652 fn = port->ops->ecp_write_addr; in parport_write()
654 fn = port->ops->ecp_write_data; in parport_write()
660 port->name); in parport_write()
671 DPRINTK (KERN_DEBUG "%s: Unknown mode 0x%02x\n", port->name, in parport_write()
672 port->ieee1284.mode); in parport_write()
676 retval = (*fn) (port, buffer, len, 0); in parport_write()
677 DPRINTK (KERN_DEBUG "%s: wrote %d/%d bytes\n", port->name, retval, len); in parport_write()
700 ssize_t parport_read (struct parport *port, void *buffer, size_t len) in parport_read() argument
706 int mode = port->physport->ieee1284.mode; in parport_read()
721 if ((port->physport->modes & PARPORT_MODE_TRISTATE) && in parport_read()
722 !parport_negotiate (port, IEEE1284_MODE_BYTE)) { in parport_read()
724 DPRINTK (KERN_DEBUG "%s: Using byte mode\n", port->name); in parport_read()
725 fn = port->ops->byte_read_data; in parport_read()
728 if (parport_negotiate (port, IEEE1284_MODE_NIBBLE)) { in parport_read()
733 DPRINTK (KERN_DEBUG "%s: Using nibble mode\n", port->name); in parport_read()
734 fn = port->ops->nibble_read_data; in parport_read()
738 DPRINTK (KERN_DEBUG "%s: Using byte mode\n", port->name); in parport_read()
739 fn = port->ops->byte_read_data; in parport_read()
743 DPRINTK (KERN_DEBUG "%s: Using EPP mode\n", port->name); in parport_read()
745 fn = port->ops->epp_read_addr; in parport_read()
747 fn = port->ops->epp_read_data; in parport_read()
752 port->name); in parport_read()
761 DPRINTK (KERN_DEBUG "%s: Using ECP mode\n", port->name); in parport_read()
762 fn = port->ops->ecp_read_data; in parport_read()
767 port->name); in parport_read()
772 DPRINTK (KERN_DEBUG "%s: Unknown mode 0x%02x\n", port->name, in parport_read()
773 port->physport->ieee1284.mode); in parport_read()
777 return (*fn) (port, buffer, len, 0); in parport_read()
803 if (dev->port->physport->cad == dev) in parport_set_timeout()
804 parport_ieee1284_wakeup (dev->port); in parport_set_timeout()