Lines Matching +full:port +full:- +full:1
1 // SPDX-License-Identifier: GPL-2.0+
3 * Original driver code supplied by Multi-Tech
6 * 1/9/98 alan@lxorguk.ukuu.org.uk
13 * Rough port to 2.1.x
25 * dumps the Port Count information
32 * when the last port on the card is
52 * ISIHP-4X card
55 * ISI port problem. Now the link
60 * among ISI-PCI cards.
86 * 10/12/03 Ravindra Made to work for Fedora Core 1 of
99 * ftp://ftp.multitech.com/ISI-Cards/
109 * 64-bit verification
181 -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 13, 15, 16, 17, 18, 19, 20, 21
189 unsigned short port_status; /* each bit for each port */
193 spinlock_t card_lock; /* Card wide lock 11/5/00 -sameer */
200 struct tty_port port; member
224 mdelay(1); in WaitTillCardIsFree()
231 unsigned long base = card->base; in lock_card()
235 spin_lock_irqsave(&card->card_lock, card->flags); in lock_card()
238 return 1; in lock_card()
241 spin_unlock_irqrestore(&card->card_lock, card->flags); in lock_card()
244 pr_warn("Failed to lock Card (0x%lx)\n", card->base); in lock_card()
251 spin_unlock_irqrestore(&card->card_lock, card->flags); in unlock_card()
258 /* card->lock HAS to be held */
259 static void raise_dtr(struct isi_port *port) in raise_dtr() argument
261 struct isi_board *card = port->card; in raise_dtr()
262 unsigned long base = card->base; in raise_dtr()
263 u16 channel = port->channel; in raise_dtr()
268 outw(0x8000 | (channel << card->shift_count) | 0x02, base); in raise_dtr()
271 port->status |= ISI_DTR; in raise_dtr()
274 /* card->lock HAS to be held */
275 static void drop_dtr(struct isi_port *port) in drop_dtr() argument
277 struct isi_board *card = port->card; in drop_dtr()
278 unsigned long base = card->base; in drop_dtr()
279 u16 channel = port->channel; in drop_dtr()
284 outw(0x8000 | (channel << card->shift_count) | 0x02, base); in drop_dtr()
287 port->status &= ~ISI_DTR; in drop_dtr()
290 /* card->lock HAS to be held */
291 static inline void raise_rts(struct isi_port *port) in raise_rts() argument
293 struct isi_board *card = port->card; in raise_rts()
294 unsigned long base = card->base; in raise_rts()
295 u16 channel = port->channel; in raise_rts()
300 outw(0x8000 | (channel << card->shift_count) | 0x02, base); in raise_rts()
303 port->status |= ISI_RTS; in raise_rts()
306 /* card->lock HAS to be held */
307 static inline void drop_rts(struct isi_port *port) in drop_rts() argument
309 struct isi_board *card = port->card; in drop_rts()
310 unsigned long base = card->base; in drop_rts()
311 u16 channel = port->channel; in drop_rts()
316 outw(0x8000 | (channel << card->shift_count) | 0x02, base); in drop_rts()
319 port->status &= ~ISI_RTS; in drop_rts()
322 /* card->lock MUST NOT be held */
324 static void isicom_dtr_rts(struct tty_port *port, int on) in isicom_dtr_rts() argument
326 struct isi_port *ip = container_of(port, struct isi_port, port); in isicom_dtr_rts()
327 struct isi_board *card = ip->card; in isicom_dtr_rts()
328 unsigned long base = card->base; in isicom_dtr_rts()
329 u16 channel = ip->channel; in isicom_dtr_rts()
335 outw(0x8000 | (channel << card->shift_count) | 0x02, base); in isicom_dtr_rts()
338 ip->status |= (ISI_DTR | ISI_RTS); in isicom_dtr_rts()
340 outw(0x8000 | (channel << card->shift_count) | 0x02, base); in isicom_dtr_rts()
343 ip->status &= ~(ISI_DTR | ISI_RTS); in isicom_dtr_rts()
348 /* card->lock HAS to be held */
349 static void drop_dtr_rts(struct isi_port *port) in drop_dtr_rts() argument
351 struct isi_board *card = port->card; in drop_dtr_rts()
352 unsigned long base = card->base; in drop_dtr_rts()
353 u16 channel = port->channel; in drop_dtr_rts()
358 outw(0x8000 | (channel << card->shift_count) | 0x02, base); in drop_dtr_rts()
361 port->status &= ~(ISI_RTS | ISI_DTR); in drop_dtr_rts()
369 static inline int __isicom_paranoia_check(struct isi_port const *port, in __isicom_paranoia_check() argument
372 if (!port) { in __isicom_paranoia_check()
375 return 1; in __isicom_paranoia_check()
377 if (port->magic != ISICOM_MAGIC) { in __isicom_paranoia_check()
378 pr_warn("Warning: NULL isicom port for dev %s in %s\n", in __isicom_paranoia_check()
380 return 1; in __isicom_paranoia_check()
397 short count = (BOARD_COUNT-1), card; in isicom_tx()
399 struct isi_port *port; in isicom_tx() local
403 card = (prev_card + 1) & 0x0003; in isicom_tx()
404 while (count-- > 0) { in isicom_tx()
407 card = (card + 1) & 0x0003; in isicom_tx()
415 port = isi_card[card].ports; in isicom_tx()
427 tty = tty_port_tty_get(&port->port); in isicom_tx()
431 for (; count > 0; count--, port++) { in isicom_tx()
432 /* port not active or tx disabled to force flow control */ in isicom_tx()
433 if (!tty_port_initialized(&port->port) || in isicom_tx()
434 !(port->status & ISI_TXOK)) in isicom_tx()
437 txcount = min_t(short, TX_SIZE, port->xmit_cnt); in isicom_tx()
438 if (txcount <= 0 || tty->stopped || tty->hw_stopped) in isicom_tx()
441 if (!(inw(base + 0x02) & (1 << port->channel))) in isicom_tx()
444 pr_debug("txing %d bytes, port%d.\n", in isicom_tx()
445 txcount, port->channel + 1); in isicom_tx()
446 outw((port->channel << isi_card[card].shift_count) | txcount, in isicom_tx()
450 while (1) { in isicom_tx()
452 - port->xmit_tail)); in isicom_tx()
456 wrd |= (port->port.xmit_buf[port->xmit_tail] in isicom_tx()
458 port->xmit_tail = (port->xmit_tail + 1) in isicom_tx()
459 & (SERIAL_XMIT_SIZE - 1); in isicom_tx()
460 port->xmit_cnt--; in isicom_tx()
461 txcount--; in isicom_tx()
462 cnt--; in isicom_tx()
471 word_count = cnt >> 1; in isicom_tx()
472 outsw(base, port->port.xmit_buf+port->xmit_tail, word_count); in isicom_tx()
473 port->xmit_tail = (port->xmit_tail in isicom_tx()
474 + (word_count << 1)) & (SERIAL_XMIT_SIZE - 1); in isicom_tx()
475 txcount -= (word_count << 1); in isicom_tx()
476 port->xmit_cnt -= (word_count << 1); in isicom_tx()
479 wrd = port->port.xmit_buf[port->xmit_tail]; in isicom_tx()
480 port->xmit_tail = (port->xmit_tail + 1) in isicom_tx()
481 & (SERIAL_XMIT_SIZE - 1); in isicom_tx()
482 port->xmit_cnt--; in isicom_tx()
483 txcount--; in isicom_tx()
488 if (port->xmit_cnt <= 0) in isicom_tx()
489 port->status &= ~ISI_TXOK; in isicom_tx()
490 if (port->xmit_cnt <= WAKEUP_CHARS) in isicom_tx()
510 struct isi_port *port; in isicom_interrupt() local
517 if (!card || !(card->status & FIRMWARE_LOADED)) in isicom_interrupt()
520 base = card->base; in isicom_interrupt()
526 spin_lock(&card->card_lock); in isicom_interrupt()
537 channel = (header & 0x7800) >> card->shift_count; in isicom_interrupt()
540 if (channel + 1 > card->port_count) { in isicom_interrupt()
542 __func__, base, channel + 1); in isicom_interrupt()
544 spin_unlock(&card->card_lock); in isicom_interrupt()
547 port = card->ports + channel; in isicom_interrupt()
548 if (!tty_port_initialized(&port->port)) { in isicom_interrupt()
550 spin_unlock(&card->card_lock); in isicom_interrupt()
554 tty = tty_port_tty_get(&port->port); in isicom_interrupt()
556 while (byte_count > 1) { in isicom_interrupt()
558 byte_count -= 2; in isicom_interrupt()
563 spin_unlock(&card->card_lock); in isicom_interrupt()
571 if (tty_port_check_carrier(&port->port)) { in isicom_interrupt()
572 if (port->status & ISI_DCD) { in isicom_interrupt()
575 pr_debug("%s: DCD->low.\n", in isicom_interrupt()
577 port->status &= ~ISI_DCD; in isicom_interrupt()
582 pr_debug("%s: DCD->high.\n", in isicom_interrupt()
584 port->status |= ISI_DCD; in isicom_interrupt()
585 wake_up_interruptible(&port->port.open_wait); in isicom_interrupt()
589 port->status |= ISI_DCD; in isicom_interrupt()
591 port->status &= ~ISI_DCD; in isicom_interrupt()
594 if (tty_port_cts_enabled(&port->port)) { in isicom_interrupt()
595 if (tty->hw_stopped) { in isicom_interrupt()
597 tty->hw_stopped = 0; in isicom_interrupt()
599 port->status |= (ISI_TXOK in isicom_interrupt()
604 tty->hw_stopped = 1; in isicom_interrupt()
606 port->status &= ~(ISI_TXOK | ISI_CTS); in isicom_interrupt()
610 port->status |= ISI_CTS; in isicom_interrupt()
612 port->status &= ~ISI_CTS; in isicom_interrupt()
616 port->status |= ISI_DSR; in isicom_interrupt()
618 port->status &= ~ISI_DSR; in isicom_interrupt()
621 port->status |= ISI_RI; in isicom_interrupt()
623 port->status &= ~ISI_RI; in isicom_interrupt()
627 case 1: /* Received Break !!! */ in isicom_interrupt()
628 tty_insert_flip_char(&port->port, 0, TTY_BREAK); in isicom_interrupt()
629 if (port->port.flags & ASYNC_SAK) in isicom_interrupt()
631 tty_flip_buffer_push(&port->port); in isicom_interrupt()
644 count = tty_prepare_flip_string(&port->port, &rp, in isicom_interrupt()
645 byte_count & ~1); in isicom_interrupt()
648 word_count = count >> 1; in isicom_interrupt()
650 byte_count -= (word_count << 1); in isicom_interrupt()
652 tty_insert_flip_char(&port->port, inw(base) & 0xff, in isicom_interrupt()
654 byte_count -= 2; in isicom_interrupt()
658 __func__, base, channel + 1); in isicom_interrupt()
662 byte_count -= 2; in isicom_interrupt()
665 tty_flip_buffer_push(&port->port); in isicom_interrupt()
668 spin_unlock(&card->card_lock); in isicom_interrupt()
676 struct isi_port *port = tty->driver_data; in isicom_config_port() local
677 struct isi_board *card = port->card; in isicom_config_port()
679 unsigned long base = card->base; in isicom_config_port()
680 u16 channel_setup, channel = port->channel, in isicom_config_port()
681 shift_count = card->shift_count; in isicom_config_port()
694 /* 1,2,3,4 => 57.6, 115.2, 230, 460 kbps resp. */ in isicom_config_port()
695 if (baud < 1 || baud > 4) in isicom_config_port()
696 tty->termios.c_cflag &= ~CBAUDEX; in isicom_config_port()
707 if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) in isicom_config_port()
709 if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) in isicom_config_port()
711 if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) in isicom_config_port()
713 if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) in isicom_config_port()
716 if (linuxb_to_isib[baud] == -1) { in isicom_config_port()
718 drop_dtr(port); in isicom_config_port()
721 raise_dtr(port); in isicom_config_port()
752 tty_port_set_check_carrier(&port->port, !C_CLOCAL(tty)); in isicom_config_port()
756 tty_port_set_cts_flow(&port->port, C_CRTSCTS(tty)); in isicom_config_port()
771 /* rx enabled -> enable port for rx on the card */ in isicom_config_port()
773 card->port_status |= (1 << channel); in isicom_config_port()
774 outw(card->port_status, base + 0x02); in isicom_config_port()
783 struct isi_port *port; in isicom_setup_board() local
785 bp->count++; in isicom_setup_board()
786 if (!(bp->status & BOARD_INIT)) { in isicom_setup_board()
787 port = bp->ports; in isicom_setup_board()
788 for (channel = 0; channel < bp->port_count; channel++, port++) in isicom_setup_board()
789 drop_dtr_rts(port); in isicom_setup_board()
791 bp->status |= BOARD_ACTIVE | BOARD_INIT; in isicom_setup_board()
799 struct isi_port *port = container_of(tport, struct isi_port, port); in isicom_activate() local
800 struct isi_board *card = port->card; in isicom_activate()
804 return -ENOMEM; in isicom_activate()
806 spin_lock_irqsave(&card->card_lock, flags); in isicom_activate()
809 port->xmit_cnt = port->xmit_head = port->xmit_tail = 0; in isicom_activate()
812 if (WaitTillCardIsFree(card->base) == 0) { in isicom_activate()
813 outw(0x8000 | (port->channel << card->shift_count) | 0x02, in isicom_activate()
814 card->base); in isicom_activate()
815 outw(((ISICOM_KILLTX | ISICOM_KILLRX) << 8) | 0x06, card->base); in isicom_activate()
816 InterruptTheCard(card->base); in isicom_activate()
819 spin_unlock_irqrestore(&card->card_lock, flags); in isicom_activate()
824 static int isicom_carrier_raised(struct tty_port *port) in isicom_carrier_raised() argument
826 struct isi_port *ip = container_of(port, struct isi_port, port); in isicom_carrier_raised()
827 return (ip->status & ISI_DCD)?1 : 0; in isicom_carrier_raised()
832 struct isi_port *port; in isicom_find_port() local
835 int line = tty->index; in isicom_find_port()
840 if (!(card->status & FIRMWARE_LOADED)) in isicom_find_port()
843 /* open on a port greater than the port count for the card !!! */ in isicom_find_port()
844 if (line > ((board * 16) + card->port_count - 1)) in isicom_find_port()
847 port = &isi_ports[line]; in isicom_find_port()
848 if (isicom_paranoia_check(port, tty->name, "isicom_open")) in isicom_find_port()
851 return &port->port; in isicom_find_port()
856 struct isi_port *port; in isicom_open() local
861 return -ENODEV; in isicom_open()
862 port = container_of(tport, struct isi_port, port); in isicom_open()
864 tty->driver_data = port; in isicom_open()
870 /* card->lock HAS to be held */
871 static void isicom_shutdown_port(struct isi_port *port) in isicom_shutdown_port() argument
873 struct isi_board *card = port->card; in isicom_shutdown_port()
875 if (--card->count < 0) { in isicom_shutdown_port()
877 __func__, card->base, card->count); in isicom_shutdown_port()
878 card->count = 0; in isicom_shutdown_port()
880 /* last port was closed, shutdown that board too */ in isicom_shutdown_port()
881 if (!card->count) in isicom_shutdown_port()
882 card->status &= BOARD_ACTIVE; in isicom_shutdown_port()
887 struct isi_port *port = tty->driver_data; in isicom_flush_buffer() local
888 struct isi_board *card = port->card; in isicom_flush_buffer()
891 if (isicom_paranoia_check(port, tty->name, "isicom_flush_buffer")) in isicom_flush_buffer()
894 spin_lock_irqsave(&card->card_lock, flags); in isicom_flush_buffer()
895 port->xmit_cnt = port->xmit_head = port->xmit_tail = 0; in isicom_flush_buffer()
896 spin_unlock_irqrestore(&card->card_lock, flags); in isicom_flush_buffer()
901 static void isicom_shutdown(struct tty_port *port) in isicom_shutdown() argument
903 struct isi_port *ip = container_of(port, struct isi_port, port); in isicom_shutdown()
904 struct isi_board *card = ip->card; in isicom_shutdown()
908 on this port */ in isicom_shutdown()
909 spin_lock_irqsave(&card->card_lock, flags); in isicom_shutdown()
910 card->port_status &= ~(1 << ip->channel); in isicom_shutdown()
911 outw(card->port_status, card->base + 0x02); in isicom_shutdown()
913 spin_unlock_irqrestore(&card->card_lock, flags); in isicom_shutdown()
914 tty_port_free_xmit_buf(port); in isicom_shutdown()
919 struct isi_port *ip = tty->driver_data; in isicom_close()
920 struct tty_port *port; in isicom_close() local
925 port = &ip->port; in isicom_close()
926 if (isicom_paranoia_check(ip, tty->name, "isicom_close")) in isicom_close()
928 tty_port_close(port, tty, filp); in isicom_close()
935 struct isi_port *port = tty->driver_data; in isicom_write() local
936 struct isi_board *card = port->card; in isicom_write()
940 if (isicom_paranoia_check(port, tty->name, "isicom_write")) in isicom_write()
943 spin_lock_irqsave(&card->card_lock, flags); in isicom_write()
945 while (1) { in isicom_write()
946 cnt = min_t(int, count, min(SERIAL_XMIT_SIZE - port->xmit_cnt in isicom_write()
947 - 1, SERIAL_XMIT_SIZE - port->xmit_head)); in isicom_write()
951 memcpy(port->port.xmit_buf + port->xmit_head, buf, cnt); in isicom_write()
952 port->xmit_head = (port->xmit_head + cnt) & (SERIAL_XMIT_SIZE in isicom_write()
953 - 1); in isicom_write()
954 port->xmit_cnt += cnt; in isicom_write()
956 count -= cnt; in isicom_write()
959 if (port->xmit_cnt && !tty->stopped && !tty->hw_stopped) in isicom_write()
960 port->status |= ISI_TXOK; in isicom_write()
961 spin_unlock_irqrestore(&card->card_lock, flags); in isicom_write()
968 struct isi_port *port = tty->driver_data; in isicom_put_char() local
969 struct isi_board *card = port->card; in isicom_put_char()
972 if (isicom_paranoia_check(port, tty->name, "isicom_put_char")) in isicom_put_char()
975 spin_lock_irqsave(&card->card_lock, flags); in isicom_put_char()
976 if (port->xmit_cnt >= SERIAL_XMIT_SIZE - 1) { in isicom_put_char()
977 spin_unlock_irqrestore(&card->card_lock, flags); in isicom_put_char()
981 port->port.xmit_buf[port->xmit_head++] = ch; in isicom_put_char()
982 port->xmit_head &= (SERIAL_XMIT_SIZE - 1); in isicom_put_char()
983 port->xmit_cnt++; in isicom_put_char()
984 spin_unlock_irqrestore(&card->card_lock, flags); in isicom_put_char()
985 return 1; in isicom_put_char()
991 struct isi_port *port = tty->driver_data; in isicom_flush_chars() local
993 if (isicom_paranoia_check(port, tty->name, "isicom_flush_chars")) in isicom_flush_chars()
996 if (port->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped || in isicom_flush_chars()
997 !port->port.xmit_buf) in isicom_flush_chars()
1000 /* this tells the transmitter to consider this port for in isicom_flush_chars()
1002 port->status |= ISI_TXOK; in isicom_flush_chars()
1008 struct isi_port *port = tty->driver_data; in isicom_write_room() local
1011 if (isicom_paranoia_check(port, tty->name, "isicom_write_room")) in isicom_write_room()
1014 free = SERIAL_XMIT_SIZE - port->xmit_cnt - 1; in isicom_write_room()
1023 struct isi_port *port = tty->driver_data; in isicom_chars_in_buffer() local
1024 if (isicom_paranoia_check(port, tty->name, "isicom_chars_in_buffer")) in isicom_chars_in_buffer()
1026 return port->xmit_cnt; in isicom_chars_in_buffer()
1032 struct isi_port *port = tty->driver_data; in isicom_send_break() local
1033 struct isi_board *card = port->card; in isicom_send_break()
1034 unsigned long base = card->base; in isicom_send_break()
1036 if (length == -1) in isicom_send_break()
1037 return -EOPNOTSUPP; in isicom_send_break()
1040 return -EINVAL; in isicom_send_break()
1042 outw(0x8000 | ((port->channel) << (card->shift_count)) | 0x3, base); in isicom_send_break()
1053 struct isi_port *port = tty->driver_data; in isicom_tiocmget() local
1054 /* just send the port status */ in isicom_tiocmget()
1055 u16 status = port->status; in isicom_tiocmget()
1057 if (isicom_paranoia_check(port, tty->name, "isicom_ioctl")) in isicom_tiocmget()
1058 return -ENODEV; in isicom_tiocmget()
1071 struct isi_port *port = tty->driver_data; in isicom_tiocmset() local
1074 if (isicom_paranoia_check(port, tty->name, "isicom_ioctl")) in isicom_tiocmset()
1075 return -ENODEV; in isicom_tiocmset()
1077 spin_lock_irqsave(&port->card->card_lock, flags); in isicom_tiocmset()
1079 raise_rts(port); in isicom_tiocmset()
1081 raise_dtr(port); in isicom_tiocmset()
1084 drop_rts(port); in isicom_tiocmset()
1086 drop_dtr(port); in isicom_tiocmset()
1087 spin_unlock_irqrestore(&port->card->card_lock, flags); in isicom_tiocmset()
1095 struct isi_port *port = tty->driver_data; in isicom_set_serial_info() local
1098 if (isicom_paranoia_check(port, tty->name, "isicom_ioctl")) in isicom_set_serial_info()
1099 return -ENODEV; in isicom_set_serial_info()
1101 mutex_lock(&port->port.mutex); in isicom_set_serial_info()
1102 reconfig_port = ((port->port.flags & ASYNC_SPD_MASK) != in isicom_set_serial_info()
1103 (ss->flags & ASYNC_SPD_MASK)); in isicom_set_serial_info()
1106 if ((ss->close_delay != port->port.close_delay) || in isicom_set_serial_info()
1107 (ss->closing_wait != port->port.closing_wait) || in isicom_set_serial_info()
1108 ((ss->flags & ~ASYNC_USR_MASK) != in isicom_set_serial_info()
1109 (port->port.flags & ~ASYNC_USR_MASK))) { in isicom_set_serial_info()
1110 mutex_unlock(&port->port.mutex); in isicom_set_serial_info()
1111 return -EPERM; in isicom_set_serial_info()
1113 port->port.flags = ((port->port.flags & ~ASYNC_USR_MASK) | in isicom_set_serial_info()
1114 (ss->flags & ASYNC_USR_MASK)); in isicom_set_serial_info()
1116 port->port.close_delay = ss->close_delay; in isicom_set_serial_info()
1117 port->port.closing_wait = ss->closing_wait; in isicom_set_serial_info()
1118 port->port.flags = ((port->port.flags & ~ASYNC_FLAGS) | in isicom_set_serial_info()
1119 (ss->flags & ASYNC_FLAGS)); in isicom_set_serial_info()
1123 spin_lock_irqsave(&port->card->card_lock, flags); in isicom_set_serial_info()
1125 spin_unlock_irqrestore(&port->card->card_lock, flags); in isicom_set_serial_info()
1127 mutex_unlock(&port->port.mutex); in isicom_set_serial_info()
1134 struct isi_port *port = tty->driver_data; in isicom_get_serial_info() local
1136 if (isicom_paranoia_check(port, tty->name, "isicom_ioctl")) in isicom_get_serial_info()
1137 return -ENODEV; in isicom_get_serial_info()
1139 mutex_lock(&port->port.mutex); in isicom_get_serial_info()
1140 /* ss->type = ? */ in isicom_get_serial_info()
1141 ss->line = port - isi_ports; in isicom_get_serial_info()
1142 ss->port = port->card->base; in isicom_get_serial_info()
1143 ss->irq = port->card->irq; in isicom_get_serial_info()
1144 ss->flags = port->port.flags; in isicom_get_serial_info()
1145 /* ss->baud_base = ? */ in isicom_get_serial_info()
1146 ss->close_delay = port->port.close_delay; in isicom_get_serial_info()
1147 ss->closing_wait = port->port.closing_wait; in isicom_get_serial_info()
1148 mutex_unlock(&port->port.mutex); in isicom_get_serial_info()
1156 struct isi_port *port = tty->driver_data; in isicom_set_termios() local
1159 if (isicom_paranoia_check(port, tty->name, "isicom_set_termios")) in isicom_set_termios()
1162 if (tty->termios.c_cflag == old_termios->c_cflag && in isicom_set_termios()
1163 tty->termios.c_iflag == old_termios->c_iflag) in isicom_set_termios()
1166 spin_lock_irqsave(&port->card->card_lock, flags); in isicom_set_termios()
1168 spin_unlock_irqrestore(&port->card->card_lock, flags); in isicom_set_termios()
1170 if ((old_termios->c_cflag & CRTSCTS) && !C_CRTSCTS(tty)) { in isicom_set_termios()
1171 tty->hw_stopped = 0; in isicom_set_termios()
1179 struct isi_port *port = tty->driver_data; in isicom_throttle() local
1180 struct isi_board *card = port->card; in isicom_throttle()
1182 if (isicom_paranoia_check(port, tty->name, "isicom_throttle")) in isicom_throttle()
1185 /* tell the card that this port cannot handle any more data for now */ in isicom_throttle()
1186 card->port_status &= ~(1 << port->channel); in isicom_throttle()
1187 outw(card->port_status, card->base + 0x02); in isicom_throttle()
1193 struct isi_port *port = tty->driver_data; in isicom_unthrottle() local
1194 struct isi_board *card = port->card; in isicom_unthrottle()
1196 if (isicom_paranoia_check(port, tty->name, "isicom_unthrottle")) in isicom_unthrottle()
1199 /* tell the card that this port is ready to accept more data */ in isicom_unthrottle()
1200 card->port_status |= (1 << port->channel); in isicom_unthrottle()
1201 outw(card->port_status, card->base + 0x02); in isicom_unthrottle()
1207 struct isi_port *port = tty->driver_data; in isicom_stop() local
1209 if (isicom_paranoia_check(port, tty->name, "isicom_stop")) in isicom_stop()
1212 /* this tells the transmitter not to consider this port for in isicom_stop()
1214 port->status &= ~ISI_TXOK; in isicom_stop()
1220 struct isi_port *port = tty->driver_data; in isicom_start() local
1222 if (isicom_paranoia_check(port, tty->name, "isicom_start")) in isicom_start()
1225 /* this tells the transmitter to consider this port for in isicom_start()
1227 port->status |= ISI_TXOK; in isicom_start()
1232 struct isi_port *port = tty->driver_data; in isicom_hangup() local
1234 if (isicom_paranoia_check(port, tty->name, "isicom_hangup")) in isicom_hangup()
1236 tty_port_hangup(&port->port); in isicom_hangup()
1277 unsigned long base = board->base; in reset_card()
1281 dev_dbg(&pdev->dev, "ISILoad:Resetting Card%d at 0x%lx\n", card + 1, in reset_card()
1296 dev_warn(&pdev->dev, "ISILoad:Card%u reset failure (Possible " in reset_card()
1297 "bad I/O Port Address 0x%lx).\n", card + 1, base); in reset_card()
1298 dev_dbg(&pdev->dev, "Sig=0x%x\n", sig); in reset_card()
1299 retval = -EIO; in reset_card()
1308 dev_err(&pdev->dev, "ISILoad:PCI Card%d reset failure.\n", in reset_card()
1309 card + 1); in reset_card()
1310 retval = -EIO; in reset_card()
1318 board->port_count = (portcount == 4) ? 4 : 8; in reset_card()
1319 board->shift_count = 12; in reset_card()
1323 board->port_count = 16; in reset_card()
1324 board->shift_count = 11; in reset_card()
1327 dev_info(&pdev->dev, "-Done\n"); in reset_card()
1339 unsigned long base = board->base; in load_firmware()
1342 int retval = -EIO; in load_firmware()
1369 dev_err(&pdev->dev, "Unknown signature.\n"); in load_firmware()
1373 retval = request_firmware(&fw, name, &pdev->dev); in load_firmware()
1377 retval = -EIO; in load_firmware()
1379 for (frame = (struct stframe *)fw->data; in load_firmware()
1380 frame < (struct stframe *)(fw->data + fw->size); in load_firmware()
1381 frame = (struct stframe *)((u8 *)(frame + 1) + in load_firmware()
1382 frame->count)) { in load_firmware()
1388 outw(frame->addr, base); /* lsb of address */ in load_firmware()
1390 word_count = frame->count / 2 + frame->count % 2; in load_firmware()
1401 dev_warn(&pdev->dev, "Card%d rejected load header:\n" in load_firmware()
1405 index + 1, frame->addr, frame->count, status); in load_firmware()
1408 outsw(base, frame->data, word_count); in load_firmware()
1419 dev_err(&pdev->dev, "Card%d got out of sync.Card " in load_firmware()
1420 "Status:0x%x\n", index + 1, status); in load_firmware()
1427 for (frame = (struct stframe *)fw->data; in load_firmware()
1428 frame < (struct stframe *)(fw->data + fw->size); in load_firmware()
1429 frame = (struct stframe *)((u8 *)(frame + 1) + in load_firmware()
1430 frame->count)) { in load_firmware()
1436 outw(frame->addr, base); /* lsb of address */ in load_firmware()
1438 word_count = (frame->count >> 1) + frame->count % 2; in load_firmware()
1439 outw(word_count + 1, base); in load_firmware()
1449 dev_warn(&pdev->dev, "Card%d rejected verify header:\n" in load_firmware()
1453 index + 1, frame->addr, frame->count, status); in load_firmware()
1459 dev_err(&pdev->dev, "Card%d, firmware upload " in load_firmware()
1460 "failed, not enough memory\n", index + 1); in load_firmware()
1467 for (a = 0; a < frame->count; a++) in load_firmware()
1468 if (data[a] != frame->data[a]) { in load_firmware()
1470 dev_err(&pdev->dev, "Card%d, firmware upload " in load_firmware()
1471 "failed\n", index + 1); in load_firmware()
1483 dev_err(&pdev->dev, "Card%d verify got out of sync. " in load_firmware()
1484 "Card Status:0x%x\n", index + 1, status); in load_firmware()
1500 board->status |= FIRMWARE_LOADED; in load_firmware()
1518 int retval = -EPERM; in isicom_probe()
1526 dev_err(&pdev->dev, "failed to enable\n"); in isicom_probe()
1530 dev_info(&pdev->dev, "ISI PCI Card(Device ID 0x%x)\n", ent->device); in isicom_probe()
1540 retval = -ENODEV; in isicom_probe()
1544 board->index = index; in isicom_probe()
1545 board->base = pci_resource_start(pdev, 3); in isicom_probe()
1546 board->irq = pdev->irq; in isicom_probe()
1553 dev_err(&pdev->dev, "I/O Region 0x%lx-0x%lx is busy. Card%d " in isicom_probe()
1554 "will be disabled.\n", board->base, board->base + 15, in isicom_probe()
1555 index + 1); in isicom_probe()
1556 retval = -EBUSY; in isicom_probe()
1560 retval = request_irq(board->irq, isicom_interrupt, in isicom_probe()
1563 dev_err(&pdev->dev, "Could not install handler at Irq %d. " in isicom_probe()
1564 "Card%d will be disabled.\n", board->irq, index + 1); in isicom_probe()
1576 for (index = 0; index < board->port_count; index++) { in isicom_probe()
1577 struct tty_port *tport = &board->ports[index].port; in isicom_probe()
1579 tport->ops = &isicom_port_ops; in isicom_probe()
1580 tport->close_delay = 50 * HZ/100; in isicom_probe()
1581 tport->closing_wait = 3000 * HZ/100; in isicom_probe()
1583 board->index * 16 + index, &pdev->dev); in isicom_probe()
1589 free_irq(board->irq, board); in isicom_probe()
1593 board->base = 0; in isicom_probe()
1594 card_count--; in isicom_probe()
1606 for (i = 0; i < board->port_count; i++) { in isicom_remove()
1607 tty_unregister_device(isicom_normal, board->index * 16 + i); in isicom_remove()
1608 tty_port_destroy(&board->ports[i].port); in isicom_remove()
1611 free_irq(board->irq, board); in isicom_remove()
1613 board->base = 0; in isicom_remove()
1614 card_count--; in isicom_remove()
1621 struct isi_port *port; in isicom_init() local
1624 port = &isi_ports[idx * 16]; in isicom_init()
1625 isi_card[idx].ports = port; in isicom_init()
1627 for (channel = 0; channel < 16; channel++, port++) { in isicom_init()
1628 port->magic = ISICOM_MAGIC; in isicom_init()
1629 port->card = &isi_card[idx]; in isicom_init()
1630 port->channel = channel; in isicom_init()
1631 port->status = 0; in isicom_init()
1641 retval = -ENOMEM; in isicom_init()
1645 isicom_normal->name = "ttyM"; in isicom_init()
1646 isicom_normal->major = ISICOM_NMAJOR; in isicom_init()
1647 isicom_normal->minor_start = 0; in isicom_init()
1648 isicom_normal->type = TTY_DRIVER_TYPE_SERIAL; in isicom_init()
1649 isicom_normal->subtype = SERIAL_TYPE_NORMAL; in isicom_init()
1650 isicom_normal->init_termios = tty_std_termios; in isicom_init()
1651 isicom_normal->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | in isicom_init()
1653 isicom_normal->flags = TTY_DRIVER_REAL_RAW | in isicom_init()
1669 mod_timer(&tx, jiffies + 1); in isicom_init()