Lines Matching refs:mos7840_port
335 struct moschip_port *mos7840_port) in mos7840_dump_serial_port() argument
338 dev_dbg(&port->dev, "SpRegOffset is %2x\n", mos7840_port->SpRegOffset); in mos7840_dump_serial_port()
339 dev_dbg(&port->dev, "ControlRegOffset is %2x\n", mos7840_port->ControlRegOffset); in mos7840_dump_serial_port()
340 dev_dbg(&port->dev, "DCRRegOffset is %2x\n", mos7840_port->DcrRegOffset); in mos7840_dump_serial_port()
416 struct moschip_port *mos7840_port = usb_get_serial_port_data(port); in mos7840_led_activity() local
418 if (test_and_set_bit_lock(MOS7840_FLAG_LED_BUSY, &mos7840_port->flags)) in mos7840_led_activity()
421 mos7840_set_led_async(mos7840_port, 0x0301, MODEM_CONTROL_REGISTER); in mos7840_led_activity()
422 mod_timer(&mos7840_port->led_timer1, in mos7840_led_activity()
434 struct moschip_port *mos7840_port = urb->context; in mos7840_bulk_in_callback() local
435 struct usb_serial_port *port = mos7840_port->port; in mos7840_bulk_in_callback()
442 mos7840_port->read_urb_busy = false; in mos7840_bulk_in_callback()
450 struct tty_port *tport = &mos7840_port->port->port; in mos7840_bulk_in_callback()
457 if (mos7840_port->has_led) in mos7840_bulk_in_callback()
460 mos7840_port->read_urb_busy = true; in mos7840_bulk_in_callback()
461 retval = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); in mos7840_bulk_in_callback()
465 mos7840_port->read_urb_busy = false; in mos7840_bulk_in_callback()
477 struct moschip_port *mos7840_port = urb->context; in mos7840_bulk_out_data_callback() local
478 struct usb_serial_port *port = mos7840_port->port; in mos7840_bulk_out_data_callback()
483 spin_lock_irqsave(&mos7840_port->pool_lock, flags); in mos7840_bulk_out_data_callback()
485 if (urb == mos7840_port->write_urb_pool[i]) { in mos7840_bulk_out_data_callback()
486 mos7840_port->busy[i] = 0; in mos7840_bulk_out_data_callback()
490 spin_unlock_irqrestore(&mos7840_port->pool_lock, flags); in mos7840_bulk_out_data_callback()
514 struct moschip_port *mos7840_port = usb_get_serial_port_data(port); in mos7840_open() local
528 mos7840_port->write_urb_pool[j] = urb; in mos7840_open()
536 mos7840_port->write_urb_pool[j] = NULL; in mos7840_open()
556 status = mos7840_get_reg_sync(port, mos7840_port->SpRegOffset, &Data); in mos7840_open()
562 status = mos7840_set_reg_sync(port, mos7840_port->SpRegOffset, Data); in mos7840_open()
569 status = mos7840_set_reg_sync(port, mos7840_port->SpRegOffset, Data); in mos7840_open()
577 status = mos7840_get_reg_sync(port, mos7840_port->ControlRegOffset, in mos7840_open()
586 mos7840_port->ControlRegOffset, Data); in mos7840_open()
619 mos7840_port->shadowLCR = Data; in mos7840_open()
623 mos7840_port->shadowMCR = Data; in mos7840_open()
627 mos7840_port->shadowLCR = Data; in mos7840_open()
643 mos7840_port->shadowLCR = Data; in mos7840_open()
647 status = mos7840_get_reg_sync(port, mos7840_port->SpRegOffset, &Data); in mos7840_open()
650 status = mos7840_set_reg_sync(port, mos7840_port->SpRegOffset, Data); in mos7840_open()
653 status = mos7840_set_reg_sync(port, mos7840_port->SpRegOffset, Data); in mos7840_open()
660 status = mos7840_get_reg_sync(port, mos7840_port->ControlRegOffset, in mos7840_open()
663 status = mos7840_set_reg_sync(port, mos7840_port->ControlRegOffset, in mos7840_open()
668 status = mos7840_get_reg_sync(port, mos7840_port->ControlRegOffset, in mos7840_open()
671 status = mos7840_set_reg_sync(port, mos7840_port->ControlRegOffset, in mos7840_open()
679 dev_dbg(&port->dev, "port's number in the device is %d\n", mos7840_port->port_num); in mos7840_open()
680 mos7840_port->read_urb = port->read_urb; in mos7840_open()
684 usb_fill_bulk_urb(mos7840_port->read_urb, in mos7840_open()
689 mos7840_port->read_urb->transfer_buffer_length, in mos7840_open()
690 mos7840_bulk_in_callback, mos7840_port); in mos7840_open()
692 usb_fill_bulk_urb(mos7840_port->read_urb, in mos7840_open()
697 mos7840_port->read_urb->transfer_buffer_length, in mos7840_open()
698 mos7840_bulk_in_callback, mos7840_port); in mos7840_open()
702 mos7840_port->read_urb_busy = true; in mos7840_open()
703 response = usb_submit_urb(mos7840_port->read_urb, GFP_KERNEL); in mos7840_open()
707 mos7840_port->read_urb_busy = false; in mos7840_open()
712 mos7840_port->shadowMCR = MCR_MASTER_IE; in mos7840_open()
717 urb = mos7840_port->write_urb_pool[j]; in mos7840_open()
736 struct moschip_port *mos7840_port = usb_get_serial_port_data(port); in mos7840_chars_in_buffer() local
741 spin_lock_irqsave(&mos7840_port->pool_lock, flags); in mos7840_chars_in_buffer()
743 if (mos7840_port->busy[i]) { in mos7840_chars_in_buffer()
744 struct urb *urb = mos7840_port->write_urb_pool[i]; in mos7840_chars_in_buffer()
748 spin_unlock_irqrestore(&mos7840_port->pool_lock, flags); in mos7840_chars_in_buffer()
761 struct moschip_port *mos7840_port = usb_get_serial_port_data(port); in mos7840_close() local
766 usb_kill_urb(mos7840_port->write_urb_pool[j]); in mos7840_close()
770 if (mos7840_port->write_urb_pool[j]) { in mos7840_close()
771 kfree(mos7840_port->write_urb_pool[j]->transfer_buffer); in mos7840_close()
772 usb_free_urb(mos7840_port->write_urb_pool[j]); in mos7840_close()
776 usb_kill_urb(mos7840_port->read_urb); in mos7840_close()
777 mos7840_port->read_urb_busy = false; in mos7840_close()
793 struct moschip_port *mos7840_port = usb_get_serial_port_data(port); in mos7840_break() local
797 data = mos7840_port->shadowLCR | LCR_SET_BREAK; in mos7840_break()
799 data = mos7840_port->shadowLCR & ~LCR_SET_BREAK; in mos7840_break()
802 mos7840_port->shadowLCR = data; in mos7840_break()
803 dev_dbg(&port->dev, "%s mos7840_port->shadowLCR is %x\n", __func__, mos7840_port->shadowLCR); in mos7840_break()
805 mos7840_port->shadowLCR); in mos7840_break()
817 struct moschip_port *mos7840_port = usb_get_serial_port_data(port); in mos7840_write_room() local
822 spin_lock_irqsave(&mos7840_port->pool_lock, flags); in mos7840_write_room()
824 if (!mos7840_port->busy[i]) in mos7840_write_room()
827 spin_unlock_irqrestore(&mos7840_port->pool_lock, flags); in mos7840_write_room()
830 dev_dbg(&mos7840_port->port->dev, "%s - returns %u\n", __func__, room); in mos7840_write_room()
846 struct moschip_port *mos7840_port = usb_get_serial_port_data(port); in mos7840_write() local
860 spin_lock_irqsave(&mos7840_port->pool_lock, flags); in mos7840_write()
862 if (!mos7840_port->busy[i]) { in mos7840_write()
863 mos7840_port->busy[i] = 1; in mos7840_write()
864 urb = mos7840_port->write_urb_pool[i]; in mos7840_write()
869 spin_unlock_irqrestore(&mos7840_port->pool_lock, flags); in mos7840_write()
896 mos7840_bulk_out_data_callback, mos7840_port); in mos7840_write()
904 mos7840_bulk_out_data_callback, mos7840_port); in mos7840_write()
909 if (mos7840_port->has_led) in mos7840_write()
916 mos7840_port->busy[i] = 0; in mos7840_write()
939 struct moschip_port *mos7840_port = usb_get_serial_port_data(port); in mos7840_throttle() local
951 mos7840_port->shadowMCR &= ~MCR_RTS; in mos7840_throttle()
953 mos7840_port->shadowMCR); in mos7840_throttle()
968 struct moschip_port *mos7840_port = usb_get_serial_port_data(port); in mos7840_unthrottle() local
981 mos7840_port->shadowMCR |= MCR_RTS; in mos7840_unthrottle()
983 mos7840_port->shadowMCR); in mos7840_unthrottle()
1020 struct moschip_port *mos7840_port = usb_get_serial_port_data(port); in mos7840_tiocmset() local
1025 mcr = mos7840_port->shadowMCR; in mos7840_tiocmset()
1040 mos7840_port->shadowMCR = mcr; in mos7840_tiocmset()
1097 static int mos7840_send_cmd_write_baud_rate(struct moschip_port *mos7840_port, in mos7840_send_cmd_write_baud_rate() argument
1100 struct usb_serial_port *port = mos7840_port->port; in mos7840_send_cmd_write_baud_rate()
1113 mos7840_port->shadowMCR = Data; in mos7840_send_cmd_write_baud_rate()
1126 mos7840_port->shadowMCR = Data; in mos7840_send_cmd_write_baud_rate()
1142 status = mos7840_get_reg_sync(port, mos7840_port->SpRegOffset, in mos7840_send_cmd_write_baud_rate()
1149 status = mos7840_set_reg_sync(port, mos7840_port->SpRegOffset, in mos7840_send_cmd_write_baud_rate()
1162 Data = mos7840_port->shadowLCR | SERIAL_LCR_DLAB; in mos7840_send_cmd_write_baud_rate()
1163 mos7840_port->shadowLCR = Data; in mos7840_send_cmd_write_baud_rate()
1176 Data = mos7840_port->shadowLCR & ~SERIAL_LCR_DLAB; in mos7840_send_cmd_write_baud_rate()
1177 mos7840_port->shadowLCR = Data; in mos7840_send_cmd_write_baud_rate()
1191 struct moschip_port *mos7840_port, in mos7840_change_port_settings() argument
1194 struct usb_serial_port *port = mos7840_port->port; in mos7840_change_port_settings()
1256 mos7840_port->shadowLCR &= in mos7840_change_port_settings()
1258 mos7840_port->shadowLCR |= (lData | lParity | lStop); in mos7840_change_port_settings()
1261 mos7840_port->shadowLCR); in mos7840_change_port_settings()
1273 Data = mos7840_port->shadowLCR; in mos7840_change_port_settings()
1278 mos7840_port->shadowMCR = Data; in mos7840_change_port_settings()
1285 mos7840_port->shadowMCR = MCR_MASTER_IE; in mos7840_change_port_settings()
1287 mos7840_port->shadowMCR |= (MCR_DTR | MCR_RTS); in mos7840_change_port_settings()
1290 mos7840_port->shadowMCR |= (MCR_XON_ANY); in mos7840_change_port_settings()
1292 mos7840_port->shadowMCR &= ~(MCR_XON_ANY); in mos7840_change_port_settings()
1294 Data = mos7840_port->shadowMCR; in mos7840_change_port_settings()
1307 status = mos7840_send_cmd_write_baud_rate(mos7840_port, baud); in mos7840_change_port_settings()
1313 if (!mos7840_port->read_urb_busy) { in mos7840_change_port_settings()
1314 mos7840_port->read_urb_busy = true; in mos7840_change_port_settings()
1315 status = usb_submit_urb(mos7840_port->read_urb, GFP_KERNEL); in mos7840_change_port_settings()
1319 mos7840_port->read_urb_busy = false; in mos7840_change_port_settings()
1323 mos7840_port->shadowLCR); in mos7840_change_port_settings()
1336 struct moschip_port *mos7840_port = usb_get_serial_port_data(port); in mos7840_set_termios() local
1341 mos7840_change_port_settings(tty, mos7840_port, old_termios); in mos7840_set_termios()
1343 if (!mos7840_port->read_urb_busy) { in mos7840_set_termios()
1344 mos7840_port->read_urb_busy = true; in mos7840_set_termios()
1345 status = usb_submit_urb(mos7840_port->read_urb, GFP_KERNEL); in mos7840_set_termios()
1349 mos7840_port->read_urb_busy = false; in mos7840_set_termios()
1536 struct moschip_port *mos7840_port; in mos7840_port_probe() local
1547 mos7840_port = kzalloc(sizeof(struct moschip_port), GFP_KERNEL); in mos7840_port_probe()
1548 if (!mos7840_port) in mos7840_port_probe()
1555 mos7840_port->port = port; in mos7840_port_probe()
1556 spin_lock_init(&mos7840_port->pool_lock); in mos7840_port_probe()
1561 mos7840_port->port_num = pnum + 1; in mos7840_port_probe()
1563 dev_dbg(&port->dev, "mos7840_port->port_num = %d\n", mos7840_port->port_num); in mos7840_port_probe()
1565 if (mos7840_port->port_num == 1) { in mos7840_port_probe()
1566 mos7840_port->SpRegOffset = 0x0; in mos7840_port_probe()
1567 mos7840_port->ControlRegOffset = 0x1; in mos7840_port_probe()
1568 mos7840_port->DcrRegOffset = 0x4; in mos7840_port_probe()
1570 u8 phy_num = mos7840_port->port_num; in mos7840_port_probe()
1576 mos7840_port->SpRegOffset = 0x8 + 2 * (phy_num - 2); in mos7840_port_probe()
1577 mos7840_port->ControlRegOffset = 0x9 + 2 * (phy_num - 2); in mos7840_port_probe()
1578 mos7840_port->DcrRegOffset = 0x16 + 3 * (phy_num - 2); in mos7840_port_probe()
1580 mos7840_dump_serial_port(port, mos7840_port); in mos7840_port_probe()
1581 usb_set_serial_port_data(port, mos7840_port); in mos7840_port_probe()
1585 mos7840_port->ControlRegOffset, &Data); in mos7840_port_probe()
1597 mos7840_port->ControlRegOffset, Data); in mos7840_port_probe()
1608 (__u16) (mos7840_port->DcrRegOffset + 0), Data); in mos7840_port_probe()
1617 (__u16) (mos7840_port->DcrRegOffset + 1), Data); in mos7840_port_probe()
1626 (__u16) (mos7840_port->DcrRegOffset + 2), Data); in mos7840_port_probe()
1660 if ((mos7840_port->port_num != 1) && (serial->num_ports == 2)) { in mos7840_port_probe()
1664 ((__u16)mos7840_port->port_num)), Data); in mos7840_port_probe()
1666 (__u16)(ZLP_REG1 + ((__u16) mos7840_port->port_num))); in mos7840_port_probe()
1676 ((__u16)mos7840_port->port_num) - 0x1), Data); in mos7840_port_probe()
1678 (__u16)(ZLP_REG1 + ((__u16) mos7840_port->port_num) - 0x1)); in mos7840_port_probe()
1687 mos7840_port->has_led = device_flags & MCS_LED; in mos7840_port_probe()
1690 if (mos7840_port->has_led) { in mos7840_port_probe()
1691 mos7840_port->led_urb = usb_alloc_urb(0, GFP_KERNEL); in mos7840_port_probe()
1692 mos7840_port->led_dr = kmalloc(sizeof(*mos7840_port->led_dr), in mos7840_port_probe()
1694 if (!mos7840_port->led_urb || !mos7840_port->led_dr) { in mos7840_port_probe()
1699 timer_setup(&mos7840_port->led_timer1, mos7840_led_off, 0); in mos7840_port_probe()
1700 mos7840_port->led_timer1.expires = in mos7840_port_probe()
1702 timer_setup(&mos7840_port->led_timer2, mos7840_led_flag_off, in mos7840_port_probe()
1704 mos7840_port->led_timer2.expires = in mos7840_port_probe()
1713 kfree(mos7840_port->led_dr); in mos7840_port_probe()
1714 usb_free_urb(mos7840_port->led_urb); in mos7840_port_probe()
1715 kfree(mos7840_port); in mos7840_port_probe()
1722 struct moschip_port *mos7840_port = usb_get_serial_port_data(port); in mos7840_port_remove() local
1724 if (mos7840_port->has_led) { in mos7840_port_remove()
1728 del_timer_sync(&mos7840_port->led_timer1); in mos7840_port_remove()
1729 del_timer_sync(&mos7840_port->led_timer2); in mos7840_port_remove()
1731 usb_kill_urb(mos7840_port->led_urb); in mos7840_port_remove()
1732 usb_free_urb(mos7840_port->led_urb); in mos7840_port_remove()
1733 kfree(mos7840_port->led_dr); in mos7840_port_remove()
1736 kfree(mos7840_port); in mos7840_port_remove()