• Home
  • Raw
  • Download

Lines Matching refs:edge_port

306 static void handle_new_msr(struct edgeport_port *edge_port, __u8 newMsr);
307 static void handle_new_lsr(struct edgeport_port *edge_port, __u8 lsrData,
309 static int send_iosp_ext_cmd(struct edgeport_port *edge_port, __u8 command,
312 static int send_cmd_write_baud_rate(struct edgeport_port *edge_port,
315 struct edgeport_port *edge_port,
317 static int send_cmd_write_uart_register(struct edgeport_port *edge_port,
319 static int write_cmd_usb(struct edgeport_port *edge_port,
322 struct edgeport_port *edge_port);
647 struct edgeport_port *edge_port; in edge_interrupt_callback() local
718 edge_port = usb_get_serial_port_data(port); in edge_interrupt_callback()
719 if (edge_port && edge_port->open) { in edge_interrupt_callback()
720 spin_lock_irqsave(&edge_port->ep_lock, in edge_interrupt_callback()
722 edge_port->txCredits += txCredits; in edge_interrupt_callback()
723 spin_unlock_irqrestore(&edge_port->ep_lock, in edge_interrupt_callback()
727 edge_port->txCredits); in edge_interrupt_callback()
731 tty_port_tty_wakeup(&edge_port->port->port); in edge_interrupt_callback()
735 edge_port); in edge_interrupt_callback()
820 struct edgeport_port *edge_port = urb->context; in edge_bulk_out_data_callback() local
829 if (edge_port->open) in edge_bulk_out_data_callback()
830 tty_port_tty_wakeup(&edge_port->port->port); in edge_bulk_out_data_callback()
833 edge_port->write_in_progress = false; in edge_bulk_out_data_callback()
837 (usb_get_serial_data(edge_port->port->serial)), edge_port); in edge_bulk_out_data_callback()
848 struct edgeport_port *edge_port = urb->context; in edge_bulk_out_cmd_callback() local
870 if (edge_port->open) in edge_bulk_out_cmd_callback()
871 tty_port_tty_wakeup(&edge_port->port->port); in edge_bulk_out_cmd_callback()
874 edge_port->commandPending = false; in edge_bulk_out_cmd_callback()
875 wake_up(&edge_port->wait_command); in edge_bulk_out_cmd_callback()
891 struct edgeport_port *edge_port = usb_get_serial_port_data(port); in edge_open() local
897 if (edge_port == NULL) in edge_open()
953 init_waitqueue_head(&edge_port->wait_open); in edge_open()
954 init_waitqueue_head(&edge_port->wait_chase); in edge_open()
955 init_waitqueue_head(&edge_port->wait_command); in edge_open()
958 edge_port->txCredits = 0; /* Can't send any data yet */ in edge_open()
960 edge_port->shadowMCR = MCR_MASTER_IE; in edge_open()
961 edge_port->chaseResponsePending = false; in edge_open()
964 edge_port->openPending = true; in edge_open()
965 edge_port->open = false; in edge_open()
966 response = send_iosp_ext_cmd(edge_port, IOSP_CMD_OPEN_PORT, 0); in edge_open()
970 edge_port->openPending = false; in edge_open()
975 wait_event_timeout(edge_port->wait_open, !edge_port->openPending, in edge_open()
978 if (!edge_port->open) { in edge_open()
981 edge_port->openPending = false; in edge_open()
986 edge_port->txfifo.head = 0; in edge_open()
987 edge_port->txfifo.tail = 0; in edge_open()
988 edge_port->txfifo.count = 0; in edge_open()
989 edge_port->txfifo.size = edge_port->maxTxCredits; in edge_open()
990 edge_port->txfifo.fifo = kmalloc(edge_port->maxTxCredits, GFP_KERNEL); in edge_open()
992 if (!edge_port->txfifo.fifo) { in edge_open()
998 edge_port->write_urb = usb_alloc_urb(0, GFP_KERNEL); in edge_open()
999 edge_port->write_in_progress = false; in edge_open()
1001 if (!edge_port->write_urb) { in edge_open()
1007 __func__, edge_port->maxTxCredits); in edge_open()
1023 static void block_until_chase_response(struct edgeport_port *edge_port) in block_until_chase_response() argument
1025 struct device *dev = &edge_port->port->dev; in block_until_chase_response()
1033 lastCredits = edge_port->txCredits; in block_until_chase_response()
1036 if (!edge_port->chaseResponsePending) { in block_until_chase_response()
1040 if (edge_port->txCredits == edge_port->maxTxCredits) { in block_until_chase_response()
1047 prepare_to_wait(&edge_port->wait_chase, &wait, in block_until_chase_response()
1050 finish_wait(&edge_port->wait_chase, &wait); in block_until_chase_response()
1052 if (lastCredits == edge_port->txCredits) { in block_until_chase_response()
1056 edge_port->chaseResponsePending = false; in block_until_chase_response()
1063 lastCredits, edge_port->txCredits); in block_until_chase_response()
1080 static void block_until_tx_empty(struct edgeport_port *edge_port) in block_until_tx_empty() argument
1082 struct device *dev = &edge_port->port->dev; in block_until_tx_empty()
1084 struct TxFifo *fifo = &edge_port->txfifo; in block_until_tx_empty()
1100 prepare_to_wait(&edge_port->wait_chase, &wait, in block_until_tx_empty()
1103 finish_wait(&edge_port->wait_chase, &wait); in block_until_tx_empty()
1129 struct edgeport_port *edge_port; in edge_close() local
1133 edge_port = usb_get_serial_port_data(port); in edge_close()
1134 if (edge_serial == NULL || edge_port == NULL) in edge_close()
1138 block_until_tx_empty(edge_port); in edge_close()
1140 edge_port->closePending = true; in edge_close()
1145 edge_port->chaseResponsePending = true; in edge_close()
1148 status = send_iosp_ext_cmd(edge_port, IOSP_CMD_CHASE_PORT, 0); in edge_close()
1151 block_until_chase_response(edge_port); in edge_close()
1153 edge_port->chaseResponsePending = false; in edge_close()
1160 send_iosp_ext_cmd(edge_port, IOSP_CMD_CLOSE_PORT, 0); in edge_close()
1164 edge_port->closePending = false; in edge_close()
1165 edge_port->open = false; in edge_close()
1166 edge_port->openPending = false; in edge_close()
1168 usb_kill_urb(edge_port->write_urb); in edge_close()
1170 if (edge_port->write_urb) { in edge_close()
1173 kfree(edge_port->write_urb->transfer_buffer); in edge_close()
1174 usb_free_urb(edge_port->write_urb); in edge_close()
1175 edge_port->write_urb = NULL; in edge_close()
1177 kfree(edge_port->txfifo.fifo); in edge_close()
1178 edge_port->txfifo.fifo = NULL; in edge_close()
1191 struct edgeport_port *edge_port = usb_get_serial_port_data(port); in edge_write() local
1199 if (edge_port == NULL) in edge_write()
1203 fifo = &edge_port->txfifo; in edge_write()
1205 spin_lock_irqsave(&edge_port->ep_lock, flags); in edge_write()
1209 (edge_port->txCredits - fifo->count)); in edge_write()
1212 __func__, count, edge_port->txCredits - fifo->count, copySize); in edge_write()
1260 spin_unlock_irqrestore(&edge_port->ep_lock, flags); in edge_write()
1263 usb_get_serial_data(port->serial), edge_port); in edge_write()
1266 __func__, copySize, edge_port->txCredits, fifo->count); in edge_write()
1286 struct edgeport_port *edge_port) in send_more_port_data() argument
1288 struct TxFifo *fifo = &edge_port->txfifo; in send_more_port_data()
1289 struct device *dev = &edge_port->port->dev; in send_more_port_data()
1299 spin_lock_irqsave(&edge_port->ep_lock, flags); in send_more_port_data()
1301 if (edge_port->write_in_progress || in send_more_port_data()
1302 !edge_port->open || in send_more_port_data()
1305 __func__, fifo->count, edge_port->write_in_progress); in send_more_port_data()
1316 …if (edge_port->txCredits < EDGE_FW_GET_TX_CREDITS_SEND_THRESHOLD(edge_port->maxTxCredits, EDGE_FW_… in send_more_port_data()
1318 __func__, fifo->count, edge_port->txCredits); in send_more_port_data()
1323 edge_port->write_in_progress = true; in send_more_port_data()
1326 urb = edge_port->write_urb; in send_more_port_data()
1337 edge_port->write_in_progress = false; in send_more_port_data()
1340 buffer[0] = IOSP_BUILD_DATA_HDR1(edge_port->port->port_number, count); in send_more_port_data()
1341 buffer[1] = IOSP_BUILD_DATA_HDR2(edge_port->port->port_number, count); in send_more_port_data()
1361 usb_serial_debug_data(&edge_port->port->dev, __func__, count, &buffer[2]); in send_more_port_data()
1368 edge_bulk_out_data_callback, edge_port); in send_more_port_data()
1371 edge_port->txCredits -= count; in send_more_port_data()
1372 edge_port->port->icount.tx += count; in send_more_port_data()
1377 dev_err_console(edge_port->port, in send_more_port_data()
1380 edge_port->write_in_progress = false; in send_more_port_data()
1383 edge_port->txCredits += count; in send_more_port_data()
1384 edge_port->port->icount.tx -= count; in send_more_port_data()
1387 __func__, count, edge_port->txCredits, fifo->count); in send_more_port_data()
1390 spin_unlock_irqrestore(&edge_port->ep_lock, flags); in send_more_port_data()
1404 struct edgeport_port *edge_port = usb_get_serial_port_data(port); in edge_write_room() local
1408 if (edge_port == NULL) in edge_write_room()
1410 if (edge_port->closePending) in edge_write_room()
1413 if (!edge_port->open) { in edge_write_room()
1419 spin_lock_irqsave(&edge_port->ep_lock, flags); in edge_write_room()
1420 room = edge_port->txCredits - edge_port->txfifo.count; in edge_write_room()
1421 spin_unlock_irqrestore(&edge_port->ep_lock, flags); in edge_write_room()
1440 struct edgeport_port *edge_port = usb_get_serial_port_data(port); in edge_chars_in_buffer() local
1444 if (edge_port == NULL) in edge_chars_in_buffer()
1446 if (edge_port->closePending) in edge_chars_in_buffer()
1449 if (!edge_port->open) { in edge_chars_in_buffer()
1454 spin_lock_irqsave(&edge_port->ep_lock, flags); in edge_chars_in_buffer()
1455 num_chars = edge_port->maxTxCredits - edge_port->txCredits + in edge_chars_in_buffer()
1456 edge_port->txfifo.count; in edge_chars_in_buffer()
1457 spin_unlock_irqrestore(&edge_port->ep_lock, flags); in edge_chars_in_buffer()
1474 struct edgeport_port *edge_port = usb_get_serial_port_data(port); in edge_throttle() local
1477 if (edge_port == NULL) in edge_throttle()
1480 if (!edge_port->open) { in edge_throttle()
1495 edge_port->shadowMCR &= ~MCR_RTS; in edge_throttle()
1496 status = send_cmd_write_uart_register(edge_port, MCR, in edge_throttle()
1497 edge_port->shadowMCR); in edge_throttle()
1512 struct edgeport_port *edge_port = usb_get_serial_port_data(port); in edge_unthrottle() local
1515 if (edge_port == NULL) in edge_unthrottle()
1518 if (!edge_port->open) { in edge_unthrottle()
1532 edge_port->shadowMCR |= MCR_RTS; in edge_unthrottle()
1533 send_cmd_write_uart_register(edge_port, MCR, in edge_unthrottle()
1534 edge_port->shadowMCR); in edge_unthrottle()
1547 struct edgeport_port *edge_port = usb_get_serial_port_data(port); in edge_set_termios() local
1549 if (edge_port == NULL) in edge_set_termios()
1552 if (!edge_port->open) { in edge_set_termios()
1558 change_port_settings(tty, edge_port, old_termios); in edge_set_termios()
1572 static int get_lsr_info(struct edgeport_port *edge_port, in get_lsr_info() argument
1578 spin_lock_irqsave(&edge_port->ep_lock, flags); in get_lsr_info()
1579 if (edge_port->maxTxCredits == edge_port->txCredits && in get_lsr_info()
1580 edge_port->txfifo.count == 0) { in get_lsr_info()
1581 dev_dbg(&edge_port->port->dev, "%s -- Empty\n", __func__); in get_lsr_info()
1584 spin_unlock_irqrestore(&edge_port->ep_lock, flags); in get_lsr_info()
1595 struct edgeport_port *edge_port = usb_get_serial_port_data(port); in edge_tiocmset() local
1598 mcr = edge_port->shadowMCR; in edge_tiocmset()
1613 edge_port->shadowMCR = mcr; in edge_tiocmset()
1615 send_cmd_write_uart_register(edge_port, MCR, edge_port->shadowMCR); in edge_tiocmset()
1623 struct edgeport_port *edge_port = usb_get_serial_port_data(port); in edge_tiocmget() local
1628 msr = edge_port->shadowMSR; in edge_tiocmget()
1629 mcr = edge_port->shadowMCR; in edge_tiocmget()
1644 struct edgeport_port *edge_port = usb_get_serial_port_data(port); in get_serial_info() local
1647 ss->line = edge_port->port->minor; in get_serial_info()
1648 ss->port = edge_port->port->port_number; in get_serial_info()
1650 ss->xmit_fifo_size = edge_port->maxTxCredits; in get_serial_info()
1666 struct edgeport_port *edge_port = usb_get_serial_port_data(port); in edge_ioctl() local
1671 return get_lsr_info(edge_port, (unsigned int __user *) arg); in edge_ioctl()
1684 struct edgeport_port *edge_port = usb_get_serial_port_data(port); in edge_break() local
1691 edge_port->chaseResponsePending = true; in edge_break()
1694 status = send_iosp_ext_cmd(edge_port, IOSP_CMD_CHASE_PORT, 0); in edge_break()
1697 block_until_chase_response(edge_port); in edge_break()
1699 edge_port->chaseResponsePending = false; in edge_break()
1707 status = send_iosp_ext_cmd(edge_port, in edge_break()
1711 status = send_iosp_ext_cmd(edge_port, in edge_break()
1731 struct edgeport_port *edge_port; in process_rcvd_data() local
1827 edge_port = usb_get_serial_port_data(port); in process_rcvd_data()
1828 if (edge_port && edge_port->open) { in process_rcvd_data()
1832 edge_tty_recv(edge_port->port, buffer, in process_rcvd_data()
1834 edge_port->port->icount.rx += rxLen; in process_rcvd_data()
1866 struct edgeport_port *edge_port; in process_rcvd_status() local
1875 edge_port = usb_get_serial_port_data(port); in process_rcvd_status()
1876 if (edge_port == NULL) { in process_rcvd_status()
1900 edge_port->chaseResponsePending = false; in process_rcvd_status()
1901 wake_up(&edge_port->wait_chase); in process_rcvd_status()
1913 edge_port->txCredits = GET_TX_BUFFER_SIZE(byte3); in process_rcvd_status()
1914 edge_port->maxTxCredits = edge_port->txCredits; in process_rcvd_status()
1916 __func__, edge_serial->rxPort, byte2, edge_port->txCredits); in process_rcvd_status()
1917 handle_new_msr(edge_port, byte2); in process_rcvd_status()
1921 tty = tty_port_tty_get(&edge_port->port->port); in process_rcvd_status()
1924 edge_port, &tty->termios); in process_rcvd_status()
1929 edge_port->openPending = false; in process_rcvd_status()
1930 edge_port->open = true; in process_rcvd_status()
1931 wake_up(&edge_port->wait_open); in process_rcvd_status()
1939 if (!edge_port->open || edge_port->closePending) in process_rcvd_status()
1947 handle_new_lsr(edge_port, false, byte2, 0); in process_rcvd_status()
1955 handle_new_lsr(edge_port, true, byte2, byte3); in process_rcvd_status()
1971 handle_new_msr(edge_port, byte2); in process_rcvd_status()
2006 static void handle_new_msr(struct edgeport_port *edge_port, __u8 newMsr) in handle_new_msr() argument
2012 icount = &edge_port->port->icount; in handle_new_msr()
2023 wake_up_interruptible(&edge_port->port->port.delta_msr_wait); in handle_new_msr()
2027 edge_port->shadowMSR = newMsr & 0xf0; in handle_new_msr()
2035 static void handle_new_lsr(struct edgeport_port *edge_port, __u8 lsrData, in handle_new_lsr() argument
2042 edge_port->shadowLSR = lsr; in handle_new_lsr()
2055 edge_tty_recv(edge_port->port, &data, 1); in handle_new_lsr()
2058 icount = &edge_port->port->icount; in handle_new_lsr()
2211 static int send_iosp_ext_cmd(struct edgeport_port *edge_port, in send_iosp_ext_cmd() argument
2225 MAKE_CMD_EXT_CMD(&currentCommand, &length, edge_port->port->port_number, in send_iosp_ext_cmd()
2228 status = write_cmd_usb(edge_port, buffer, length); in send_iosp_ext_cmd()
2242 static int write_cmd_usb(struct edgeport_port *edge_port, in write_cmd_usb() argument
2246 usb_get_serial_data(edge_port->port->serial); in write_cmd_usb()
2247 struct device *dev = &edge_port->port->dev; in write_cmd_usb()
2265 buffer, length, edge_bulk_out_cmd_callback, edge_port); in write_cmd_usb()
2267 edge_port->commandPending = true; in write_cmd_usb()
2280 wait_event(&edge_port->wait_command, !edge_port->commandPending); in write_cmd_usb()
2282 if (edge_port->commandPending) { in write_cmd_usb()
2297 static int send_cmd_write_baud_rate(struct edgeport_port *edge_port, in send_cmd_write_baud_rate() argument
2301 usb_get_serial_data(edge_port->port->serial); in send_cmd_write_baud_rate()
2302 struct device *dev = &edge_port->port->dev; in send_cmd_write_baud_rate()
2308 u32 number = edge_port->port->port_number; in send_cmd_write_baud_rate()
2341 edge_port->shadowLCR); in send_cmd_write_baud_rate()
2343 status = write_cmd_usb(edge_port, cmdBuffer, cmdLen); in send_cmd_write_baud_rate()
2391 static int send_cmd_write_uart_register(struct edgeport_port *edge_port, in send_cmd_write_uart_register() argument
2395 usb_get_serial_data(edge_port->port->serial); in send_cmd_write_uart_register()
2396 struct device *dev = &edge_port->port->dev; in send_cmd_write_uart_register()
2427 MAKE_CMD_WRITE_REG(&currCmd, &cmdLen, edge_port->port->port_number, in send_cmd_write_uart_register()
2430 status = write_cmd_usb(edge_port, cmdBuffer, cmdLen); in send_cmd_write_uart_register()
2447 struct edgeport_port *edge_port, struct ktermios *old_termios) in change_port_settings() argument
2449 struct device *dev = &edge_port->port->dev; in change_port_settings()
2451 usb_get_serial_data(edge_port->port->serial); in change_port_settings()
2462 if (!edge_port->open && in change_port_settings()
2463 !edge_port->openPending) { in change_port_settings()
2537 send_iosp_ext_cmd(edge_port, in change_port_settings()
2539 send_iosp_ext_cmd(edge_port, in change_port_settings()
2565 send_iosp_ext_cmd(edge_port, IOSP_CMD_SET_RX_FLOW, rxFlow); in change_port_settings()
2568 send_iosp_ext_cmd(edge_port, IOSP_CMD_SET_TX_FLOW, txFlow); in change_port_settings()
2571 edge_port->shadowLCR &= ~(LCR_BITS_MASK | LCR_STOP_MASK | LCR_PAR_MASK); in change_port_settings()
2572 edge_port->shadowLCR |= (lData | lParity | lStop); in change_port_settings()
2574 edge_port->validDataMask = mask; in change_port_settings()
2577 status = send_cmd_write_uart_register(edge_port, LCR, in change_port_settings()
2578 edge_port->shadowLCR); in change_port_settings()
2583 edge_port->shadowMCR = MCR_MASTER_IE; in change_port_settings()
2585 edge_port->shadowMCR |= (MCR_DTR | MCR_RTS); in change_port_settings()
2587 status = send_cmd_write_uart_register(edge_port, MCR, in change_port_settings()
2588 edge_port->shadowMCR); in change_port_settings()
2600 status = send_cmd_write_baud_rate(edge_port, baud); in change_port_settings()
3073 struct edgeport_port *edge_port; in edge_port_probe() local
3075 edge_port = kzalloc(sizeof(*edge_port), GFP_KERNEL); in edge_port_probe()
3076 if (!edge_port) in edge_port_probe()
3079 spin_lock_init(&edge_port->ep_lock); in edge_port_probe()
3080 edge_port->port = port; in edge_port_probe()
3082 usb_set_serial_port_data(port, edge_port); in edge_port_probe()
3089 struct edgeport_port *edge_port; in edge_port_remove() local
3091 edge_port = usb_get_serial_port_data(port); in edge_port_remove()
3092 kfree(edge_port); in edge_port_remove()