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 */
94 struct usb_serial *serial; /* back to containing struct */ member
108 MOS7720_THR, /* serial port regs */
125 MOS7720_SP2_REG, /* serial port 2 (7720 only) */
174 else /* serial port reg */ in get_reg_value()
181 * not specific to a particular serial port.
183 static int write_mos_reg(struct usb_serial *serial, unsigned int serial_portnum, in write_mos_reg() argument
186 struct usb_device *usbdev = serial->dev; in write_mos_reg()
203 * ignored for registers that are not specific to a particular serial port.
205 static int read_mos_reg(struct usb_serial *serial, unsigned int serial_portnum, in read_mos_reg() argument
208 struct usb_device *usbdev = serial->dev; in read_mos_reg()
246 write_mos_reg(mos_parport->serial, dummy, MOS7720_ECR, in mos7715_change_mode()
265 * not called the release function yet because someone has a serial port open.
290 mutex_lock(&mos_parport->serial->disc_mutex); in parport_prologue()
291 if (mos_parport->serial->disconnected) { in parport_prologue()
293 mutex_unlock(&mos_parport->serial->disc_mutex); in parport_prologue()
309 mutex_unlock(&mos_parport->serial->disc_mutex); in parport_epilogue()
320 mutex_lock(&mos_parport->serial->disc_mutex); in deferred_restore_writes()
323 if (mos_parport->serial->disconnected) in deferred_restore_writes()
326 write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR, in deferred_restore_writes()
328 write_mos_reg(mos_parport->serial, dummy, MOS7720_ECR, in deferred_restore_writes()
331 mutex_unlock(&mos_parport->serial->disc_mutex); in deferred_restore_writes()
341 write_mos_reg(mos_parport->serial, dummy, MOS7720_DPR, (__u8)d); in parport_mos7715_write_data()
352 read_mos_reg(mos_parport->serial, dummy, MOS7720_DPR, &d); in parport_mos7715_read_data()
365 write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR, data); in parport_mos7715_write_control()
398 write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR, in parport_mos7715_frob_control()
437 write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR, in parport_mos7715_data_forward()
450 write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR, in parport_mos7715_data_reverse()
509 retval = usb_bulk_msg(mos_parport->serial->dev, in parport_mos7715_write_compat()
510 usb_sndbulkpipe(mos_parport->serial->dev, 2), in parport_mos7715_write_compat()
515 dev_err(&mos_parport->serial->dev->dev, in parport_mos7715_write_compat()
553 static int mos7715_parport_init(struct usb_serial *serial) in mos7715_parport_init() argument
564 usb_set_serial_data(serial, mos_parport); /* hijack private pointer */ in mos7715_parport_init()
565 mos_parport->serial = serial; in mos7715_parport_init()
570 write_mos_reg(mos_parport->serial, dummy, MOS7720_PP_REG, (__u8)0x80); in mos7715_parport_init()
571 write_mos_reg(mos_parport->serial, dummy, MOS7720_PP_REG, (__u8)0x00); in mos7715_parport_init()
575 write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR, in mos7715_parport_init()
578 write_mos_reg(mos_parport->serial, dummy, MOS7720_ECR, in mos7715_parport_init()
586 dev_err(&serial->interface->dev, in mos7715_parport_init()
593 mos_parport->pp->dev = &serial->interface->dev; in mos7715_parport_init()
656 dev_dbg(dev, "Serial Port 1: Receiver status error or address bit detected in 9-bit mode\n"); in mos7720_interrupt_callback()
659 dev_dbg(dev, "Serial Port 1: Receiver time out\n"); in mos7720_interrupt_callback()
662 /* dev_dbg(dev, "Serial Port 1: Modem status change\n"); */ in mos7720_interrupt_callback()
668 dev_dbg(dev, "Serial Port 2: Receiver status error or address bit detected in 9-bit mode\n"); in mos7720_interrupt_callback()
671 dev_dbg(dev, "Serial Port 2: Receiver time out\n"); in mos7720_interrupt_callback()
674 /* dev_dbg(dev, "Serial Port 2: Modem status change\n"); */ in mos7720_interrupt_callback()
719 * Byte 1: IIR serial Port in mos7715_interrupt_callback()
730 if (!(iir & 0x01)) { /* serial port interrupt pending */ in mos7715_interrupt_callback()
733 dev_dbg(dev, "Serial Port: Receiver status error or address bit detected in 9-bit mode\n"); in mos7715_interrupt_callback()
736 dev_dbg(dev, "Serial Port: Receiver time out\n"); in mos7715_interrupt_callback()
739 /* dev_dbg(dev, "Serial Port: Modem status change\n"); */ in mos7715_interrupt_callback()
747 struct mos7715_parport *mos_parport = port->serial->private; in mos7715_interrupt_callback()
797 * this is the callback function for when we have finished sending serial
820 static int mos77xx_calc_num_ports(struct usb_serial *serial, in mos77xx_calc_num_ports() argument
823 u16 product = le16_to_cpu(serial->dev->descriptor.idProduct); in mos77xx_calc_num_ports()
828 * parallel port, and the second for the serial port. We swap in mos77xx_calc_num_ports()
830 * only registered port structure uses the serial-port in mos77xx_calc_num_ports()
844 struct usb_serial *serial; in mos7720_open() local
853 serial = port->serial; in mos7720_open()
859 usb_clear_halt(serial->dev, port->write_urb->pipe); in mos7720_open()
860 usb_clear_halt(serial->dev, port->read_urb->pipe); in mos7720_open()
897 read_mos_reg(serial, port_number, MOS7720_LSR, &data); in mos7720_open()
901 write_mos_reg(serial, dummy, MOS7720_SP1_REG, 0x02); in mos7720_open()
902 write_mos_reg(serial, dummy, MOS7720_SP2_REG, 0x02); in mos7720_open()
904 write_mos_reg(serial, port_number, MOS7720_IER, 0x00); in mos7720_open()
905 write_mos_reg(serial, port_number, MOS7720_FCR, 0x00); in mos7720_open()
907 write_mos_reg(serial, port_number, MOS7720_FCR, 0xcf); in mos7720_open()
909 write_mos_reg(serial, port_number, MOS7720_LCR, in mos7720_open()
912 write_mos_reg(serial, port_number, MOS7720_MCR, in mos7720_open()
915 write_mos_reg(serial, port_number, MOS7720_SP_CONTROL_REG, 0x00); in mos7720_open()
916 read_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG, &data); in mos7720_open()
918 write_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG, data); in mos7720_open()
920 write_mos_reg(serial, port_number, MOS7720_LCR, in mos7720_open()
922 write_mos_reg(serial, port_number, MOS7720_THR, 0x0c); in mos7720_open()
923 write_mos_reg(serial, port_number, MOS7720_IER, 0x00); in mos7720_open()
925 write_mos_reg(serial, port_number, MOS7720_LCR, in mos7720_open()
927 write_mos_reg(serial, port_number, MOS7720_IER, 0x0c); in mos7720_open()
967 struct usb_serial *serial; in mos7720_close() local
971 serial = port->serial; in mos7720_close()
993 write_mos_reg(serial, port->port_number, MOS7720_MCR, 0x00); in mos7720_close()
994 write_mos_reg(serial, port->port_number, MOS7720_IER, 0x00); in mos7720_close()
1003 struct usb_serial *serial; in mos7720_break() local
1006 serial = port->serial; in mos7720_break()
1019 return write_mos_reg(serial, port->port_number, MOS7720_LCR, in mos7720_break()
1055 struct usb_serial *serial; in mos7720_write() local
1059 serial = port->serial; in mos7720_write()
1097 usb_fill_bulk_urb(urb, serial->dev, in mos7720_write()
1098 usb_sndbulkpipe(serial->dev, in mos7720_write()
1144 write_mos_reg(port->serial, port->port_number, MOS7720_MCR, in mos7720_throttle()
1174 write_mos_reg(port->serial, port->port_number, MOS7720_MCR, in mos7720_unthrottle()
1184 struct usb_serial *serial; in set_higher_rates() local
1191 serial = port->serial; in set_higher_rates()
1199 write_mos_reg(serial, port_number, MOS7720_IER, 0x00); in set_higher_rates()
1200 write_mos_reg(serial, port_number, MOS7720_FCR, 0x00); in set_higher_rates()
1201 write_mos_reg(serial, port_number, MOS7720_FCR, 0xcf); in set_higher_rates()
1203 write_mos_reg(serial, port_number, MOS7720_MCR, in set_higher_rates()
1205 write_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG, 0x00); in set_higher_rates()
1215 write_mos_reg(serial, dummy, sp_reg, baud * 0x10); in set_higher_rates()
1216 write_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG, 0x03); in set_higher_rates()
1218 write_mos_reg(serial, port_number, MOS7720_MCR, in set_higher_rates()
1225 write_mos_reg(serial, port_number, MOS7720_LCR, in set_higher_rates()
1227 write_mos_reg(serial, port_number, MOS7720_DLL, 0x01); in set_higher_rates()
1228 write_mos_reg(serial, port_number, MOS7720_DLM, 0x00); in set_higher_rates()
1230 write_mos_reg(serial, port_number, MOS7720_LCR, in set_higher_rates()
1316 struct usb_serial *serial; in send_cmd_write_baud_rate() local
1325 serial = port->serial; in send_cmd_write_baud_rate()
1339 write_mos_reg(serial, number, MOS7720_LCR, mos7720_port->shadowLCR); in send_cmd_write_baud_rate()
1342 write_mos_reg(serial, number, MOS7720_DLL, (__u8)(divisor & 0xff)); in send_cmd_write_baud_rate()
1343 write_mos_reg(serial, number, MOS7720_DLM, in send_cmd_write_baud_rate()
1348 write_mos_reg(serial, number, MOS7720_LCR, mos7720_port->shadowLCR); in send_cmd_write_baud_rate()
1363 struct usb_serial *serial; in change_port_settings() local
1376 serial = port->serial; in change_port_settings()
1428 write_mos_reg(serial, port_number, MOS7720_IER, 0x00); in change_port_settings()
1429 write_mos_reg(serial, port_number, MOS7720_FCR, 0x00); in change_port_settings()
1430 write_mos_reg(serial, port_number, MOS7720_FCR, 0xcf); in change_port_settings()
1433 write_mos_reg(serial, port_number, MOS7720_LCR, in change_port_settings()
1436 write_mos_reg(serial, port_number, MOS7720_MCR, in change_port_settings()
1447 * serial port, in SP1/2_CONTROL_REG */ in change_port_settings()
1449 write_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG, in change_port_settings()
1452 write_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG, in change_port_settings()
1458 write_mos_reg(serial, port_number, MOS7720_MCR, in change_port_settings()
1472 write_mos_reg(serial, port_number, MOS7720_IER, 0x0c); in change_port_settings()
1483 write_mos_reg(serial, port_number, MOS7720_IER, 0x0c); in change_port_settings()
1545 read_mos_reg(port->serial, port_number, MOS7720_LSR, &data); in get_lsr_info()
1602 write_mos_reg(port->serial, port->port_number, MOS7720_MCR, in mos7720_tiocmset()
1628 static int mos7720_startup(struct usb_serial *serial) in mos7720_startup() argument
1635 product = le16_to_cpu(serial->dev->descriptor.idProduct); in mos7720_startup()
1636 dev = serial->dev; in mos7720_startup()
1639 struct urb *urb = serial->port[0]->interrupt_in_urb; in mos7720_startup()
1644 ret_val = mos7715_parport_init(serial); in mos7720_startup()
1650 ret_val = usb_submit_urb(serial->port[0]->interrupt_in_urb, GFP_KERNEL); in mos7720_startup()
1657 read_mos_reg(serial, 0, MOS7720_LSR, &data); in mos7720_startup()
1663 static void mos7720_release(struct usb_serial *serial) in mos7720_release() argument
1665 usb_kill_urb(serial->port[0]->interrupt_in_urb); in mos7720_release()
1670 if (le16_to_cpu(serial->dev->descriptor.idProduct) in mos7720_release()
1673 usb_get_serial_data(serial); in mos7720_release()
1687 * below serial clearing is not hoisted above the ->work. in mos7720_release()
1692 usb_set_serial_data(serial, NULL); in mos7720_release()
1693 mos_parport->serial = NULL; in mos7720_release()