Loading drivers/usb/serial/ti_usb_3410_5052.c +151 −115 Original line number Diff line number Diff line Loading @@ -82,7 +82,7 @@ #include <linux/serial.h> #include <linux/circ_buf.h> #include <linux/mutex.h> #include <asm/uaccess.h> #include <linux/uaccess.h> #include <linux/usb.h> #include <linux/usb/serial.h> #include <linux/firmware.h> Loading Loading @@ -160,9 +160,10 @@ static int ti_write_room(struct tty_struct *tty); static int ti_chars_in_buffer(struct tty_struct *tty); static void ti_throttle(struct tty_struct *tty); static void ti_unthrottle(struct tty_struct *tty); static int ti_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg); static void ti_set_termios(struct tty_struct *tty, struct usb_serial_port *port, struct ktermios *old_termios); static int ti_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg); static void ti_set_termios(struct tty_struct *tty, struct usb_serial_port *port, struct ktermios *old_termios); static int ti_tiocmget(struct tty_struct *tty, struct file *file); static int ti_tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear); Loading Loading @@ -327,19 +328,25 @@ module_param(debug, bool, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(debug, "Enable debugging, 0=no, 1=yes"); module_param(low_latency, bool, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(low_latency, "TTY low_latency flag, 0=off, 1=on, default is off"); MODULE_PARM_DESC(low_latency, "TTY low_latency flag, 0=off, 1=on, default is off"); module_param(closing_wait, int, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(closing_wait, "Maximum wait for data to drain in close, in .01 secs, default is 4000"); MODULE_PARM_DESC(closing_wait, "Maximum wait for data to drain in close, in .01 secs, default is 4000"); module_param_array(vendor_3410, ushort, &vendor_3410_count, S_IRUGO); MODULE_PARM_DESC(vendor_3410, "Vendor ids for 3410 based devices, 1-5 short integers"); MODULE_PARM_DESC(vendor_3410, "Vendor ids for 3410 based devices, 1-5 short integers"); module_param_array(product_3410, ushort, &product_3410_count, S_IRUGO); MODULE_PARM_DESC(product_3410, "Product ids for 3410 based devices, 1-5 short integers"); MODULE_PARM_DESC(product_3410, "Product ids for 3410 based devices, 1-5 short integers"); module_param_array(vendor_5052, ushort, &vendor_5052_count, S_IRUGO); MODULE_PARM_DESC(vendor_5052, "Vendor ids for 5052 based devices, 1-5 short integers"); MODULE_PARM_DESC(vendor_5052, "Vendor ids for 5052 based devices, 1-5 short integers"); module_param_array(product_5052, ushort, &product_5052_count, S_IRUGO); MODULE_PARM_DESC(product_5052, "Product ids for 5052 based devices, 1-5 short integers"); MODULE_PARM_DESC(product_5052, "Product ids for 5052 based devices, 1-5 short integers"); MODULE_DEVICE_TABLE(usb, ti_id_table_combined); Loading Loading @@ -428,7 +435,8 @@ static int ti_startup(struct usb_serial *serial) /* determine device type */ if (usb_match_id(serial->interface, ti_id_table_3410)) tdev->td_is_3410 = 1; dbg("%s - device type is %s", __func__, tdev->td_is_3410 ? "3410" : "5052"); dbg("%s - device type is %s", __func__, tdev->td_is_3410 ? "3410" : "5052"); /* if we have only 1 configuration, download firmware */ if (dev->descriptor.bNumConfigurations == 1) { Loading Loading @@ -464,7 +472,8 @@ static int ti_startup(struct usb_serial *serial) goto free_tports; } spin_lock_init(&tport->tp_lock); tport->tp_uart_base_addr = (i == 0 ? TI_UART1_BASE_ADDR : TI_UART2_BASE_ADDR); tport->tp_uart_base_addr = (i == 0 ? TI_UART1_BASE_ADDR : TI_UART2_BASE_ADDR); tport->tp_flags = low_latency ? ASYNC_LOW_LATENCY : 0; tport->tp_closing_wait = closing_wait; init_waitqueue_head(&tport->tp_msr_wait); Loading Loading @@ -561,7 +570,8 @@ static int ti_open(struct tty_struct *tty, dbg("%s - start interrupt in urb", __func__); urb = tdev->td_serial->port[0]->interrupt_in_urb; if (!urb) { dev_err(&port->dev, "%s - no interrupt urb\n", __func__); dev_err(&port->dev, "%s - no interrupt urb\n", __func__); status = -EINVAL; goto release_lock; } Loading @@ -570,7 +580,9 @@ static int ti_open(struct tty_struct *tty, urb->dev = dev; status = usb_submit_urb(urb, GFP_KERNEL); if (status) { dev_err(&port->dev, "%s - submit interrupt urb failed, %d\n", __func__, status); dev_err(&port->dev, "%s - submit interrupt urb failed, %d\n", __func__, status); goto release_lock; } } Loading @@ -582,7 +594,8 @@ static int ti_open(struct tty_struct *tty, status = ti_command_out_sync(tdev, TI_OPEN_PORT, (__u8)(TI_UART1_PORT + port_number), open_settings, NULL, 0); if (status) { dev_err(&port->dev, "%s - cannot send open command, %d\n", __func__, status); dev_err(&port->dev, "%s - cannot send open command, %d\n", __func__, status); goto unlink_int_urb; } Loading @@ -590,7 +603,8 @@ static int ti_open(struct tty_struct *tty, status = ti_command_out_sync(tdev, TI_START_PORT, (__u8)(TI_UART1_PORT + port_number), 0, NULL, 0); if (status) { dev_err(&port->dev, "%s - cannot send start command, %d\n", __func__, status); dev_err(&port->dev, "%s - cannot send start command, %d\n", __func__, status); goto unlink_int_urb; } Loading @@ -598,13 +612,15 @@ static int ti_open(struct tty_struct *tty, status = ti_command_out_sync(tdev, TI_PURGE_PORT, (__u8)(TI_UART1_PORT + port_number), TI_PURGE_INPUT, NULL, 0); if (status) { dev_err(&port->dev, "%s - cannot clear input buffers, %d\n", __func__, status); dev_err(&port->dev, "%s - cannot clear input buffers, %d\n", __func__, status); goto unlink_int_urb; } status = ti_command_out_sync(tdev, TI_PURGE_PORT, (__u8)(TI_UART1_PORT + port_number), TI_PURGE_OUTPUT, NULL, 0); if (status) { dev_err(&port->dev, "%s - cannot clear output buffers, %d\n", __func__, status); dev_err(&port->dev, "%s - cannot clear output buffers, %d\n", __func__, status); goto unlink_int_urb; } Loading @@ -620,7 +636,8 @@ static int ti_open(struct tty_struct *tty, status = ti_command_out_sync(tdev, TI_OPEN_PORT, (__u8)(TI_UART1_PORT + port_number), open_settings, NULL, 0); if (status) { dev_err(&port->dev, "%s - cannot send open command (2), %d\n", __func__, status); dev_err(&port->dev, "%s - cannot send open command (2), %d\n", __func__, status); goto unlink_int_urb; } Loading @@ -628,7 +645,8 @@ static int ti_open(struct tty_struct *tty, status = ti_command_out_sync(tdev, TI_START_PORT, (__u8)(TI_UART1_PORT + port_number), 0, NULL, 0); if (status) { dev_err(&port->dev, "%s - cannot send start command (2), %d\n", __func__, status); dev_err(&port->dev, "%s - cannot send start command (2), %d\n", __func__, status); goto unlink_int_urb; } Loading @@ -646,7 +664,8 @@ static int ti_open(struct tty_struct *tty, urb->dev = dev; status = usb_submit_urb(urb, GFP_KERNEL); if (status) { dev_err(&port->dev, "%s - submit read urb failed, %d\n", __func__, status); dev_err(&port->dev, "%s - submit read urb failed, %d\n", __func__, status); goto unlink_int_urb; } Loading Loading @@ -695,7 +714,9 @@ static void ti_close(struct tty_struct *tty, struct usb_serial_port *port, status = ti_command_out_sync(tdev, TI_CLOSE_PORT, (__u8)(TI_UART1_PORT + port_number), 0, NULL, 0); if (status) dev_err(&port->dev, "%s - cannot send close port command, %d\n" , __func__, status); dev_err(&port->dev, "%s - cannot send close port command, %d\n" , __func__, status); /* if mutex_lock is interrupted, continue anyway */ do_unlock = !mutex_lock_interruptible(&tdev->td_open_close_lock); Loading Loading @@ -810,7 +831,8 @@ static void ti_unthrottle(struct tty_struct *tty) if (I_IXOFF(tty) || C_CRTSCTS(tty)) { status = ti_restart_read(tport, tty); if (status) dev_err(&port->dev, "%s - cannot restart read, %d\n", __func__, status); dev_err(&port->dev, "%s - cannot restart read, %d\n", __func__, status); } } Loading @@ -831,14 +853,12 @@ static int ti_ioctl(struct tty_struct *tty, struct file *file, switch (cmd) { case TIOCGSERIAL: dbg("%s - (%d) TIOCGSERIAL", __func__, port->number); return ti_get_serial_info(tport, (struct serial_struct __user *)arg); break; return ti_get_serial_info(tport, (struct serial_struct __user *)arg); case TIOCSSERIAL: dbg("%s - (%d) TIOCSSERIAL", __func__, port->number); return ti_set_serial_info(tport, (struct serial_struct __user *)arg); break; return ti_set_serial_info(tport, (struct serial_struct __user *)arg); case TIOCMIWAIT: dbg("%s - (%d) TIOCMIWAIT", __func__, port->number); cprev = tport->tp_icount; Loading @@ -853,20 +873,20 @@ static int ti_ioctl(struct tty_struct *tty, struct file *file, if (((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) || ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) || ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) || ((arg & TIOCM_CTS) && (cnow.cts != cprev.cts)) ) { ((arg & TIOCM_CTS) && (cnow.cts != cprev.cts))) return 0; } cprev = cnow; } break; case TIOCGICOUNT: dbg("%s - (%d) TIOCGICOUNT RX=%d, TX=%d", __func__, port->number, tport->tp_icount.rx, tport->tp_icount.tx); if (copy_to_user((void __user *)arg, &tport->tp_icount, sizeof(tport->tp_icount))) dbg("%s - (%d) TIOCGICOUNT RX=%d, TX=%d", __func__, port->number, tport->tp_icount.rx, tport->tp_icount.tx); if (copy_to_user((void __user *)arg, &tport->tp_icount, sizeof(tport->tp_icount))) return -EFAULT; return 0; } return -ENOIOCTLCMD; } Loading @@ -888,7 +908,8 @@ static void ti_set_termios(struct tty_struct *tty, iflag = tty->termios->c_iflag; dbg("%s - cflag %08x, iflag %08x", __func__, cflag, iflag); dbg("%s - old clfag %08x, old iflag %08x", __func__, old_termios->c_cflag, old_termios->c_iflag); dbg("%s - old clfag %08x, old iflag %08x", __func__, old_termios->c_cflag, old_termios->c_iflag); if (tport == NULL) return; Loading Loading @@ -988,7 +1009,8 @@ static void ti_set_termios(struct tty_struct *tty, (__u8)(TI_UART1_PORT + port_number), 0, (__u8 *)config, sizeof(*config)); if (status) dev_err(&port->dev, "%s - cannot set config on port %d, %d\n", __func__, port_number, status); dev_err(&port->dev, "%s - cannot set config on port %d, %d\n", __func__, port_number, status); /* SET_CONFIG asserts RTS and DTR, reset them correctly */ mcr = tport->tp_shadow_mcr; Loading @@ -997,7 +1019,9 @@ static void ti_set_termios(struct tty_struct *tty, mcr &= ~(TI_MCR_DTR | TI_MCR_RTS); status = ti_set_mcr(tport, mcr); if (status) dev_err(&port->dev, "%s - cannot set modem control on port %d, %d\n", __func__, port_number, status); dev_err(&port->dev, "%s - cannot set modem control on port %d, %d\n", __func__, port_number, status); kfree(config); } Loading Loading @@ -1139,10 +1163,12 @@ static void ti_interrupt_callback(struct urb *urb) port_number = TI_GET_PORT_FROM_CODE(data[0]); function = TI_GET_FUNC_FROM_CODE(data[0]); dbg("%s - port_number %d, function %d, data 0x%02X", __func__, port_number, function, data[1]); dbg("%s - port_number %d, function %d, data 0x%02X", __func__, port_number, function, data[1]); if (port_number >= serial->num_ports) { dev_err(dev, "%s - bad port number, %d\n", __func__, port_number); dev_err(dev, "%s - bad port number, %d\n", __func__, port_number); goto exit; } Loading @@ -1154,7 +1180,8 @@ static void ti_interrupt_callback(struct urb *urb) switch (function) { case TI_CODE_DATA_ERROR: dev_err(dev, "%s - DATA ERROR, port %d, data 0x%02X\n", __func__, port_number, data[1]); dev_err(dev, "%s - DATA ERROR, port %d, data 0x%02X\n", __func__, port_number, data[1]); break; case TI_CODE_MODEM_STATUS: Loading @@ -1164,7 +1191,8 @@ static void ti_interrupt_callback(struct urb *urb) break; default: dev_err(dev, "%s - unknown interrupt code, 0x%02X\n", __func__, data[1]); dev_err(dev, "%s - unknown interrupt code, 0x%02X\n", __func__, data[1]); break; } Loading Loading @@ -1218,7 +1246,8 @@ static void ti_bulk_in_callback(struct urb *urb) if (!tport->tp_is_open) dbg("%s - port closed, dropping data", __func__); else ti_recv(&urb->dev->dev, port->port.tty, urb->transfer_buffer, ti_recv(&urb->dev->dev, port->port.tty, urb->transfer_buffer, urb->actual_length); spin_lock(&tport->tp_lock); Loading Loading @@ -1283,7 +1312,8 @@ static void ti_recv(struct device *dev, struct tty_struct *tty, do { cnt = tty_buffer_request_room(tty, length); if (cnt < length) { dev_err(dev, "%s - dropping data, %d bytes lost\n", __func__, length - cnt); dev_err(dev, "%s - dropping data, %d bytes lost\n", __func__, length - cnt); if (cnt == 0) break; } Loading Loading @@ -1326,7 +1356,8 @@ static void ti_send(struct ti_port *tport) spin_unlock_irqrestore(&tport->tp_lock, flags); usb_serial_debug_data(debug, &port->dev, __func__, count, port->write_urb->transfer_buffer); usb_serial_debug_data(debug, &port->dev, __func__, count, port->write_urb->transfer_buffer); usb_fill_bulk_urb(port->write_urb, port->serial->dev, usb_sndbulkpipe(port->serial->dev, Loading @@ -1336,7 +1367,8 @@ static void ti_send(struct ti_port *tport) result = usb_submit_urb(port->write_urb, GFP_ATOMIC); if (result) { dev_err(&port->dev, "%s - submit write urb failed, %d\n", __func__, result); dev_err(&port->dev, "%s - submit write urb failed, %d\n", __func__, result); tport->tp_write_urb_in_use = 0; /* TODO: reschedule ti_send */ } else { Loading Loading @@ -1390,7 +1422,9 @@ static int ti_get_lsr(struct ti_port *tport) status = ti_command_in_sync(tdev, TI_GET_PORT_STATUS, (__u8)(TI_UART1_PORT+port_number), 0, (__u8 *)data, size); if (status) { dev_err(&port->dev, "%s - get port status command failed, %d\n", __func__, status); dev_err(&port->dev, "%s - get port status command failed, %d\n", __func__, status); goto free_data; } Loading Loading @@ -1626,7 +1660,8 @@ static int ti_write_byte(struct ti_device *tdev, unsigned long addr, struct ti_write_data_bytes *data; struct device *dev = &tdev->td_serial->dev->dev; dbg("%s - addr 0x%08lX, mask 0x%02X, byte 0x%02X", __func__, addr, mask, byte); dbg("%s - addr 0x%08lX, mask 0x%02X, byte 0x%02X", __func__, addr, mask, byte); size = sizeof(struct ti_write_data_bytes) + 2; data = kmalloc(size, GFP_KERNEL); Loading Loading @@ -1714,7 +1749,8 @@ static int ti_download_firmware(struct ti_device *tdev, int type) } release_firmware(fw_p); if (status) { dev_err(&dev->dev, "%s - error downloading firmware, %d\n", __func__, status); dev_err(&dev->dev, "%s - error downloading firmware, %d\n", __func__, status); return status; } Loading Loading
drivers/usb/serial/ti_usb_3410_5052.c +151 −115 Original line number Diff line number Diff line Loading @@ -82,7 +82,7 @@ #include <linux/serial.h> #include <linux/circ_buf.h> #include <linux/mutex.h> #include <asm/uaccess.h> #include <linux/uaccess.h> #include <linux/usb.h> #include <linux/usb/serial.h> #include <linux/firmware.h> Loading Loading @@ -160,9 +160,10 @@ static int ti_write_room(struct tty_struct *tty); static int ti_chars_in_buffer(struct tty_struct *tty); static void ti_throttle(struct tty_struct *tty); static void ti_unthrottle(struct tty_struct *tty); static int ti_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg); static void ti_set_termios(struct tty_struct *tty, struct usb_serial_port *port, struct ktermios *old_termios); static int ti_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg); static void ti_set_termios(struct tty_struct *tty, struct usb_serial_port *port, struct ktermios *old_termios); static int ti_tiocmget(struct tty_struct *tty, struct file *file); static int ti_tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear); Loading Loading @@ -327,19 +328,25 @@ module_param(debug, bool, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(debug, "Enable debugging, 0=no, 1=yes"); module_param(low_latency, bool, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(low_latency, "TTY low_latency flag, 0=off, 1=on, default is off"); MODULE_PARM_DESC(low_latency, "TTY low_latency flag, 0=off, 1=on, default is off"); module_param(closing_wait, int, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(closing_wait, "Maximum wait for data to drain in close, in .01 secs, default is 4000"); MODULE_PARM_DESC(closing_wait, "Maximum wait for data to drain in close, in .01 secs, default is 4000"); module_param_array(vendor_3410, ushort, &vendor_3410_count, S_IRUGO); MODULE_PARM_DESC(vendor_3410, "Vendor ids for 3410 based devices, 1-5 short integers"); MODULE_PARM_DESC(vendor_3410, "Vendor ids for 3410 based devices, 1-5 short integers"); module_param_array(product_3410, ushort, &product_3410_count, S_IRUGO); MODULE_PARM_DESC(product_3410, "Product ids for 3410 based devices, 1-5 short integers"); MODULE_PARM_DESC(product_3410, "Product ids for 3410 based devices, 1-5 short integers"); module_param_array(vendor_5052, ushort, &vendor_5052_count, S_IRUGO); MODULE_PARM_DESC(vendor_5052, "Vendor ids for 5052 based devices, 1-5 short integers"); MODULE_PARM_DESC(vendor_5052, "Vendor ids for 5052 based devices, 1-5 short integers"); module_param_array(product_5052, ushort, &product_5052_count, S_IRUGO); MODULE_PARM_DESC(product_5052, "Product ids for 5052 based devices, 1-5 short integers"); MODULE_PARM_DESC(product_5052, "Product ids for 5052 based devices, 1-5 short integers"); MODULE_DEVICE_TABLE(usb, ti_id_table_combined); Loading Loading @@ -428,7 +435,8 @@ static int ti_startup(struct usb_serial *serial) /* determine device type */ if (usb_match_id(serial->interface, ti_id_table_3410)) tdev->td_is_3410 = 1; dbg("%s - device type is %s", __func__, tdev->td_is_3410 ? "3410" : "5052"); dbg("%s - device type is %s", __func__, tdev->td_is_3410 ? "3410" : "5052"); /* if we have only 1 configuration, download firmware */ if (dev->descriptor.bNumConfigurations == 1) { Loading Loading @@ -464,7 +472,8 @@ static int ti_startup(struct usb_serial *serial) goto free_tports; } spin_lock_init(&tport->tp_lock); tport->tp_uart_base_addr = (i == 0 ? TI_UART1_BASE_ADDR : TI_UART2_BASE_ADDR); tport->tp_uart_base_addr = (i == 0 ? TI_UART1_BASE_ADDR : TI_UART2_BASE_ADDR); tport->tp_flags = low_latency ? ASYNC_LOW_LATENCY : 0; tport->tp_closing_wait = closing_wait; init_waitqueue_head(&tport->tp_msr_wait); Loading Loading @@ -561,7 +570,8 @@ static int ti_open(struct tty_struct *tty, dbg("%s - start interrupt in urb", __func__); urb = tdev->td_serial->port[0]->interrupt_in_urb; if (!urb) { dev_err(&port->dev, "%s - no interrupt urb\n", __func__); dev_err(&port->dev, "%s - no interrupt urb\n", __func__); status = -EINVAL; goto release_lock; } Loading @@ -570,7 +580,9 @@ static int ti_open(struct tty_struct *tty, urb->dev = dev; status = usb_submit_urb(urb, GFP_KERNEL); if (status) { dev_err(&port->dev, "%s - submit interrupt urb failed, %d\n", __func__, status); dev_err(&port->dev, "%s - submit interrupt urb failed, %d\n", __func__, status); goto release_lock; } } Loading @@ -582,7 +594,8 @@ static int ti_open(struct tty_struct *tty, status = ti_command_out_sync(tdev, TI_OPEN_PORT, (__u8)(TI_UART1_PORT + port_number), open_settings, NULL, 0); if (status) { dev_err(&port->dev, "%s - cannot send open command, %d\n", __func__, status); dev_err(&port->dev, "%s - cannot send open command, %d\n", __func__, status); goto unlink_int_urb; } Loading @@ -590,7 +603,8 @@ static int ti_open(struct tty_struct *tty, status = ti_command_out_sync(tdev, TI_START_PORT, (__u8)(TI_UART1_PORT + port_number), 0, NULL, 0); if (status) { dev_err(&port->dev, "%s - cannot send start command, %d\n", __func__, status); dev_err(&port->dev, "%s - cannot send start command, %d\n", __func__, status); goto unlink_int_urb; } Loading @@ -598,13 +612,15 @@ static int ti_open(struct tty_struct *tty, status = ti_command_out_sync(tdev, TI_PURGE_PORT, (__u8)(TI_UART1_PORT + port_number), TI_PURGE_INPUT, NULL, 0); if (status) { dev_err(&port->dev, "%s - cannot clear input buffers, %d\n", __func__, status); dev_err(&port->dev, "%s - cannot clear input buffers, %d\n", __func__, status); goto unlink_int_urb; } status = ti_command_out_sync(tdev, TI_PURGE_PORT, (__u8)(TI_UART1_PORT + port_number), TI_PURGE_OUTPUT, NULL, 0); if (status) { dev_err(&port->dev, "%s - cannot clear output buffers, %d\n", __func__, status); dev_err(&port->dev, "%s - cannot clear output buffers, %d\n", __func__, status); goto unlink_int_urb; } Loading @@ -620,7 +636,8 @@ static int ti_open(struct tty_struct *tty, status = ti_command_out_sync(tdev, TI_OPEN_PORT, (__u8)(TI_UART1_PORT + port_number), open_settings, NULL, 0); if (status) { dev_err(&port->dev, "%s - cannot send open command (2), %d\n", __func__, status); dev_err(&port->dev, "%s - cannot send open command (2), %d\n", __func__, status); goto unlink_int_urb; } Loading @@ -628,7 +645,8 @@ static int ti_open(struct tty_struct *tty, status = ti_command_out_sync(tdev, TI_START_PORT, (__u8)(TI_UART1_PORT + port_number), 0, NULL, 0); if (status) { dev_err(&port->dev, "%s - cannot send start command (2), %d\n", __func__, status); dev_err(&port->dev, "%s - cannot send start command (2), %d\n", __func__, status); goto unlink_int_urb; } Loading @@ -646,7 +664,8 @@ static int ti_open(struct tty_struct *tty, urb->dev = dev; status = usb_submit_urb(urb, GFP_KERNEL); if (status) { dev_err(&port->dev, "%s - submit read urb failed, %d\n", __func__, status); dev_err(&port->dev, "%s - submit read urb failed, %d\n", __func__, status); goto unlink_int_urb; } Loading Loading @@ -695,7 +714,9 @@ static void ti_close(struct tty_struct *tty, struct usb_serial_port *port, status = ti_command_out_sync(tdev, TI_CLOSE_PORT, (__u8)(TI_UART1_PORT + port_number), 0, NULL, 0); if (status) dev_err(&port->dev, "%s - cannot send close port command, %d\n" , __func__, status); dev_err(&port->dev, "%s - cannot send close port command, %d\n" , __func__, status); /* if mutex_lock is interrupted, continue anyway */ do_unlock = !mutex_lock_interruptible(&tdev->td_open_close_lock); Loading Loading @@ -810,7 +831,8 @@ static void ti_unthrottle(struct tty_struct *tty) if (I_IXOFF(tty) || C_CRTSCTS(tty)) { status = ti_restart_read(tport, tty); if (status) dev_err(&port->dev, "%s - cannot restart read, %d\n", __func__, status); dev_err(&port->dev, "%s - cannot restart read, %d\n", __func__, status); } } Loading @@ -831,14 +853,12 @@ static int ti_ioctl(struct tty_struct *tty, struct file *file, switch (cmd) { case TIOCGSERIAL: dbg("%s - (%d) TIOCGSERIAL", __func__, port->number); return ti_get_serial_info(tport, (struct serial_struct __user *)arg); break; return ti_get_serial_info(tport, (struct serial_struct __user *)arg); case TIOCSSERIAL: dbg("%s - (%d) TIOCSSERIAL", __func__, port->number); return ti_set_serial_info(tport, (struct serial_struct __user *)arg); break; return ti_set_serial_info(tport, (struct serial_struct __user *)arg); case TIOCMIWAIT: dbg("%s - (%d) TIOCMIWAIT", __func__, port->number); cprev = tport->tp_icount; Loading @@ -853,20 +873,20 @@ static int ti_ioctl(struct tty_struct *tty, struct file *file, if (((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) || ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) || ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) || ((arg & TIOCM_CTS) && (cnow.cts != cprev.cts)) ) { ((arg & TIOCM_CTS) && (cnow.cts != cprev.cts))) return 0; } cprev = cnow; } break; case TIOCGICOUNT: dbg("%s - (%d) TIOCGICOUNT RX=%d, TX=%d", __func__, port->number, tport->tp_icount.rx, tport->tp_icount.tx); if (copy_to_user((void __user *)arg, &tport->tp_icount, sizeof(tport->tp_icount))) dbg("%s - (%d) TIOCGICOUNT RX=%d, TX=%d", __func__, port->number, tport->tp_icount.rx, tport->tp_icount.tx); if (copy_to_user((void __user *)arg, &tport->tp_icount, sizeof(tport->tp_icount))) return -EFAULT; return 0; } return -ENOIOCTLCMD; } Loading @@ -888,7 +908,8 @@ static void ti_set_termios(struct tty_struct *tty, iflag = tty->termios->c_iflag; dbg("%s - cflag %08x, iflag %08x", __func__, cflag, iflag); dbg("%s - old clfag %08x, old iflag %08x", __func__, old_termios->c_cflag, old_termios->c_iflag); dbg("%s - old clfag %08x, old iflag %08x", __func__, old_termios->c_cflag, old_termios->c_iflag); if (tport == NULL) return; Loading Loading @@ -988,7 +1009,8 @@ static void ti_set_termios(struct tty_struct *tty, (__u8)(TI_UART1_PORT + port_number), 0, (__u8 *)config, sizeof(*config)); if (status) dev_err(&port->dev, "%s - cannot set config on port %d, %d\n", __func__, port_number, status); dev_err(&port->dev, "%s - cannot set config on port %d, %d\n", __func__, port_number, status); /* SET_CONFIG asserts RTS and DTR, reset them correctly */ mcr = tport->tp_shadow_mcr; Loading @@ -997,7 +1019,9 @@ static void ti_set_termios(struct tty_struct *tty, mcr &= ~(TI_MCR_DTR | TI_MCR_RTS); status = ti_set_mcr(tport, mcr); if (status) dev_err(&port->dev, "%s - cannot set modem control on port %d, %d\n", __func__, port_number, status); dev_err(&port->dev, "%s - cannot set modem control on port %d, %d\n", __func__, port_number, status); kfree(config); } Loading Loading @@ -1139,10 +1163,12 @@ static void ti_interrupt_callback(struct urb *urb) port_number = TI_GET_PORT_FROM_CODE(data[0]); function = TI_GET_FUNC_FROM_CODE(data[0]); dbg("%s - port_number %d, function %d, data 0x%02X", __func__, port_number, function, data[1]); dbg("%s - port_number %d, function %d, data 0x%02X", __func__, port_number, function, data[1]); if (port_number >= serial->num_ports) { dev_err(dev, "%s - bad port number, %d\n", __func__, port_number); dev_err(dev, "%s - bad port number, %d\n", __func__, port_number); goto exit; } Loading @@ -1154,7 +1180,8 @@ static void ti_interrupt_callback(struct urb *urb) switch (function) { case TI_CODE_DATA_ERROR: dev_err(dev, "%s - DATA ERROR, port %d, data 0x%02X\n", __func__, port_number, data[1]); dev_err(dev, "%s - DATA ERROR, port %d, data 0x%02X\n", __func__, port_number, data[1]); break; case TI_CODE_MODEM_STATUS: Loading @@ -1164,7 +1191,8 @@ static void ti_interrupt_callback(struct urb *urb) break; default: dev_err(dev, "%s - unknown interrupt code, 0x%02X\n", __func__, data[1]); dev_err(dev, "%s - unknown interrupt code, 0x%02X\n", __func__, data[1]); break; } Loading Loading @@ -1218,7 +1246,8 @@ static void ti_bulk_in_callback(struct urb *urb) if (!tport->tp_is_open) dbg("%s - port closed, dropping data", __func__); else ti_recv(&urb->dev->dev, port->port.tty, urb->transfer_buffer, ti_recv(&urb->dev->dev, port->port.tty, urb->transfer_buffer, urb->actual_length); spin_lock(&tport->tp_lock); Loading Loading @@ -1283,7 +1312,8 @@ static void ti_recv(struct device *dev, struct tty_struct *tty, do { cnt = tty_buffer_request_room(tty, length); if (cnt < length) { dev_err(dev, "%s - dropping data, %d bytes lost\n", __func__, length - cnt); dev_err(dev, "%s - dropping data, %d bytes lost\n", __func__, length - cnt); if (cnt == 0) break; } Loading Loading @@ -1326,7 +1356,8 @@ static void ti_send(struct ti_port *tport) spin_unlock_irqrestore(&tport->tp_lock, flags); usb_serial_debug_data(debug, &port->dev, __func__, count, port->write_urb->transfer_buffer); usb_serial_debug_data(debug, &port->dev, __func__, count, port->write_urb->transfer_buffer); usb_fill_bulk_urb(port->write_urb, port->serial->dev, usb_sndbulkpipe(port->serial->dev, Loading @@ -1336,7 +1367,8 @@ static void ti_send(struct ti_port *tport) result = usb_submit_urb(port->write_urb, GFP_ATOMIC); if (result) { dev_err(&port->dev, "%s - submit write urb failed, %d\n", __func__, result); dev_err(&port->dev, "%s - submit write urb failed, %d\n", __func__, result); tport->tp_write_urb_in_use = 0; /* TODO: reschedule ti_send */ } else { Loading Loading @@ -1390,7 +1422,9 @@ static int ti_get_lsr(struct ti_port *tport) status = ti_command_in_sync(tdev, TI_GET_PORT_STATUS, (__u8)(TI_UART1_PORT+port_number), 0, (__u8 *)data, size); if (status) { dev_err(&port->dev, "%s - get port status command failed, %d\n", __func__, status); dev_err(&port->dev, "%s - get port status command failed, %d\n", __func__, status); goto free_data; } Loading Loading @@ -1626,7 +1660,8 @@ static int ti_write_byte(struct ti_device *tdev, unsigned long addr, struct ti_write_data_bytes *data; struct device *dev = &tdev->td_serial->dev->dev; dbg("%s - addr 0x%08lX, mask 0x%02X, byte 0x%02X", __func__, addr, mask, byte); dbg("%s - addr 0x%08lX, mask 0x%02X, byte 0x%02X", __func__, addr, mask, byte); size = sizeof(struct ti_write_data_bytes) + 2; data = kmalloc(size, GFP_KERNEL); Loading Loading @@ -1714,7 +1749,8 @@ static int ti_download_firmware(struct ti_device *tdev, int type) } release_firmware(fw_p); if (status) { dev_err(&dev->dev, "%s - error downloading firmware, %d\n", __func__, status); dev_err(&dev->dev, "%s - error downloading firmware, %d\n", __func__, status); return status; } Loading