Lines Matching full:serial
4 * Controls the Moschip 7720 usb to dual port serial converter
16 * Originally based on drivers/usb/serial/io_edgeport.c which is:
28 #include <linux/serial.h>
31 #include <linux/usb/serial.h>
36 #define DRIVER_DESC "Moschip USB Serial Driver"
55 /* This structure holds all of the local serial port information */
105 struct usb_serial *serial; /* back to containing struct */ member
119 MOS7720_THR, /* serial port regs */
136 MOS7720_SP2_REG, /* serial port 2 (7720 only) */
185 else /* serial port reg */ in get_reg_value()
192 * not specific to a particular serial port.
194 static int write_mos_reg(struct usb_serial *serial, unsigned int serial_portnum, in write_mos_reg() argument
197 struct usb_device *usbdev = serial->dev; in write_mos_reg()
214 * ignored for registers that are not specific to a particular serial port.
216 static int read_mos_reg(struct usb_serial *serial, unsigned int serial_portnum, in read_mos_reg() argument
219 struct usb_device *usbdev = serial->dev; in read_mos_reg()
257 write_mos_reg(mos_parport->serial, dummy, MOS7720_ECR, in mos7715_change_mode()
298 if (unlikely(mos_parport->serial == NULL)) in send_deferred_urbs()
301 dev = &mos_parport->serial->dev->dev; in send_deferred_urbs()
304 if (!mutex_trylock(&mos_parport->serial->disc_mutex)) { in send_deferred_urbs()
311 if (unlikely(mos_parport->serial->disconnected)) { in send_deferred_urbs()
312 mutex_unlock(&mos_parport->serial->disc_mutex); in send_deferred_urbs()
319 mutex_unlock(&mos_parport->serial->disc_mutex); in send_deferred_urbs()
338 mutex_unlock(&mos_parport->serial->disc_mutex); in send_deferred_urbs()
364 struct usb_serial *serial = mos_parport->serial; in write_parport_reg_nonblock() local
365 struct usb_device *usbdev = serial->dev; in write_parport_reg_nonblock()
401 if (!mutex_trylock(&serial->disc_mutex)) { in write_parport_reg_nonblock()
412 if (serial->disconnected) { in write_parport_reg_nonblock()
414 mutex_unlock(&serial->disc_mutex); in write_parport_reg_nonblock()
423 mutex_unlock(&serial->disc_mutex); in write_parport_reg_nonblock()
442 * not called the release function yet because someone has a serial port open.
463 mutex_lock(&mos_parport->serial->disc_mutex); in parport_prologue()
464 if (mos_parport->serial->disconnected) { in parport_prologue()
466 mutex_unlock(&mos_parport->serial->disc_mutex); in parport_prologue()
482 mutex_unlock(&mos_parport->serial->disc_mutex); in parport_epilogue()
494 write_mos_reg(mos_parport->serial, dummy, MOS7720_DPR, (__u8)d); in parport_mos7715_write_data()
505 read_mos_reg(mos_parport->serial, dummy, MOS7720_DPR, &d); in parport_mos7715_read_data()
518 write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR, data); in parport_mos7715_write_control()
551 write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR, in parport_mos7715_frob_control()
590 write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR, in parport_mos7715_data_forward()
603 write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR, in parport_mos7715_data_reverse()
664 retval = usb_bulk_msg(mos_parport->serial->dev, in parport_mos7715_write_compat()
665 usb_sndbulkpipe(mos_parport->serial->dev, 2), in parport_mos7715_write_compat()
670 dev_err(&mos_parport->serial->dev->dev, in parport_mos7715_write_compat()
708 static int mos7715_parport_init(struct usb_serial *serial) in mos7715_parport_init() argument
722 usb_set_serial_data(serial, mos_parport); /* hijack private pointer */ in mos7715_parport_init()
723 mos_parport->serial = serial; in mos7715_parport_init()
728 write_mos_reg(mos_parport->serial, dummy, MOS7720_PP_REG, (__u8)0x80); in mos7715_parport_init()
729 write_mos_reg(mos_parport->serial, dummy, MOS7720_PP_REG, (__u8)0x00); in mos7715_parport_init()
733 write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR, in mos7715_parport_init()
736 write_mos_reg(mos_parport->serial, dummy, MOS7720_ECR, in mos7715_parport_init()
744 dev_err(&serial->interface->dev, in mos7715_parport_init()
751 mos_parport->pp->dev = &serial->interface->dev; in mos7715_parport_init()
814 dev_dbg(dev, "Serial Port 1: Receiver status error or address bit detected in 9-bit mode\n"); in mos7720_interrupt_callback()
817 dev_dbg(dev, "Serial Port 1: Receiver time out\n"); in mos7720_interrupt_callback()
820 /* dev_dbg(dev, "Serial Port 1: Modem status change\n"); */ in mos7720_interrupt_callback()
826 dev_dbg(dev, "Serial Port 2: Receiver status error or address bit detected in 9-bit mode\n"); in mos7720_interrupt_callback()
829 dev_dbg(dev, "Serial Port 2: Receiver time out\n"); in mos7720_interrupt_callback()
832 /* dev_dbg(dev, "Serial Port 2: Modem status change\n"); */ in mos7720_interrupt_callback()
877 * Byte 1: IIR serial Port in mos7715_interrupt_callback()
888 if (!(iir & 0x01)) { /* serial port interrupt pending */ in mos7715_interrupt_callback()
891 dev_dbg(dev, "Serial Port: Receiver status error or address bit detected in 9-bit mode\n"); in mos7715_interrupt_callback()
894 dev_dbg(dev, "Serial Port: Receiver time out\n"); in mos7715_interrupt_callback()
897 /* dev_dbg(dev, "Serial Port: Modem status change\n"); */ in mos7715_interrupt_callback()
905 struct mos7715_parport *mos_parport = port->serial->private; in mos7715_interrupt_callback()
955 * this is the callback function for when we have finished sending serial
978 static int mos77xx_calc_num_ports(struct usb_serial *serial, in mos77xx_calc_num_ports() argument
981 u16 product = le16_to_cpu(serial->dev->descriptor.idProduct); in mos77xx_calc_num_ports()
986 * parallel port, and the second for the serial port. We swap in mos77xx_calc_num_ports()
988 * only registered port structure uses the serial-port in mos77xx_calc_num_ports()
1002 struct usb_serial *serial; in mos7720_open() local
1011 serial = port->serial; in mos7720_open()
1017 usb_clear_halt(serial->dev, port->write_urb->pipe); in mos7720_open()
1018 usb_clear_halt(serial->dev, port->read_urb->pipe); in mos7720_open()
1055 read_mos_reg(serial, port_number, MOS7720_LSR, &data); in mos7720_open()
1059 write_mos_reg(serial, dummy, MOS7720_SP1_REG, 0x02); in mos7720_open()
1060 write_mos_reg(serial, dummy, MOS7720_SP2_REG, 0x02); in mos7720_open()
1062 write_mos_reg(serial, port_number, MOS7720_IER, 0x00); in mos7720_open()
1063 write_mos_reg(serial, port_number, MOS7720_FCR, 0x00); in mos7720_open()
1065 write_mos_reg(serial, port_number, MOS7720_FCR, 0xcf); in mos7720_open()
1067 write_mos_reg(serial, port_number, MOS7720_LCR, in mos7720_open()
1070 write_mos_reg(serial, port_number, MOS7720_MCR, in mos7720_open()
1073 write_mos_reg(serial, port_number, MOS7720_SP_CONTROL_REG, 0x00); in mos7720_open()
1074 read_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG, &data); in mos7720_open()
1076 write_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG, data); in mos7720_open()
1078 write_mos_reg(serial, port_number, MOS7720_LCR, in mos7720_open()
1080 write_mos_reg(serial, port_number, MOS7720_THR, 0x0c); in mos7720_open()
1081 write_mos_reg(serial, port_number, MOS7720_IER, 0x00); in mos7720_open()
1083 write_mos_reg(serial, port_number, MOS7720_LCR, in mos7720_open()
1085 write_mos_reg(serial, port_number, MOS7720_IER, 0x0c); in mos7720_open()
1132 struct usb_serial *serial; in mos7720_close() local
1136 serial = port->serial; in mos7720_close()
1158 write_mos_reg(serial, port->port_number, MOS7720_MCR, 0x00); in mos7720_close()
1159 write_mos_reg(serial, port->port_number, MOS7720_IER, 0x00); in mos7720_close()
1168 struct usb_serial *serial; in mos7720_break() local
1171 serial = port->serial; in mos7720_break()
1183 write_mos_reg(serial, port->port_number, MOS7720_LCR, in mos7720_break()
1225 struct usb_serial *serial; in mos7720_write() local
1229 serial = port->serial; in mos7720_write()
1267 usb_fill_bulk_urb(urb, serial->dev, in mos7720_write()
1268 usb_sndbulkpipe(serial->dev, in mos7720_write()
1314 write_mos_reg(port->serial, port->port_number, MOS7720_MCR, in mos7720_throttle()
1344 write_mos_reg(port->serial, port->port_number, MOS7720_MCR, in mos7720_unthrottle()
1354 struct usb_serial *serial; in set_higher_rates() local
1361 serial = port->serial; in set_higher_rates()
1369 write_mos_reg(serial, port_number, MOS7720_IER, 0x00); in set_higher_rates()
1370 write_mos_reg(serial, port_number, MOS7720_FCR, 0x00); in set_higher_rates()
1371 write_mos_reg(serial, port_number, MOS7720_FCR, 0xcf); in set_higher_rates()
1373 write_mos_reg(serial, port_number, MOS7720_MCR, in set_higher_rates()
1375 write_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG, 0x00); in set_higher_rates()
1385 write_mos_reg(serial, dummy, sp_reg, baud * 0x10); in set_higher_rates()
1386 write_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG, 0x03); in set_higher_rates()
1388 write_mos_reg(serial, port_number, MOS7720_MCR, in set_higher_rates()
1395 write_mos_reg(serial, port_number, MOS7720_LCR, in set_higher_rates()
1397 write_mos_reg(serial, port_number, MOS7720_DLL, 0x01); in set_higher_rates()
1398 write_mos_reg(serial, port_number, MOS7720_DLM, 0x00); in set_higher_rates()
1400 write_mos_reg(serial, port_number, MOS7720_LCR, in set_higher_rates()
1486 struct usb_serial *serial; in send_cmd_write_baud_rate() local
1495 serial = port->serial; in send_cmd_write_baud_rate()
1509 write_mos_reg(serial, number, MOS7720_LCR, mos7720_port->shadowLCR); in send_cmd_write_baud_rate()
1512 write_mos_reg(serial, number, MOS7720_DLL, (__u8)(divisor & 0xff)); in send_cmd_write_baud_rate()
1513 write_mos_reg(serial, number, MOS7720_DLM, in send_cmd_write_baud_rate()
1518 write_mos_reg(serial, number, MOS7720_LCR, mos7720_port->shadowLCR); in send_cmd_write_baud_rate()
1533 struct usb_serial *serial; in change_port_settings() local
1546 serial = port->serial; in change_port_settings()
1616 write_mos_reg(serial, port_number, MOS7720_IER, 0x00); in change_port_settings()
1617 write_mos_reg(serial, port_number, MOS7720_FCR, 0x00); in change_port_settings()
1618 write_mos_reg(serial, port_number, MOS7720_FCR, 0xcf); in change_port_settings()
1621 write_mos_reg(serial, port_number, MOS7720_LCR, in change_port_settings()
1624 write_mos_reg(serial, port_number, MOS7720_MCR, in change_port_settings()
1635 * serial port, in SP1/2_CONTROL_REG */ in change_port_settings()
1637 write_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG, in change_port_settings()
1640 write_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG, in change_port_settings()
1646 write_mos_reg(serial, port_number, MOS7720_MCR, in change_port_settings()
1660 write_mos_reg(serial, port_number, MOS7720_IER, 0x0c); in change_port_settings()
1671 write_mos_reg(serial, port_number, MOS7720_IER, 0x0c); in change_port_settings()
1732 read_mos_reg(port->serial, port_number, MOS7720_LSR, &data); in get_lsr_info()
1789 write_mos_reg(port->serial, port->port_number, MOS7720_MCR, in mos7720_tiocmset()
1832 static int mos7720_startup(struct usb_serial *serial) in mos7720_startup() argument
1839 product = le16_to_cpu(serial->dev->descriptor.idProduct); in mos7720_startup()
1840 dev = serial->dev; in mos7720_startup()
1843 struct urb *urb = serial->port[0]->interrupt_in_urb; in mos7720_startup()
1848 ret_val = mos7715_parport_init(serial); in mos7720_startup()
1854 ret_val = usb_submit_urb(serial->port[0]->interrupt_in_urb, GFP_KERNEL); in mos7720_startup()
1861 read_mos_reg(serial, 0, MOS7720_LSR, &data); in mos7720_startup()
1867 static void mos7720_release(struct usb_serial *serial) in mos7720_release() argument
1869 usb_kill_urb(serial->port[0]->interrupt_in_urb); in mos7720_release()
1874 if (le16_to_cpu(serial->dev->descriptor.idProduct) in mos7720_release()
1879 usb_get_serial_data(serial); in mos7720_release()
1892 usb_set_serial_data(serial, NULL); in mos7720_release()
1893 mos_parport->serial = NULL; in mos7720_release()