Lines Matching refs:edge_port
468 static void handle_new_msr (struct edgeport_port *edge_port, __u8 newMsr);
469 static void handle_new_lsr (struct edgeport_port *edge_port, __u8 lsrData, __u8 lsr, __u8 data);
470 static int send_iosp_ext_cmd (struct edgeport_port *edge_port, __u8 command, __u8 param);
472 static int send_cmd_write_baud_rate (struct edgeport_port *edge_port, int baudRate);
473 static void change_port_settings (struct edgeport_port *edge_port, struct termios *old_termios);
474 static int send_cmd_write_uart_register (struct edgeport_port *edge_port, __u8 regNum, __u8 regVal…
475 static int write_cmd_usb (struct edgeport_port *edge_port, unsigned char *buffer, int writeLength…
476 …c void send_more_port_data (struct edgeport_serial *edge_serial, struct edgeport_port *edge_port);
757 struct edgeport_port *edge_port; in edge_interrupt_callback() local
809 edge_port = (struct edgeport_port *)port->private; in edge_interrupt_callback()
810 if (edge_port->open) { in edge_interrupt_callback()
811 edge_port->txCredits += txCredits; in edge_interrupt_callback()
812 dbg("%s - txcredits for port%d = %d", __FUNCTION__, portNumber, edge_port->txCredits); in edge_interrupt_callback()
815 if (edge_port->port->tty) in edge_interrupt_callback()
816 wake_up_interruptible(&edge_port->port->tty->write_wait); in edge_interrupt_callback()
819 send_more_port_data(edge_serial, edge_port); in edge_interrupt_callback()
888 struct edgeport_port *edge_port = (struct edgeport_port *)urb->context; in edge_bulk_out_data_callback() local
893 if (port_paranoia_check (edge_port->port, __FUNCTION__)) { in edge_bulk_out_data_callback()
901 tty = edge_port->port->tty; in edge_bulk_out_data_callback()
903 if (tty && edge_port->open) { in edge_bulk_out_data_callback()
909 edge_port->write_in_progress = FALSE; in edge_bulk_out_data_callback()
912 send_more_port_data((struct edgeport_serial *)(edge_port->port->serial->private), edge_port); in edge_bulk_out_data_callback()
923 struct edgeport_port *edge_port = (struct edgeport_port *)urb->context; in edge_bulk_out_cmd_callback() local
942 if (port_paranoia_check (edge_port->port, __FUNCTION__)) { in edge_bulk_out_cmd_callback()
952 tty = edge_port->port->tty; in edge_bulk_out_cmd_callback()
955 if (tty && edge_port->open) in edge_bulk_out_cmd_callback()
959 edge_port->commandPending = FALSE; in edge_bulk_out_cmd_callback()
960 wake_up_interruptible(&edge_port->wait_command); in edge_bulk_out_cmd_callback()
976 struct edgeport_port *edge_port = (struct edgeport_port *)port->private; in edge_open() local
987 if (edge_port == NULL) in edge_open()
1041 init_waitqueue_head(&edge_port->wait_open); in edge_open()
1042 init_waitqueue_head(&edge_port->wait_chase); in edge_open()
1043 init_waitqueue_head(&edge_port->delta_msr_wait); in edge_open()
1044 init_waitqueue_head(&edge_port->wait_command); in edge_open()
1047 memset (&(edge_port->icount), 0x00, sizeof(edge_port->icount)); in edge_open()
1050 edge_port->txCredits = 0; /* Can't send any data yet */ in edge_open()
1051 edge_port->shadowMCR = MCR_MASTER_IE; /* Must always set this bit to enable ints! */ in edge_open()
1052 edge_port->chaseResponsePending = FALSE; in edge_open()
1055 edge_port->openPending = TRUE; in edge_open()
1056 edge_port->open = FALSE; in edge_open()
1057 response = send_iosp_ext_cmd (edge_port, IOSP_CMD_OPEN_PORT, 0); in edge_open()
1061 edge_port->openPending = FALSE; in edge_open()
1067 while (timeout && edge_port->openPending == TRUE) { in edge_open()
1068 timeout = interruptible_sleep_on_timeout (&edge_port->wait_open, timeout); in edge_open()
1071 if (edge_port->open == FALSE) { in edge_open()
1074 edge_port->openPending = FALSE; in edge_open()
1079 edge_port->txfifo.head = 0; in edge_open()
1080 edge_port->txfifo.tail = 0; in edge_open()
1081 edge_port->txfifo.count = 0; in edge_open()
1082 edge_port->txfifo.size = edge_port->maxTxCredits; in edge_open()
1083 edge_port->txfifo.fifo = kmalloc (edge_port->maxTxCredits, GFP_KERNEL); in edge_open()
1085 if (!edge_port->txfifo.fifo) { in edge_open()
1092 edge_port->write_urb = usb_alloc_urb (0); in edge_open()
1094 if (!edge_port->write_urb) { in edge_open()
1100 …dbg("%s(%d) - Initialize TX fifo to %d bytes", __FUNCTION__, port->number, edge_port->maxTxCredits… in edge_open()
1118 static void block_until_chase_response(struct edgeport_port *edge_port) in block_until_chase_response() argument
1126 lastCredits = edge_port->txCredits; in block_until_chase_response()
1129 if (edge_port->chaseResponsePending == FALSE) { in block_until_chase_response()
1133 if (edge_port->txCredits == edge_port->maxTxCredits ) { in block_until_chase_response()
1140 interruptible_sleep_on_timeout (&edge_port->wait_chase, timeout); in block_until_chase_response()
1142 if (lastCredits == edge_port->txCredits) { in block_until_chase_response()
1146 edge_port->chaseResponsePending = FALSE; in block_until_chase_response()
1152 dbg("%s - Last %d, Current %d", __FUNCTION__, lastCredits, edge_port->txCredits); in block_until_chase_response()
1169 static void block_until_tx_empty (struct edgeport_port *edge_port) in block_until_tx_empty() argument
1171 struct TxFifo *fifo = &edge_port->txfifo; in block_until_tx_empty()
1187 interruptible_sleep_on_timeout (&edge_port->wait_chase, timeout); in block_until_tx_empty()
1214 struct edgeport_port *edge_port; in edge_close() local
1227 edge_port = (struct edgeport_port *)port->private; in edge_close()
1228 if ((edge_serial == NULL) || (edge_port == NULL)) in edge_close()
1233 block_until_tx_empty(edge_port); in edge_close()
1235 edge_port->closePending = TRUE; in edge_close()
1238 edge_port->chaseResponsePending = TRUE; in edge_close()
1241 status = send_iosp_ext_cmd (edge_port, IOSP_CMD_CHASE_PORT, 0); in edge_close()
1244 block_until_chase_response(edge_port); in edge_close()
1246 edge_port->chaseResponsePending = FALSE; in edge_close()
1251 send_iosp_ext_cmd (edge_port, IOSP_CMD_CLOSE_PORT, 0); in edge_close()
1254 edge_port->closePending = FALSE; in edge_close()
1255 edge_port->open = FALSE; in edge_close()
1256 edge_port->openPending = FALSE; in edge_close()
1258 if (edge_port->write_urb) { in edge_close()
1259 usb_unlink_urb (edge_port->write_urb); in edge_close()
1263 if (edge_port->write_urb) { in edge_close()
1265 if (edge_port->write_urb->transfer_buffer != NULL) { in edge_close()
1266 kfree(edge_port->write_urb->transfer_buffer); in edge_close()
1268 usb_free_urb (edge_port->write_urb); in edge_close()
1270 if (edge_port->txfifo.fifo) { in edge_close()
1271 kfree(edge_port->txfifo.fifo); in edge_close()
1286 struct edgeport_port *edge_port = (struct edgeport_port *)port->private; in edge_write() local
1295 if (edge_port == NULL) in edge_write()
1299 fifo = &edge_port->txfifo; in edge_write()
1302 copySize = min ((unsigned int)count, (edge_port->txCredits - fifo->count)); in edge_write()
1305 port->number, count, edge_port->txCredits - fifo->count, copySize); in edge_write()
1360 send_more_port_data((struct edgeport_serial *)port->serial->private, edge_port); in edge_write()
1362 …dbg("%s wrote %d byte(s) TxCredits %d, Fifo %d", __FUNCTION__, copySize, edge_port->txCredits, fif… in edge_write()
1381 …atic void send_more_port_data(struct edgeport_serial *edge_serial, struct edgeport_port *edge_port) in send_more_port_data() argument
1383 struct TxFifo *fifo = &edge_port->txfifo; in send_more_port_data()
1392 dbg("%s(%d)", __FUNCTION__, edge_port->port->number); in send_more_port_data()
1394 if (edge_port->write_in_progress || in send_more_port_data()
1395 !edge_port->open || in send_more_port_data()
1397 …d) EXIT - fifo %d, PendingWrite = %d", __FUNCTION__, edge_port->port->number, fifo->count, edge_po… in send_more_port_data()
1408 if (edge_port->txCredits < EDGE_FW_GET_TX_CREDITS_SEND_THRESHOLD(edge_port->maxTxCredits)) { in send_more_port_data()
1409 … enough credit - fifo %d TxCredit %d", __FUNCTION__, edge_port->port->number, fifo->count, edge_po… in send_more_port_data()
1414 edge_port->write_in_progress = TRUE; in send_more_port_data()
1417 urb = edge_port->write_urb; in send_more_port_data()
1430 edge_port->write_in_progress = FALSE; in send_more_port_data()
1433 buffer[0] = IOSP_BUILD_DATA_HDR1 (edge_port->port->number - edge_port->port->serial->minor, count); in send_more_port_data()
1434 buffer[1] = IOSP_BUILD_DATA_HDR2 (edge_port->port->number - edge_port->port->serial->minor, count); in send_more_port_data()
1460 buffer, count+2, edge_bulk_out_data_callback, edge_port); in send_more_port_data()
1467 edge_port->txCredits -= count; in send_more_port_data()
1468 edge_port->icount.tx += count; in send_more_port_data()
1474 edge_port->write_in_progress = FALSE; in send_more_port_data()
1477 edge_port->txCredits += count; in send_more_port_data()
1478 edge_port->icount.tx -= count; in send_more_port_data()
1480 …dbg("%s wrote %d byte(s) TxCredit %d, Fifo %d", __FUNCTION__, count, edge_port->txCredits, fifo->c… in send_more_port_data()
1494 struct edgeport_port *edge_port = (struct edgeport_port *)(port->private); in edge_write_room() local
1499 if (edge_port == NULL) in edge_write_room()
1501 if (edge_port->closePending == TRUE) in edge_write_room()
1506 if (!edge_port->open) { in edge_write_room()
1512 room = edge_port->txCredits - edge_port->txfifo.count; in edge_write_room()
1530 struct edgeport_port *edge_port = (struct edgeport_port *)(port->private); in edge_chars_in_buffer() local
1535 if (edge_port == NULL) in edge_chars_in_buffer()
1537 if (edge_port->closePending == TRUE) in edge_chars_in_buffer()
1540 if (!edge_port->open) { in edge_chars_in_buffer()
1545 num_chars = edge_port->maxTxCredits - edge_port->txCredits + edge_port->txfifo.count; in edge_chars_in_buffer()
1561 struct edgeport_port *edge_port = (struct edgeport_port *)(port->private); in edge_throttle() local
1567 if (edge_port == NULL) in edge_throttle()
1570 if (!edge_port->open) { in edge_throttle()
1592 edge_port->shadowMCR &= ~MCR_RTS; in edge_throttle()
1593 status = send_cmd_write_uart_register(edge_port, MCR, edge_port->shadowMCR); in edge_throttle()
1610 struct edgeport_port *edge_port = (struct edgeport_port *)(port->private); in edge_unthrottle() local
1616 if (edge_port == NULL) in edge_unthrottle()
1619 if (!edge_port->open) { in edge_unthrottle()
1641 edge_port->shadowMCR |= MCR_RTS; in edge_unthrottle()
1642 status = send_cmd_write_uart_register(edge_port, MCR, edge_port->shadowMCR); in edge_unthrottle()
1658 struct edgeport_port *edge_port = (struct edgeport_port *)(port->private); in edge_set_termios() local
1688 if (edge_port == NULL) in edge_set_termios()
1691 if (!edge_port->open) { in edge_set_termios()
1697 change_port_settings (edge_port, old_termios); in edge_set_termios()
1713 static int get_lsr_info(struct edgeport_port *edge_port, unsigned int *value) in get_lsr_info() argument
1717 if (edge_port->maxTxCredits == edge_port->txCredits && in get_lsr_info()
1718 edge_port->txfifo.count == 0) { in get_lsr_info()
1728 static int get_number_bytes_avail(struct edgeport_port *edge_port, unsigned int *value) in get_number_bytes_avail() argument
1731 struct tty_struct *tty = edge_port->port->tty; in get_number_bytes_avail()
1738 dbg("%s(%d) = %d", __FUNCTION__, edge_port->port->number, result); in get_number_bytes_avail()
1745 static int set_modem_info(struct edgeport_port *edge_port, unsigned int cmd, unsigned int *value) in set_modem_info() argument
1747 unsigned int mcr = edge_port->shadowMCR; in set_modem_info()
1782 edge_port->shadowMCR = mcr; in set_modem_info()
1784 send_cmd_write_uart_register(edge_port, MCR, edge_port->shadowMCR); in set_modem_info()
1789 static int get_modem_info(struct edgeport_port *edge_port, unsigned int *value) in get_modem_info() argument
1792 unsigned int msr = edge_port->shadowMSR; in get_modem_info()
1793 unsigned int mcr = edge_port->shadowMCR; in get_modem_info()
1812 static int get_serial_info(struct edgeport_port *edge_port, struct serial_struct * retinfo) in get_serial_info() argument
1822 tmp.line = edge_port->port->serial->minor; in get_serial_info()
1823 tmp.port = edge_port->port->number; in get_serial_info()
1826 tmp.xmit_fifo_size = edge_port->maxTxCredits; in get_serial_info()
1848 struct edgeport_port *edge_port = (struct edgeport_port *)(port->private); in edge_ioctl() local
1860 return get_number_bytes_avail(edge_port, (unsigned int *) arg); in edge_ioctl()
1865 return get_lsr_info(edge_port, (unsigned int *) arg); in edge_ioctl()
1872 return set_modem_info(edge_port, cmd, (unsigned int *) arg); in edge_ioctl()
1876 return get_modem_info(edge_port, (unsigned int *) arg); in edge_ioctl()
1880 return get_serial_info(edge_port, (struct serial_struct *) arg); in edge_ioctl()
1888 cprev = edge_port->icount; in edge_ioctl()
1890 interruptible_sleep_on(&edge_port->delta_msr_wait); in edge_ioctl()
1894 cnow = edge_port->icount; in edge_ioctl()
1910 cnow = edge_port->icount; in edge_ioctl()
1940 struct edgeport_port *edge_port = (struct edgeport_port *)(port->private); in edge_break() local
1944 edge_port->chaseResponsePending = TRUE; in edge_break()
1947 status = send_iosp_ext_cmd (edge_port, IOSP_CMD_CHASE_PORT, 0); in edge_break()
1950 block_until_chase_response(edge_port); in edge_break()
1952 edge_port->chaseResponsePending = FALSE; in edge_break()
1957 status = send_iosp_ext_cmd (edge_port, IOSP_CMD_SET_BREAK, 0); in edge_break()
1960 status = send_iosp_ext_cmd (edge_port, IOSP_CMD_CLEAR_BREAK, 0); in edge_break()
1977 struct edgeport_port *edge_port; in process_rcvd_data() local
2073 edge_port = (struct edgeport_port *)port->private; in process_rcvd_data()
2074 if (edge_port->open) { in process_rcvd_data()
2075 tty = edge_port->port->tty; in process_rcvd_data()
2088 edge_port->icount.rx += rxLen; in process_rcvd_data()
2120 struct edgeport_port *edge_port; in process_rcvd_status() local
2128 edge_port = (struct edgeport_port *)port->private; in process_rcvd_status()
2129 if (edge_port == NULL) { in process_rcvd_status()
2146 edge_port->chaseResponsePending = FALSE; in process_rcvd_status()
2147 wake_up_interruptible (&edge_port->wait_chase); in process_rcvd_status()
2158 edge_port->txCredits = GET_TX_BUFFER_SIZE(byte3); in process_rcvd_status()
2159 edge_port->maxTxCredits = edge_port->txCredits; in process_rcvd_status()
2160 …tal MSR = %02x TxBufferSize = %d", __FUNCTION__, edge_serial->rxPort, byte2, edge_port->txCredits); in process_rcvd_status()
2161 handle_new_msr (edge_port, byte2); in process_rcvd_status()
2164 if (edge_port->port->tty) in process_rcvd_status()
2165 change_port_settings (edge_port, edge_port->port->tty->termios); in process_rcvd_status()
2168 edge_port->openPending = FALSE; in process_rcvd_status()
2169 edge_port->open = TRUE; in process_rcvd_status()
2170 wake_up_interruptible(&edge_port->wait_open); in process_rcvd_status()
2177 if ((!edge_port->open ) || (edge_port->closePending)) { in process_rcvd_status()
2185 handle_new_lsr (edge_port, FALSE, byte2, 0); in process_rcvd_status()
2192 handle_new_lsr (edge_port, TRUE, byte2, byte3); in process_rcvd_status()
2205 handle_new_msr(edge_port, byte2); in process_rcvd_status()
2221 static void handle_new_msr(struct edgeport_port *edge_port, __u8 newMsr) in handle_new_msr() argument
2228 icount = &edge_port->icount; in handle_new_msr()
2243 wake_up_interruptible(&edge_port->delta_msr_wait); in handle_new_msr()
2247 edge_port->shadowMSR = newMsr & 0xf0; in handle_new_msr()
2257 static void handle_new_lsr(struct edgeport_port *edge_port, __u8 lsrData, __u8 lsr, __u8 data) in handle_new_lsr() argument
2264 edge_port->shadowLSR = lsr; in handle_new_lsr()
2276 if (lsrData && edge_port->port->tty) { in handle_new_lsr()
2277 tty_insert_flip_char(edge_port->port->tty, data, 0); in handle_new_lsr()
2278 tty_flip_buffer_push(edge_port->port->tty); in handle_new_lsr()
2282 icount = &edge_port->icount; in handle_new_lsr()
2439 static int send_iosp_ext_cmd (struct edgeport_port *edge_port, __u8 command, __u8 param) in send_iosp_ext_cmd() argument
2457 edge_port->port->number - edge_port->port->serial->minor, in send_iosp_ext_cmd()
2460 status = write_cmd_usb (edge_port, buffer, length); in send_iosp_ext_cmd()
2474 static int write_cmd_usb (struct edgeport_port *edge_port, unsigned char *buffer, int length) in write_cmd_usb() argument
2476 struct edgeport_serial *edge_serial = (struct edgeport_serial *)edge_port->port->serial->private; in write_cmd_usb()
2493 buffer, length, edge_bulk_out_cmd_callback, edge_port); in write_cmd_usb()
2498 edge_port->commandPending = TRUE; in write_cmd_usb()
2512 while (timeout && edge_port->commandPending == TRUE) { in write_cmd_usb()
2513 timeout = interruptible_sleep_on_timeout (&edge_port->wait_command, timeout); in write_cmd_usb()
2516 if (edge_port->commandPending == TRUE) { in write_cmd_usb()
2531 static int send_cmd_write_baud_rate (struct edgeport_port *edge_port, int baudRate) in send_cmd_write_baud_rate() argument
2538 unsigned char number = edge_port->port->number - edge_port->port->serial->minor; in send_cmd_write_baud_rate()
2540 dbg("%s - port = %d, baud = %d", __FUNCTION__, edge_port->port->number, baudRate); in send_cmd_write_baud_rate()
2564 MAKE_CMD_WRITE_REG( &currCmd, &cmdLen, number, LCR, edge_port->shadowLCR); in send_cmd_write_baud_rate()
2566 status = write_cmd_usb(edge_port, cmdBuffer, cmdLen ); in send_cmd_write_baud_rate()
2625 static int send_cmd_write_uart_register (struct edgeport_port *edge_port, __u8 regNum, __u8 regValu… in send_cmd_write_uart_register() argument
2644 edge_port->port->number - edge_port->port->serial->minor, in send_cmd_write_uart_register()
2647 status = write_cmd_usb(edge_port, cmdBuffer, cmdLen); in send_cmd_write_uart_register()
2662 static void change_port_settings (struct edgeport_port *edge_port, struct termios *old_termios) in change_port_settings() argument
2675 dbg("%s - port %d", __FUNCTION__, edge_port->port->number); in change_port_settings()
2677 if ((!edge_port->open) && in change_port_settings()
2678 (!edge_port->openPending)) { in change_port_settings()
2683 tty = edge_port->port->tty; in change_port_settings()
2736 send_iosp_ext_cmd (edge_port, IOSP_CMD_SET_XON_CHAR, start_char); in change_port_settings()
2737 send_iosp_ext_cmd (edge_port, IOSP_CMD_SET_XOFF_CHAR, stop_char); in change_port_settings()
2757 send_iosp_ext_cmd (edge_port, IOSP_CMD_SET_RX_FLOW, rxFlow); in change_port_settings()
2758 send_iosp_ext_cmd (edge_port, IOSP_CMD_SET_TX_FLOW, txFlow); in change_port_settings()
2761 edge_port->shadowLCR &= ~(LCR_BITS_MASK | LCR_STOP_MASK | LCR_PAR_MASK); in change_port_settings()
2762 edge_port->shadowLCR |= (lData | lParity | lStop); in change_port_settings()
2764 edge_port->validDataMask = mask; in change_port_settings()
2767 status = send_cmd_write_uart_register(edge_port, LCR, edge_port->shadowLCR); in change_port_settings()
2773 edge_port->shadowMCR = MCR_MASTER_IE; in change_port_settings()
2775 edge_port->shadowMCR |= (MCR_DTR | MCR_RTS); in change_port_settings()
2777 status = send_cmd_write_uart_register(edge_port, MCR, edge_port->shadowMCR); in change_port_settings()
2790 status = send_cmd_write_baud_rate (edge_port, baud); in change_port_settings()
2960 struct edgeport_port *edge_port; in edge_startup() local
3023 edge_port = kmalloc (sizeof(struct edgeport_port), GFP_KERNEL); in edge_startup()
3024 if (edge_port == NULL) { in edge_startup()
3028 memset (edge_port, 0, sizeof(struct edgeport_port)); in edge_startup()
3029 edge_port->port = &serial->port[i]; in edge_startup()
3030 serial->port[i].private = edge_port; in edge_startup()