Lines Matching refs:port

13  *					Rough port to 2.1.x
32 * when the last port on the card is
55 * ISI port problem. Now the link
189 unsigned short port_status; /* each bit for each port */
200 struct tty_port port;
259 static void raise_dtr(struct isi_port *port)
261 struct isi_board *card = port->card;
263 u16 channel = port->channel;
271 port->status |= ISI_DTR;
275 static void drop_dtr(struct isi_port *port)
277 struct isi_board *card = port->card;
279 u16 channel = port->channel;
287 port->status &= ~ISI_DTR;
291 static inline void raise_rts(struct isi_port *port)
293 struct isi_board *card = port->card;
295 u16 channel = port->channel;
303 port->status |= ISI_RTS;
307 static inline void drop_rts(struct isi_port *port)
309 struct isi_board *card = port->card;
311 u16 channel = port->channel;
319 port->status &= ~ISI_RTS;
324 static void isicom_dtr_rts(struct tty_port *port, int on)
326 struct isi_port *ip = container_of(port, struct isi_port, port);
349 static void drop_dtr_rts(struct isi_port *port)
351 struct isi_board *card = port->card;
353 u16 channel = port->channel;
361 port->status &= ~(ISI_RTS | ISI_DTR);
369 static inline int __isicom_paranoia_check(struct isi_port const *port,
372 if (!port) {
377 if (port->magic != ISICOM_MAGIC) {
378 pr_warn("Warning: NULL isicom port for dev %s in %s\n",
399 struct isi_port *port;
415 port = isi_card[card].ports;
427 tty = tty_port_tty_get(&port->port);
431 for (; count > 0; count--, port++) {
432 /* port not active or tx disabled to force flow control */
433 if (!tty_port_initialized(&port->port) ||
434 !(port->status & ISI_TXOK))
437 txcount = min_t(short, TX_SIZE, port->xmit_cnt);
441 if (!(inw(base + 0x02) & (1 << port->channel)))
444 pr_debug("txing %d bytes, port%d.\n",
445 txcount, port->channel + 1);
446 outw((port->channel << isi_card[card].shift_count) | txcount,
452 - port->xmit_tail));
456 wrd |= (port->port.xmit_buf[port->xmit_tail]
458 port->xmit_tail = (port->xmit_tail + 1)
460 port->xmit_cnt--;
472 outsw(base, port->port.xmit_buf+port->xmit_tail, word_count);
473 port->xmit_tail = (port->xmit_tail
476 port->xmit_cnt -= (word_count << 1);
479 wrd = port->port.xmit_buf[port->xmit_tail];
480 port->xmit_tail = (port->xmit_tail + 1)
482 port->xmit_cnt--;
488 if (port->xmit_cnt <= 0)
489 port->status &= ~ISI_TXOK;
490 if (port->xmit_cnt <= WAKEUP_CHARS)
510 struct isi_port *port;
547 port = card->ports + channel;
548 if (!tty_port_initialized(&port->port)) {
554 tty = tty_port_tty_get(&port->port);
571 if (tty_port_check_carrier(&port->port)) {
572 if (port->status & ISI_DCD) {
577 port->status &= ~ISI_DCD;
584 port->status |= ISI_DCD;
585 wake_up_interruptible(&port->port.open_wait);
589 port->status |= ISI_DCD;
591 port->status &= ~ISI_DCD;
594 if (tty_port_cts_enabled(&port->port)) {
599 port->status |= (ISI_TXOK
606 port->status &= ~(ISI_TXOK | ISI_CTS);
610 port->status |= ISI_CTS;
612 port->status &= ~ISI_CTS;
616 port->status |= ISI_DSR;
618 port->status &= ~ISI_DSR;
621 port->status |= ISI_RI;
623 port->status &= ~ISI_RI;
628 tty_insert_flip_char(&port->port, 0, TTY_BREAK);
629 if (port->port.flags & ASYNC_SAK)
631 tty_flip_buffer_push(&port->port);
644 count = tty_prepare_flip_string(&port->port, &rp,
652 tty_insert_flip_char(&port->port, inw(base) & 0xff,
665 tty_flip_buffer_push(&port->port);
676 struct isi_port *port = tty->driver_data;
677 struct isi_board *card = port->card;
680 u16 channel_setup, channel = port->channel,
707 if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
709 if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
711 if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
713 if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
718 drop_dtr(port);
721 raise_dtr(port);
752 tty_port_set_check_carrier(&port->port, !C_CLOCAL(tty));
756 tty_port_set_cts_flow(&port->port, C_CRTSCTS(tty));
771 /* rx enabled -> enable port for rx on the card */
783 struct isi_port *port;
787 port = bp->ports;
788 for (channel = 0; channel < bp->port_count; channel++, port++)
789 drop_dtr_rts(port);
799 struct isi_port *port = container_of(tport, struct isi_port, port);
800 struct isi_board *card = port->card;
809 port->xmit_cnt = port->xmit_head = port->xmit_tail = 0;
813 outw(0x8000 | (port->channel << card->shift_count) | 0x02,
824 static int isicom_carrier_raised(struct tty_port *port)
826 struct isi_port *ip = container_of(port, struct isi_port, port);
832 struct isi_port *port;
843 /* open on a port greater than the port count for the card !!! */
847 port = &isi_ports[line];
848 if (isicom_paranoia_check(port, tty->name, "isicom_open"))
851 return &port->port;
856 struct isi_port *port;
862 port = container_of(tport, struct isi_port, port);
864 tty->driver_data = port;
871 static void isicom_shutdown_port(struct isi_port *port)
873 struct isi_board *card = port->card;
880 /* last port was closed, shutdown that board too */
887 struct isi_port *port = tty->driver_data;
888 struct isi_board *card = port->card;
891 if (isicom_paranoia_check(port, tty->name, "isicom_flush_buffer"))
895 port->xmit_cnt = port->xmit_head = port->xmit_tail = 0;
901 static void isicom_shutdown(struct tty_port *port)
903 struct isi_port *ip = container_of(port, struct isi_port, port);
908 on this port */
914 tty_port_free_xmit_buf(port);
920 struct tty_port *port;
925 port = &ip->port;
928 tty_port_close(port, tty, filp);
935 struct isi_port *port = tty->driver_data;
936 struct isi_board *card = port->card;
940 if (isicom_paranoia_check(port, tty->name, "isicom_write"))
946 cnt = min_t(int, count, min(SERIAL_XMIT_SIZE - port->xmit_cnt
947 - 1, SERIAL_XMIT_SIZE - port->xmit_head));
951 memcpy(port->port.xmit_buf + port->xmit_head, buf, cnt);
952 port->xmit_head = (port->xmit_head + cnt) & (SERIAL_XMIT_SIZE
954 port->xmit_cnt += cnt;
959 if (port->xmit_cnt && !tty->stopped && !tty->hw_stopped)
960 port->status |= ISI_TXOK;
968 struct isi_port *port = tty->driver_data;
969 struct isi_board *card = port->card;
972 if (isicom_paranoia_check(port, tty->name, "isicom_put_char"))
976 if (port->xmit_cnt >= SERIAL_XMIT_SIZE - 1) {
981 port->port.xmit_buf[port->xmit_head++] = ch;
982 port->xmit_head &= (SERIAL_XMIT_SIZE - 1);
983 port->xmit_cnt++;
991 struct isi_port *port = tty->driver_data;
993 if (isicom_paranoia_check(port, tty->name, "isicom_flush_chars"))
996 if (port->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped ||
997 !port->port.xmit_buf)
1000 /* this tells the transmitter to consider this port for
1002 port->status |= ISI_TXOK;
1008 struct isi_port *port = tty->driver_data;
1011 if (isicom_paranoia_check(port, tty->name, "isicom_write_room"))
1014 free = SERIAL_XMIT_SIZE - port->xmit_cnt - 1;
1023 struct isi_port *port = tty->driver_data;
1024 if (isicom_paranoia_check(port, tty->name, "isicom_chars_in_buffer"))
1026 return port->xmit_cnt;
1032 struct isi_port *port = tty->driver_data;
1033 struct isi_board *card = port->card;
1042 outw(0x8000 | ((port->channel) << (card->shift_count)) | 0x3, base);
1053 struct isi_port *port = tty->driver_data;
1054 /* just send the port status */
1055 u16 status = port->status;
1057 if (isicom_paranoia_check(port, tty->name, "isicom_ioctl"))
1071 struct isi_port *port = tty->driver_data;
1074 if (isicom_paranoia_check(port, tty->name, "isicom_ioctl"))
1077 spin_lock_irqsave(&port->card->card_lock, flags);
1079 raise_rts(port);
1081 raise_dtr(port);
1084 drop_rts(port);
1086 drop_dtr(port);
1087 spin_unlock_irqrestore(&port->card->card_lock, flags);
1095 struct isi_port *port = tty->driver_data;
1098 if (isicom_paranoia_check(port, tty->name, "isicom_ioctl"))
1101 mutex_lock(&port->port.mutex);
1102 reconfig_port = ((port->port.flags & ASYNC_SPD_MASK) !=
1106 if ((ss->close_delay != port->port.close_delay) ||
1107 (ss->closing_wait != port->port.closing_wait) ||
1109 (port->port.flags & ~ASYNC_USR_MASK))) {
1110 mutex_unlock(&port->port.mutex);
1113 port->port.flags = ((port->port.flags & ~ASYNC_USR_MASK) |
1116 port->port.close_delay = ss->close_delay;
1117 port->port.closing_wait = ss->closing_wait;
1118 port->port.flags = ((port->port.flags & ~ASYNC_FLAGS) |
1123 spin_lock_irqsave(&port->card->card_lock, flags);
1125 spin_unlock_irqrestore(&port->card->card_lock, flags);
1127 mutex_unlock(&port->port.mutex);
1134 struct isi_port *port = tty->driver_data;
1136 if (isicom_paranoia_check(port, tty->name, "isicom_ioctl"))
1139 mutex_lock(&port->port.mutex);
1141 ss->line = port - isi_ports;
1142 ss->port = port->card->base;
1143 ss->irq = port->card->irq;
1144 ss->flags = port->port.flags;
1146 ss->close_delay = port->port.close_delay;
1147 ss->closing_wait = port->port.closing_wait;
1148 mutex_unlock(&port->port.mutex);
1156 struct isi_port *port = tty->driver_data;
1159 if (isicom_paranoia_check(port, tty->name, "isicom_set_termios"))
1166 spin_lock_irqsave(&port->card->card_lock, flags);
1168 spin_unlock_irqrestore(&port->card->card_lock, flags);
1179 struct isi_port *port = tty->driver_data;
1180 struct isi_board *card = port->card;
1182 if (isicom_paranoia_check(port, tty->name, "isicom_throttle"))
1185 /* tell the card that this port cannot handle any more data for now */
1186 card->port_status &= ~(1 << port->channel);
1193 struct isi_port *port = tty->driver_data;
1194 struct isi_board *card = port->card;
1196 if (isicom_paranoia_check(port, tty->name, "isicom_unthrottle"))
1199 /* tell the card that this port is ready to accept more data */
1200 card->port_status |= (1 << port->channel);
1207 struct isi_port *port = tty->driver_data;
1209 if (isicom_paranoia_check(port, tty->name, "isicom_stop"))
1212 /* this tells the transmitter not to consider this port for
1214 port->status &= ~ISI_TXOK;
1220 struct isi_port *port = tty->driver_data;
1222 if (isicom_paranoia_check(port, tty->name, "isicom_start"))
1225 /* this tells the transmitter to consider this port for
1227 port->status |= ISI_TXOK;
1232 struct isi_port *port = tty->driver_data;
1234 if (isicom_paranoia_check(port, tty->name, "isicom_hangup"))
1236 tty_port_hangup(&port->port);
1577 struct tty_port *tport = &board->ports[index].port;
1608 tty_port_destroy(&board->ports[i].port);
1621 struct isi_port *port;
1624 port = &isi_ports[idx * 16];
1625 isi_card[idx].ports = port;
1627 for (channel = 0; channel < 16; channel++, port++) {
1628 port->magic = ISICOM_MAGIC;
1629 port->card = &isi_card[idx];
1630 port->channel = channel;
1631 port->status = 0;