Lines Matching +full:cts +full:- +full:rts +full:- +full:swap
1 // SPDX-License-Identifier: GPL-2.0
14 * Greg Kroah-Hartman <gregkh@suse.de>
18 * Copyright (C) 2001-2002 Greg Kroah-Hartman <greg@kroah.com>
93 PPF = 2<<5, /* moschip calls this 'CB-FIFO mode */
108 atomic_t shadowDSR; /* updated in int-in callback */
197 struct usb_device *usbdev = serial->dev; in write_mos_reg()
206 dev_err(&usbdev->dev, in write_mos_reg()
219 struct usb_device *usbdev = serial->dev; in read_mos_reg()
230 return -ENOMEM; in read_mos_reg()
237 dev_err(&usbdev->dev, in read_mos_reg()
240 status = -EIO; in read_mos_reg()
254 mos_parport->shadowECR = mode; in mos7715_change_mode()
255 write_mos_reg(mos_parport->serial, dummy, MOS7720_ECR, in mos7715_change_mode()
256 mos_parport->shadowECR); in mos7715_change_mode()
272 struct mos7715_parport *mos_parport = urbtrack->mos_parport; in destroy_urbtracker()
274 usb_free_urb(urbtrack->urb); in destroy_urbtracker()
275 kfree(urbtrack->setup); in destroy_urbtracker()
277 kref_put(&mos_parport->ref_count, destroy_mos_parport); in destroy_urbtracker()
281 * This runs as a tasklet when sending an urb in a non-blocking parallel
296 if (unlikely(mos_parport->serial == NULL)) in send_deferred_urbs()
299 dev = &mos_parport->serial->dev->dev; in send_deferred_urbs()
302 if (!mutex_trylock(&mos_parport->serial->disc_mutex)) { in send_deferred_urbs()
304 tasklet_schedule(&mos_parport->urb_tasklet); in send_deferred_urbs()
309 if (unlikely(mos_parport->serial->disconnected)) { in send_deferred_urbs()
310 mutex_unlock(&mos_parport->serial->disc_mutex); in send_deferred_urbs()
314 spin_lock_irqsave(&mos_parport->listlock, flags); in send_deferred_urbs()
315 if (list_empty(&mos_parport->deferred_urbs)) { in send_deferred_urbs()
316 spin_unlock_irqrestore(&mos_parport->listlock, flags); in send_deferred_urbs()
317 mutex_unlock(&mos_parport->serial->disc_mutex); in send_deferred_urbs()
323 list_for_each_safe(cursor, next, &mos_parport->deferred_urbs) in send_deferred_urbs()
324 list_move_tail(cursor, &mos_parport->active_urbs); in send_deferred_urbs()
325 list_for_each_entry_safe(urbtrack, tmp, &mos_parport->active_urbs, in send_deferred_urbs()
327 ret_val = usb_submit_urb(urbtrack->urb, GFP_ATOMIC); in send_deferred_urbs()
331 list_del(&urbtrack->urblist_entry); in send_deferred_urbs()
332 kref_put(&urbtrack->ref_count, destroy_urbtracker); in send_deferred_urbs()
335 spin_unlock_irqrestore(&mos_parport->listlock, flags); in send_deferred_urbs()
336 mutex_unlock(&mos_parport->serial->disc_mutex); in send_deferred_urbs()
342 struct urbtracker *urbtrack = urb->context; in async_complete()
343 int status = urb->status; in async_complete()
347 dev_dbg(&urb->dev->dev, "%s - nonzero urb status received: %d\n", __func__, status); in async_complete()
350 spin_lock_irqsave(&urbtrack->mos_parport->listlock, flags); in async_complete()
351 list_del(&urbtrack->urblist_entry); in async_complete()
352 spin_unlock_irqrestore(&urbtrack->mos_parport->listlock, flags); in async_complete()
353 kref_put(&urbtrack->ref_count, destroy_urbtracker); in async_complete()
362 struct usb_serial *serial = mos_parport->serial; in write_parport_reg_nonblock()
363 struct usb_device *usbdev = serial->dev; in write_parport_reg_nonblock()
368 return -ENOMEM; in write_parport_reg_nonblock()
370 urbtrack->urb = usb_alloc_urb(0, GFP_ATOMIC); in write_parport_reg_nonblock()
371 if (!urbtrack->urb) { in write_parport_reg_nonblock()
373 return -ENOMEM; in write_parport_reg_nonblock()
375 urbtrack->setup = kmalloc(sizeof(*urbtrack->setup), GFP_ATOMIC); in write_parport_reg_nonblock()
376 if (!urbtrack->setup) { in write_parport_reg_nonblock()
377 usb_free_urb(urbtrack->urb); in write_parport_reg_nonblock()
379 return -ENOMEM; in write_parport_reg_nonblock()
381 urbtrack->setup->bRequestType = (__u8)0x40; in write_parport_reg_nonblock()
382 urbtrack->setup->bRequest = (__u8)0x0e; in write_parport_reg_nonblock()
383 urbtrack->setup->wValue = cpu_to_le16(get_reg_value(reg, dummy)); in write_parport_reg_nonblock()
384 urbtrack->setup->wIndex = cpu_to_le16(get_reg_index(reg)); in write_parport_reg_nonblock()
385 urbtrack->setup->wLength = 0; in write_parport_reg_nonblock()
386 usb_fill_control_urb(urbtrack->urb, usbdev, in write_parport_reg_nonblock()
388 (unsigned char *)urbtrack->setup, in write_parport_reg_nonblock()
390 kref_get(&mos_parport->ref_count); in write_parport_reg_nonblock()
391 urbtrack->mos_parport = mos_parport; in write_parport_reg_nonblock()
392 kref_init(&urbtrack->ref_count); in write_parport_reg_nonblock()
393 INIT_LIST_HEAD(&urbtrack->urblist_entry); in write_parport_reg_nonblock()
399 if (!mutex_trylock(&serial->disc_mutex)) { in write_parport_reg_nonblock()
400 spin_lock_irqsave(&mos_parport->listlock, flags); in write_parport_reg_nonblock()
401 list_add_tail(&urbtrack->urblist_entry, in write_parport_reg_nonblock()
402 &mos_parport->deferred_urbs); in write_parport_reg_nonblock()
403 spin_unlock_irqrestore(&mos_parport->listlock, flags); in write_parport_reg_nonblock()
404 tasklet_schedule(&mos_parport->urb_tasklet); in write_parport_reg_nonblock()
405 dev_dbg(&usbdev->dev, "tasklet scheduled\n"); in write_parport_reg_nonblock()
410 if (serial->disconnected) { in write_parport_reg_nonblock()
411 kref_put(&urbtrack->ref_count, destroy_urbtracker); in write_parport_reg_nonblock()
412 mutex_unlock(&serial->disc_mutex); in write_parport_reg_nonblock()
413 return -ENODEV; in write_parport_reg_nonblock()
417 spin_lock_irqsave(&mos_parport->listlock, flags); in write_parport_reg_nonblock()
418 list_add_tail(&urbtrack->urblist_entry, &mos_parport->active_urbs); in write_parport_reg_nonblock()
419 spin_unlock_irqrestore(&mos_parport->listlock, flags); in write_parport_reg_nonblock()
420 ret_val = usb_submit_urb(urbtrack->urb, GFP_ATOMIC); in write_parport_reg_nonblock()
421 mutex_unlock(&serial->disc_mutex); in write_parport_reg_nonblock()
423 dev_err(&usbdev->dev, in write_parport_reg_nonblock()
425 spin_lock_irqsave(&mos_parport->listlock, flags); in write_parport_reg_nonblock()
426 list_del(&urbtrack->urblist_entry); in write_parport_reg_nonblock()
427 spin_unlock_irqrestore(&mos_parport->listlock, flags); in write_parport_reg_nonblock()
428 kref_put(&urbtrack->ref_count, destroy_urbtracker); in write_parport_reg_nonblock()
451 mos_parport = pp->private_data; in parport_prologue()
455 return -1; in parport_prologue()
457 mos_parport->msg_pending = true; /* synch usb call pending */ in parport_prologue()
458 reinit_completion(&mos_parport->syncmsg_compl); in parport_prologue()
461 mutex_lock(&mos_parport->serial->disc_mutex); in parport_prologue()
462 if (mos_parport->serial->disconnected) { in parport_prologue()
464 mutex_unlock(&mos_parport->serial->disc_mutex); in parport_prologue()
465 mos_parport->msg_pending = false; in parport_prologue()
466 complete(&mos_parport->syncmsg_compl); in parport_prologue()
467 return -1; in parport_prologue()
479 struct mos7715_parport *mos_parport = pp->private_data; in parport_epilogue()
480 mutex_unlock(&mos_parport->serial->disc_mutex); in parport_epilogue()
481 mos_parport->msg_pending = false; in parport_epilogue()
482 complete(&mos_parport->syncmsg_compl); in parport_epilogue()
487 struct mos7715_parport *mos_parport = pp->private_data; in parport_mos7715_write_data()
492 write_mos_reg(mos_parport->serial, dummy, MOS7720_DPR, (__u8)d); in parport_mos7715_write_data()
498 struct mos7715_parport *mos_parport = pp->private_data; in parport_mos7715_read_data()
503 read_mos_reg(mos_parport->serial, dummy, MOS7720_DPR, &d); in parport_mos7715_read_data()
510 struct mos7715_parport *mos_parport = pp->private_data; in parport_mos7715_write_control()
515 data = ((__u8)d & 0x0f) | (mos_parport->shadowDCR & 0xf0); in parport_mos7715_write_control()
516 write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR, data); in parport_mos7715_write_control()
517 mos_parport->shadowDCR = data; in parport_mos7715_write_control()
527 mos_parport = pp->private_data; in parport_mos7715_read_control()
532 dcr = mos_parport->shadowDCR & 0x0f; in parport_mos7715_read_control()
541 struct mos7715_parport *mos_parport = pp->private_data; in parport_mos7715_frob_control()
548 mos_parport->shadowDCR = (mos_parport->shadowDCR & (~mask)) ^ val; in parport_mos7715_frob_control()
549 write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR, in parport_mos7715_frob_control()
550 mos_parport->shadowDCR); in parport_mos7715_frob_control()
551 dcr = mos_parport->shadowDCR & 0x0f; in parport_mos7715_frob_control()
562 mos_parport = pp->private_data; in parport_mos7715_read_status()
567 status = atomic_read(&mos_parport->shadowDSR) & 0xf8; in parport_mos7715_read_status()
582 struct mos7715_parport *mos_parport = pp->private_data; in parport_mos7715_data_forward()
587 mos_parport->shadowDCR &= ~0x20; in parport_mos7715_data_forward()
588 write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR, in parport_mos7715_data_forward()
589 mos_parport->shadowDCR); in parport_mos7715_data_forward()
595 struct mos7715_parport *mos_parport = pp->private_data; in parport_mos7715_data_reverse()
600 mos_parport->shadowDCR |= 0x20; in parport_mos7715_data_reverse()
601 write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR, in parport_mos7715_data_reverse()
602 mos_parport->shadowDCR); in parport_mos7715_data_reverse()
609 s->u.pc.ctr = DCR_INIT_VAL; in parport_mos7715_init_state()
610 s->u.pc.ecr = ECR_INIT_VAL; in parport_mos7715_init_state()
620 mos_parport = pp->private_data; in parport_mos7715_save_state()
625 s->u.pc.ctr = mos_parport->shadowDCR; in parport_mos7715_save_state()
626 s->u.pc.ecr = mos_parport->shadowECR; in parport_mos7715_save_state()
637 mos_parport = pp->private_data; in parport_mos7715_restore_state()
643 mos_parport->shadowDCR); in parport_mos7715_restore_state()
645 mos_parport->shadowECR); in parport_mos7715_restore_state()
654 struct mos7715_parport *mos_parport = pp->private_data; in parport_mos7715_write_compat()
660 retval = usb_bulk_msg(mos_parport->serial->dev, in parport_mos7715_write_compat()
661 usb_sndbulkpipe(mos_parport->serial->dev, 2), in parport_mos7715_write_compat()
666 dev_err(&mos_parport->serial->dev->dev, in parport_mos7715_write_compat()
711 return -ENOMEM; in mos7715_parport_init()
713 mos_parport->msg_pending = false; in mos7715_parport_init()
714 kref_init(&mos_parport->ref_count); in mos7715_parport_init()
715 spin_lock_init(&mos_parport->listlock); in mos7715_parport_init()
716 INIT_LIST_HEAD(&mos_parport->active_urbs); in mos7715_parport_init()
717 INIT_LIST_HEAD(&mos_parport->deferred_urbs); in mos7715_parport_init()
719 mos_parport->serial = serial; in mos7715_parport_init()
720 tasklet_setup(&mos_parport->urb_tasklet, send_deferred_urbs); in mos7715_parport_init()
721 init_completion(&mos_parport->syncmsg_compl); in mos7715_parport_init()
724 write_mos_reg(mos_parport->serial, dummy, MOS7720_PP_REG, (__u8)0x80); in mos7715_parport_init()
725 write_mos_reg(mos_parport->serial, dummy, MOS7720_PP_REG, (__u8)0x00); in mos7715_parport_init()
728 mos_parport->shadowDCR = DCR_INIT_VAL; in mos7715_parport_init()
729 write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR, in mos7715_parport_init()
730 mos_parport->shadowDCR); in mos7715_parport_init()
731 mos_parport->shadowECR = ECR_INIT_VAL; in mos7715_parport_init()
732 write_mos_reg(mos_parport->serial, dummy, MOS7720_ECR, in mos7715_parport_init()
733 mos_parport->shadowECR); in mos7715_parport_init()
736 mos_parport->pp = parport_register_port(0, PARPORT_IRQ_NONE, in mos7715_parport_init()
739 if (mos_parport->pp == NULL) { in mos7715_parport_init()
740 dev_err(&serial->interface->dev, in mos7715_parport_init()
742 kref_put(&mos_parport->ref_count, destroy_mos_parport); in mos7715_parport_init()
743 return -EIO; in mos7715_parport_init()
745 mos_parport->pp->private_data = mos_parport; in mos7715_parport_init()
746 mos_parport->pp->modes = PARPORT_MODE_COMPAT | PARPORT_MODE_PCSPP; in mos7715_parport_init()
747 mos_parport->pp->dev = &serial->interface->dev; in mos7715_parport_init()
748 parport_announce_port(mos_parport->pp); in mos7715_parport_init()
763 int status = urb->status; in mos7720_interrupt_callback()
764 struct device *dev = &urb->dev->dev; in mos7720_interrupt_callback()
773 case -ECONNRESET: in mos7720_interrupt_callback()
774 case -ENOENT: in mos7720_interrupt_callback()
775 case -ESHUTDOWN: in mos7720_interrupt_callback()
777 dev_dbg(dev, "%s - urb shutting down with status: %d\n", __func__, status); in mos7720_interrupt_callback()
780 dev_dbg(dev, "%s - nonzero urb status received: %d\n", __func__, status); in mos7720_interrupt_callback()
784 length = urb->actual_length; in mos7720_interrupt_callback()
785 data = urb->transfer_buffer; in mos7720_interrupt_callback()
790 * Byte 3 -------------- in mos7720_interrupt_callback()
794 * oneukum 2007-03-14 */ in mos7720_interrupt_callback()
810 dev_dbg(dev, "Serial Port 1: Receiver status error or address bit detected in 9-bit mode\n"); in mos7720_interrupt_callback()
822 dev_dbg(dev, "Serial Port 2: Receiver status error or address bit detected in 9-bit mode\n"); in mos7720_interrupt_callback()
836 dev_err(dev, "%s - Error %d submitting control urb\n", __func__, result); in mos7720_interrupt_callback()
848 int status = urb->status; in mos7715_interrupt_callback()
849 struct device *dev = &urb->dev->dev; in mos7715_interrupt_callback()
857 case -ECONNRESET: in mos7715_interrupt_callback()
858 case -ENOENT: in mos7715_interrupt_callback()
859 case -ESHUTDOWN: in mos7715_interrupt_callback()
860 case -ENODEV: in mos7715_interrupt_callback()
862 dev_dbg(dev, "%s - urb shutting down with status: %d\n", __func__, status); in mos7715_interrupt_callback()
865 dev_dbg(dev, "%s - nonzero urb status received: %d\n", __func__, status); in mos7715_interrupt_callback()
869 length = urb->actual_length; in mos7715_interrupt_callback()
870 data = urb->transfer_buffer; in mos7715_interrupt_callback()
887 dev_dbg(dev, "Serial Port: Receiver status error or address bit detected in 9-bit mode\n"); in mos7715_interrupt_callback()
900 struct usb_serial_port *port = urb->context; in mos7715_interrupt_callback()
901 struct mos7715_parport *mos_parport = port->serial->private; in mos7715_interrupt_callback()
904 atomic_set(&mos_parport->shadowDSR, data[2]); in mos7715_interrupt_callback()
911 dev_err(dev, "%s - Error %d submitting control urb\n", __func__, result); in mos7715_interrupt_callback()
924 int status = urb->status; in mos7720_bulk_in_callback()
927 dev_dbg(&urb->dev->dev, "nonzero read bulk status received: %d\n", status); in mos7720_bulk_in_callback()
931 port = urb->context; in mos7720_bulk_in_callback()
933 dev_dbg(&port->dev, "Entering...%s\n", __func__); in mos7720_bulk_in_callback()
935 data = urb->transfer_buffer; in mos7720_bulk_in_callback()
937 if (urb->actual_length) { in mos7720_bulk_in_callback()
938 tty_insert_flip_string(&port->port, data, urb->actual_length); in mos7720_bulk_in_callback()
939 tty_flip_buffer_push(&port->port); in mos7720_bulk_in_callback()
942 if (port->read_urb->status != -EINPROGRESS) { in mos7720_bulk_in_callback()
943 retval = usb_submit_urb(port->read_urb, GFP_ATOMIC); in mos7720_bulk_in_callback()
945 dev_dbg(&port->dev, "usb_submit_urb(read bulk) failed, retval = %d\n", retval); in mos7720_bulk_in_callback()
957 int status = urb->status; in mos7720_bulk_out_data_callback()
960 dev_dbg(&urb->dev->dev, "nonzero write bulk status received:%d\n", status); in mos7720_bulk_out_data_callback()
964 mos7720_port = urb->context; in mos7720_bulk_out_data_callback()
966 dev_dbg(&urb->dev->dev, "NULL mos7720_port pointer\n"); in mos7720_bulk_out_data_callback()
970 if (mos7720_port->open) in mos7720_bulk_out_data_callback()
971 tty_port_tty_wakeup(&mos7720_port->port->port); in mos7720_bulk_out_data_callback()
977 u16 product = le16_to_cpu(serial->dev->descriptor.idProduct); in mos77xx_calc_num_ports()
982 * parallel port, and the second for the serial port. We swap in mos77xx_calc_num_ports()
984 * only registered port structure uses the serial-port in mos77xx_calc_num_ports()
987 swap(epds->bulk_in[0], epds->bulk_in[1]); in mos77xx_calc_num_ports()
988 swap(epds->bulk_out[0], epds->bulk_out[1]); in mos77xx_calc_num_ports()
1007 serial = port->serial; in mos7720_open()
1011 return -ENODEV; in mos7720_open()
1013 usb_clear_halt(serial->dev, port->write_urb->pipe); in mos7720_open()
1014 usb_clear_halt(serial->dev, port->read_urb->pipe); in mos7720_open()
1019 mos7720_port->write_urb_pool[j] = urb; in mos7720_open()
1023 urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE, in mos7720_open()
1025 if (!urb->transfer_buffer) { in mos7720_open()
1026 usb_free_urb(mos7720_port->write_urb_pool[j]); in mos7720_open()
1027 mos7720_port->write_urb_pool[j] = NULL; in mos7720_open()
1034 return -ENOMEM; in mos7720_open()
1036 /* Initialize MCS7720 -- Write Init values to corresponding Registers in mos7720_open()
1050 port_number = port->port_number; in mos7720_open()
1053 dev_dbg(&port->dev, "SS::%p LSR:%x\n", mos7720_port, data); in mos7720_open()
1062 mos7720_port->shadowLCR = 0x03; in mos7720_open()
1064 mos7720_port->shadowLCR); in mos7720_open()
1065 mos7720_port->shadowMCR = 0x0b; in mos7720_open()
1067 mos7720_port->shadowMCR); in mos7720_open()
1071 data = data | (port->port_number + 1); in mos7720_open()
1073 mos7720_port->shadowLCR = 0x83; in mos7720_open()
1075 mos7720_port->shadowLCR); in mos7720_open()
1078 mos7720_port->shadowLCR = 0x03; in mos7720_open()
1080 mos7720_port->shadowLCR); in mos7720_open()
1083 response = usb_submit_urb(port->read_urb, GFP_KERNEL); in mos7720_open()
1085 dev_err(&port->dev, "%s - Error %d submitting read urb\n", in mos7720_open()
1089 mos7720_port->shadowMCR = UART_MCR_OUT2; /* Must set to enable ints! */ in mos7720_open()
1092 mos7720_port->open = 1; in mos7720_open()
1108 struct usb_serial_port *port = tty->driver_data; in mos7720_chars_in_buffer()
1118 if (mos7720_port->write_urb_pool[i] && in mos7720_chars_in_buffer()
1119 mos7720_port->write_urb_pool[i]->status == -EINPROGRESS) in mos7720_chars_in_buffer()
1122 dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars); in mos7720_chars_in_buffer()
1132 serial = port->serial; in mos7720_close()
1139 usb_kill_urb(mos7720_port->write_urb_pool[j]); in mos7720_close()
1143 if (mos7720_port->write_urb_pool[j]) { in mos7720_close()
1144 kfree(mos7720_port->write_urb_pool[j]->transfer_buffer); in mos7720_close()
1145 usb_free_urb(mos7720_port->write_urb_pool[j]); in mos7720_close()
1151 usb_kill_urb(port->write_urb); in mos7720_close()
1152 usb_kill_urb(port->read_urb); in mos7720_close()
1154 write_mos_reg(serial, port->port_number, MOS7720_MCR, 0x00); in mos7720_close()
1155 write_mos_reg(serial, port->port_number, MOS7720_IER, 0x00); in mos7720_close()
1157 mos7720_port->open = 0; in mos7720_close()
1162 struct usb_serial_port *port = tty->driver_data; in mos7720_break()
1167 serial = port->serial; in mos7720_break()
1173 if (break_state == -1) in mos7720_break()
1174 data = mos7720_port->shadowLCR | UART_LCR_SBC; in mos7720_break()
1176 data = mos7720_port->shadowLCR & ~UART_LCR_SBC; in mos7720_break()
1178 mos7720_port->shadowLCR = data; in mos7720_break()
1179 write_mos_reg(serial, port->port_number, MOS7720_LCR, in mos7720_break()
1180 mos7720_port->shadowLCR); in mos7720_break()
1192 struct usb_serial_port *port = tty->driver_data; in mos7720_write_room()
1199 return -ENODEV; in mos7720_write_room()
1203 if (mos7720_port->write_urb_pool[i] && in mos7720_write_room()
1204 mos7720_port->write_urb_pool[i]->status != -EINPROGRESS) in mos7720_write_room()
1208 dev_dbg(&port->dev, "%s - returns %d\n", __func__, room); in mos7720_write_room()
1225 serial = port->serial; in mos7720_write()
1229 return -ENODEV; in mos7720_write()
1235 if (mos7720_port->write_urb_pool[i] && in mos7720_write()
1236 mos7720_port->write_urb_pool[i]->status != -EINPROGRESS) { in mos7720_write()
1237 urb = mos7720_port->write_urb_pool[i]; in mos7720_write()
1238 dev_dbg(&port->dev, "URB:%d\n", i); in mos7720_write()
1244 dev_dbg(&port->dev, "%s - no more free urbs\n", __func__); in mos7720_write()
1248 if (urb->transfer_buffer == NULL) { in mos7720_write()
1249 urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE, in mos7720_write()
1251 if (!urb->transfer_buffer) in mos7720_write()
1256 memcpy(urb->transfer_buffer, current_position, transfer_size); in mos7720_write()
1257 usb_serial_debug_data(&port->dev, __func__, transfer_size, in mos7720_write()
1258 urb->transfer_buffer); in mos7720_write()
1261 usb_fill_bulk_urb(urb, serial->dev, in mos7720_write()
1262 usb_sndbulkpipe(serial->dev, in mos7720_write()
1263 port->bulk_out_endpointAddress), in mos7720_write()
1264 urb->transfer_buffer, transfer_size, in mos7720_write()
1270 dev_err_console(port, "%s - usb_submit_urb(write bulk) failed " in mos7720_write()
1283 struct usb_serial_port *port = tty->driver_data; in mos7720_throttle()
1292 if (!mos7720_port->open) { in mos7720_throttle()
1293 dev_dbg(&port->dev, "%s - port not opened\n", __func__); in mos7720_throttle()
1305 /* if we are implementing RTS/CTS, toggle that line */ in mos7720_throttle()
1307 mos7720_port->shadowMCR &= ~UART_MCR_RTS; in mos7720_throttle()
1308 write_mos_reg(port->serial, port->port_number, MOS7720_MCR, in mos7720_throttle()
1309 mos7720_port->shadowMCR); in mos7720_throttle()
1315 struct usb_serial_port *port = tty->driver_data; in mos7720_unthrottle()
1322 if (!mos7720_port->open) { in mos7720_unthrottle()
1323 dev_dbg(&port->dev, "%s - port not opened\n", __func__); in mos7720_unthrottle()
1335 /* if we are implementing RTS/CTS, toggle that line */ in mos7720_unthrottle()
1337 mos7720_port->shadowMCR |= UART_MCR_RTS; in mos7720_unthrottle()
1338 write_mos_reg(port->serial, port->port_number, MOS7720_MCR, in mos7720_unthrottle()
1339 mos7720_port->shadowMCR); in mos7720_unthrottle()
1352 return -EINVAL; in set_higher_rates()
1354 port = mos7720_port->port; in set_higher_rates()
1355 serial = port->serial; in set_higher_rates()
1360 dev_dbg(&port->dev, "Sending Setting Commands ..........\n"); in set_higher_rates()
1361 port_number = port->port_number; in set_higher_rates()
1366 mos7720_port->shadowMCR = 0x0b; in set_higher_rates()
1368 mos7720_port->shadowMCR); in set_higher_rates()
1381 mos7720_port->shadowMCR = 0x2b; in set_higher_rates()
1383 mos7720_port->shadowMCR); in set_higher_rates()
1388 mos7720_port->shadowLCR = mos7720_port->shadowLCR | UART_LCR_DLAB; in set_higher_rates()
1390 mos7720_port->shadowLCR); in set_higher_rates()
1393 mos7720_port->shadowLCR = mos7720_port->shadowLCR & ~UART_LCR_DLAB; in set_higher_rates()
1395 mos7720_port->shadowLCR); in set_higher_rates()
1441 dev_dbg(&port->dev, "%s - %d\n", __func__, baudrate); in calc_baud_rate_divisor()
1458 round = (__u16)(round1 - (custom * 10)); in calc_baud_rate_divisor()
1463 dev_dbg(&port->dev, "Baud %d = %d\n", baudrate, custom); in calc_baud_rate_divisor()
1467 dev_dbg(&port->dev, "Baud calculation Failed...\n"); in calc_baud_rate_divisor()
1468 return -EINVAL; in calc_baud_rate_divisor()
1486 return -1; in send_cmd_write_baud_rate()
1488 port = mos7720_port->port; in send_cmd_write_baud_rate()
1489 serial = port->serial; in send_cmd_write_baud_rate()
1491 number = port->port_number; in send_cmd_write_baud_rate()
1492 dev_dbg(&port->dev, "%s - baud = %d\n", __func__, baudrate); in send_cmd_write_baud_rate()
1497 dev_err(&port->dev, "%s - bad baud rate\n", __func__); in send_cmd_write_baud_rate()
1502 mos7720_port->shadowLCR = mos7720_port->shadowLCR | UART_LCR_DLAB; in send_cmd_write_baud_rate()
1503 write_mos_reg(serial, number, MOS7720_LCR, mos7720_port->shadowLCR); in send_cmd_write_baud_rate()
1511 mos7720_port->shadowLCR = mos7720_port->shadowLCR & ~UART_LCR_DLAB; in send_cmd_write_baud_rate()
1512 write_mos_reg(serial, number, MOS7720_LCR, mos7720_port->shadowLCR); in send_cmd_write_baud_rate()
1539 port = mos7720_port->port; in change_port_settings()
1540 serial = port->serial; in change_port_settings()
1541 port_number = port->port_number; in change_port_settings()
1543 if (!mos7720_port->open) { in change_port_settings()
1544 dev_dbg(&port->dev, "%s - port not opened\n", __func__); in change_port_settings()
1552 cflag = tty->termios.c_cflag; in change_port_settings()
1577 dev_dbg(&port->dev, "%s - parity = odd\n", __func__); in change_port_settings()
1580 dev_dbg(&port->dev, "%s - parity = even\n", __func__); in change_port_settings()
1584 dev_dbg(&port->dev, "%s - parity = none\n", __func__); in change_port_settings()
1593 dev_dbg(&port->dev, "%s - stop bits = 2\n", __func__); in change_port_settings()
1596 dev_dbg(&port->dev, "%s - stop bits = 1\n", __func__); in change_port_settings()
1604 mos7720_port->shadowLCR &= in change_port_settings()
1606 mos7720_port->shadowLCR |= (lData | lParity | lStop); in change_port_settings()
1616 mos7720_port->shadowLCR); in change_port_settings()
1617 mos7720_port->shadowMCR = 0x0b; in change_port_settings()
1619 mos7720_port->shadowMCR); in change_port_settings()
1622 mos7720_port->shadowMCR = UART_MCR_OUT2; in change_port_settings()
1624 mos7720_port->shadowMCR |= (UART_MCR_DTR | UART_MCR_RTS); in change_port_settings()
1627 mos7720_port->shadowMCR |= (UART_MCR_XONANY); in change_port_settings()
1638 mos7720_port->shadowMCR &= ~(UART_MCR_XONANY); in change_port_settings()
1641 mos7720_port->shadowMCR); in change_port_settings()
1647 dev_dbg(&port->dev, "Picked default baud...\n"); in change_port_settings()
1658 dev_dbg(&port->dev, "%s - baud rate = %d\n", __func__, baud); in change_port_settings()
1667 if (port->read_urb->status != -EINPROGRESS) { in change_port_settings()
1668 status = usb_submit_urb(port->read_urb, GFP_KERNEL); in change_port_settings()
1670 dev_dbg(&port->dev, "usb_submit_urb(read bulk) failed, status = %d\n", status); in change_port_settings()
1690 if (!mos7720_port->open) { in mos7720_set_termios()
1691 dev_dbg(&port->dev, "%s - port not opened\n", __func__); in mos7720_set_termios()
1698 if (port->read_urb->status != -EINPROGRESS) { in mos7720_set_termios()
1699 status = usb_submit_urb(port->read_urb, GFP_KERNEL); in mos7720_set_termios()
1701 dev_dbg(&port->dev, "usb_submit_urb(read bulk) failed, status = %d\n", status); in mos7720_set_termios()
1706 * get_lsr_info - get line status register info
1718 struct usb_serial_port *port = tty->driver_data; in get_lsr_info()
1721 int port_number = port->port_number; in get_lsr_info()
1726 read_mos_reg(port->serial, port_number, MOS7720_LSR, &data); in get_lsr_info()
1729 dev_dbg(&port->dev, "%s -- Empty\n", __func__); in get_lsr_info()
1734 return -EFAULT; in get_lsr_info()
1740 struct usb_serial_port *port = tty->driver_data; in mos7720_tiocmget()
1746 mcr = mos7720_port->shadowMCR; in mos7720_tiocmget()
1747 msr = mos7720_port->shadowMSR; in mos7720_tiocmget()
1762 struct usb_serial_port *port = tty->driver_data; in mos7720_tiocmset()
1766 mcr = mos7720_port->shadowMCR; in mos7720_tiocmset()
1782 mos7720_port->shadowMCR = mcr; in mos7720_tiocmset()
1783 write_mos_reg(port->serial, port->port_number, MOS7720_MCR, in mos7720_tiocmset()
1784 mos7720_port->shadowMCR); in mos7720_tiocmset()
1792 struct usb_serial_port *port = tty->driver_data; in get_serial_info()
1795 ss->type = PORT_16550A; in get_serial_info()
1796 ss->line = mos7720_port->port->minor; in get_serial_info()
1797 ss->port = mos7720_port->port->port_number; in get_serial_info()
1798 ss->irq = 0; in get_serial_info()
1799 ss->xmit_fifo_size = NUM_URBS * URB_TRANSFER_BUFFER_SIZE; in get_serial_info()
1800 ss->baud_base = 9600; in get_serial_info()
1801 ss->close_delay = 5*HZ; in get_serial_info()
1802 ss->closing_wait = 30*HZ; in get_serial_info()
1809 struct usb_serial_port *port = tty->driver_data; in mos7720_ioctl()
1814 return -ENODEV; in mos7720_ioctl()
1818 dev_dbg(&port->dev, "%s TIOCSERGETLSR\n", __func__); in mos7720_ioctl()
1823 return -ENOIOCTLCMD; in mos7720_ioctl()
1833 product = le16_to_cpu(serial->dev->descriptor.idProduct); in mos7720_startup()
1834 dev = serial->dev; in mos7720_startup()
1837 struct urb *urb = serial->port[0]->interrupt_in_urb; in mos7720_startup()
1839 urb->complete = mos7715_interrupt_callback; in mos7720_startup()
1848 ret_val = usb_submit_urb(serial->port[0]->interrupt_in_urb, GFP_KERNEL); in mos7720_startup()
1850 dev_err(&dev->dev, "failed to submit interrupt urb: %d\n", in mos7720_startup()
1856 dev_dbg(&dev->dev, "LSR:%x\n", data); in mos7720_startup()
1863 usb_kill_urb(serial->port[0]->interrupt_in_urb); in mos7720_release()
1868 if (le16_to_cpu(serial->dev->descriptor.idProduct) in mos7720_release()
1877 mos_parport->pp->private_data = NULL; in mos7720_release()
1881 if (mos_parport->msg_pending) in mos7720_release()
1882 wait_for_completion_timeout(&mos_parport->syncmsg_compl, in mos7720_release()
1885 parport_remove_port(mos_parport->pp); in mos7720_release()
1887 mos_parport->serial = NULL; in mos7720_release()
1890 tasklet_kill(&mos_parport->urb_tasklet); in mos7720_release()
1893 spin_lock_irqsave(&mos_parport->listlock, flags); in mos7720_release()
1895 &mos_parport->active_urbs, in mos7720_release()
1897 usb_unlink_urb(urbtrack->urb); in mos7720_release()
1898 spin_unlock_irqrestore(&mos_parport->listlock, flags); in mos7720_release()
1899 parport_del_port(mos_parport->pp); in mos7720_release()
1901 kref_put(&mos_parport->ref_count, destroy_mos_parport); in mos7720_release()
1912 return -ENOMEM; in mos7720_port_probe()
1914 mos7720_port->port = port; in mos7720_port_probe()