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()
255 write_mos_reg(mos_parport->serial, dummy, MOS7720_ECR, in mos7715_change_mode()
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()
309 if (unlikely(mos_parport->serial->disconnected)) { in send_deferred_urbs()
310 mutex_unlock(&mos_parport->serial->disc_mutex); in send_deferred_urbs()
317 mutex_unlock(&mos_parport->serial->disc_mutex); in send_deferred_urbs()
336 mutex_unlock(&mos_parport->serial->disc_mutex); in send_deferred_urbs()
362 struct usb_serial *serial = mos_parport->serial; in write_parport_reg_nonblock() local
363 struct usb_device *usbdev = serial->dev; in write_parport_reg_nonblock()
399 if (!mutex_trylock(&serial->disc_mutex)) { in write_parport_reg_nonblock()
410 if (serial->disconnected) { in write_parport_reg_nonblock()
412 mutex_unlock(&serial->disc_mutex); in write_parport_reg_nonblock()
421 mutex_unlock(&serial->disc_mutex); in write_parport_reg_nonblock()
440 * not called the release function yet because someone has a serial port open.
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()
480 mutex_unlock(&mos_parport->serial->disc_mutex); in parport_epilogue()
492 write_mos_reg(mos_parport->serial, dummy, MOS7720_DPR, (__u8)d); in parport_mos7715_write_data()
503 read_mos_reg(mos_parport->serial, dummy, MOS7720_DPR, &d); in parport_mos7715_read_data()
516 write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR, data); in parport_mos7715_write_control()
549 write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR, in parport_mos7715_frob_control()
588 write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR, in parport_mos7715_data_forward()
601 write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR, in parport_mos7715_data_reverse()
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()
704 static int mos7715_parport_init(struct usb_serial *serial) in mos7715_parport_init() argument
718 usb_set_serial_data(serial, mos_parport); /* hijack private pointer */ in mos7715_parport_init()
719 mos_parport->serial = serial; 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()
729 write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR, in mos7715_parport_init()
732 write_mos_reg(mos_parport->serial, dummy, MOS7720_ECR, in mos7715_parport_init()
740 dev_err(&serial->interface->dev, in mos7715_parport_init()
747 mos_parport->pp->dev = &serial->interface->dev; in mos7715_parport_init()
810 dev_dbg(dev, "Serial Port 1: Receiver status error or address bit detected in 9-bit mode\n"); in mos7720_interrupt_callback()
813 dev_dbg(dev, "Serial Port 1: Receiver time out\n"); in mos7720_interrupt_callback()
816 /* dev_dbg(dev, "Serial Port 1: Modem status change\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()
825 dev_dbg(dev, "Serial Port 2: Receiver time out\n"); in mos7720_interrupt_callback()
828 /* dev_dbg(dev, "Serial Port 2: Modem status change\n"); */ in mos7720_interrupt_callback()
873 * Byte 1: IIR serial Port in mos7715_interrupt_callback()
884 if (!(iir & 0x01)) { /* serial port interrupt pending */ 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()
890 dev_dbg(dev, "Serial Port: Receiver time out\n"); in mos7715_interrupt_callback()
893 /* dev_dbg(dev, "Serial Port: Modem status change\n"); */ in mos7715_interrupt_callback()
901 struct mos7715_parport *mos_parport = port->serial->private; in mos7715_interrupt_callback()
951 * this is the callback function for when we have finished sending serial
974 static int mos77xx_calc_num_ports(struct usb_serial *serial, in mos77xx_calc_num_ports() argument
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()
998 struct usb_serial *serial; in mos7720_open() local
1007 serial = port->serial; 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()
1051 read_mos_reg(serial, port_number, MOS7720_LSR, &data); in mos7720_open()
1055 write_mos_reg(serial, dummy, MOS7720_SP1_REG, 0x02); in mos7720_open()
1056 write_mos_reg(serial, dummy, MOS7720_SP2_REG, 0x02); in mos7720_open()
1058 write_mos_reg(serial, port_number, MOS7720_IER, 0x00); in mos7720_open()
1059 write_mos_reg(serial, port_number, MOS7720_FCR, 0x00); in mos7720_open()
1061 write_mos_reg(serial, port_number, MOS7720_FCR, 0xcf); in mos7720_open()
1063 write_mos_reg(serial, port_number, MOS7720_LCR, in mos7720_open()
1066 write_mos_reg(serial, port_number, MOS7720_MCR, in mos7720_open()
1069 write_mos_reg(serial, port_number, MOS7720_SP_CONTROL_REG, 0x00); in mos7720_open()
1070 read_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG, &data); in mos7720_open()
1072 write_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG, data); in mos7720_open()
1074 write_mos_reg(serial, port_number, MOS7720_LCR, in mos7720_open()
1076 write_mos_reg(serial, port_number, MOS7720_THR, 0x0c); in mos7720_open()
1077 write_mos_reg(serial, port_number, MOS7720_IER, 0x00); in mos7720_open()
1079 write_mos_reg(serial, port_number, MOS7720_LCR, in mos7720_open()
1081 write_mos_reg(serial, port_number, MOS7720_IER, 0x0c); in mos7720_open()
1128 struct usb_serial *serial; in mos7720_close() local
1132 serial = port->serial; 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()
1164 struct usb_serial *serial; in mos7720_break() local
1167 serial = port->serial; in mos7720_break()
1179 write_mos_reg(serial, port->port_number, MOS7720_LCR, in mos7720_break()
1221 struct usb_serial *serial; in mos7720_write() local
1225 serial = port->serial; in mos7720_write()
1261 usb_fill_bulk_urb(urb, serial->dev, in mos7720_write()
1262 usb_sndbulkpipe(serial->dev, in mos7720_write()
1308 write_mos_reg(port->serial, port->port_number, MOS7720_MCR, in mos7720_throttle()
1338 write_mos_reg(port->serial, port->port_number, MOS7720_MCR, in mos7720_unthrottle()
1348 struct usb_serial *serial; in set_higher_rates() local
1355 serial = port->serial; in set_higher_rates()
1363 write_mos_reg(serial, port_number, MOS7720_IER, 0x00); in set_higher_rates()
1364 write_mos_reg(serial, port_number, MOS7720_FCR, 0x00); in set_higher_rates()
1365 write_mos_reg(serial, port_number, MOS7720_FCR, 0xcf); in set_higher_rates()
1367 write_mos_reg(serial, port_number, MOS7720_MCR, in set_higher_rates()
1369 write_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG, 0x00); in set_higher_rates()
1379 write_mos_reg(serial, dummy, sp_reg, baud * 0x10); in set_higher_rates()
1380 write_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG, 0x03); in set_higher_rates()
1382 write_mos_reg(serial, port_number, MOS7720_MCR, in set_higher_rates()
1389 write_mos_reg(serial, port_number, MOS7720_LCR, in set_higher_rates()
1391 write_mos_reg(serial, port_number, MOS7720_DLL, 0x01); in set_higher_rates()
1392 write_mos_reg(serial, port_number, MOS7720_DLM, 0x00); in set_higher_rates()
1394 write_mos_reg(serial, port_number, MOS7720_LCR, in set_higher_rates()
1480 struct usb_serial *serial; in send_cmd_write_baud_rate() local
1489 serial = port->serial; in send_cmd_write_baud_rate()
1503 write_mos_reg(serial, number, MOS7720_LCR, mos7720_port->shadowLCR); in send_cmd_write_baud_rate()
1506 write_mos_reg(serial, number, MOS7720_DLL, (__u8)(divisor & 0xff)); in send_cmd_write_baud_rate()
1507 write_mos_reg(serial, number, MOS7720_DLM, in send_cmd_write_baud_rate()
1512 write_mos_reg(serial, number, MOS7720_LCR, mos7720_port->shadowLCR); in send_cmd_write_baud_rate()
1527 struct usb_serial *serial; in change_port_settings() local
1540 serial = port->serial; in change_port_settings()
1610 write_mos_reg(serial, port_number, MOS7720_IER, 0x00); in change_port_settings()
1611 write_mos_reg(serial, port_number, MOS7720_FCR, 0x00); in change_port_settings()
1612 write_mos_reg(serial, port_number, MOS7720_FCR, 0xcf); in change_port_settings()
1615 write_mos_reg(serial, port_number, MOS7720_LCR, in change_port_settings()
1618 write_mos_reg(serial, port_number, MOS7720_MCR, in change_port_settings()
1629 * serial port, in SP1/2_CONTROL_REG */ in change_port_settings()
1631 write_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG, in change_port_settings()
1634 write_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG, in change_port_settings()
1640 write_mos_reg(serial, port_number, MOS7720_MCR, in change_port_settings()
1654 write_mos_reg(serial, port_number, MOS7720_IER, 0x0c); in change_port_settings()
1665 write_mos_reg(serial, port_number, MOS7720_IER, 0x0c); in change_port_settings()
1726 read_mos_reg(port->serial, port_number, MOS7720_LSR, &data); in get_lsr_info()
1783 write_mos_reg(port->serial, port->port_number, MOS7720_MCR, in mos7720_tiocmset()
1826 static int mos7720_startup(struct usb_serial *serial) in mos7720_startup() argument
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()
1842 ret_val = mos7715_parport_init(serial); in mos7720_startup()
1848 ret_val = usb_submit_urb(serial->port[0]->interrupt_in_urb, GFP_KERNEL); in mos7720_startup()
1855 read_mos_reg(serial, 0, MOS7720_LSR, &data); in mos7720_startup()
1861 static void mos7720_release(struct usb_serial *serial) in mos7720_release() argument
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()
1873 usb_get_serial_data(serial); in mos7720_release()
1886 usb_set_serial_data(serial, NULL); in mos7720_release()
1887 mos_parport->serial = NULL; in mos7720_release()