aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/io_edgeport.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /drivers/usb/serial/io_edgeport.c
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'drivers/usb/serial/io_edgeport.c')
-rw-r--r--drivers/usb/serial/io_edgeport.c81
1 files changed, 36 insertions, 45 deletions
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index 76e6fb3aab7a..abf095be5753 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -216,12 +216,14 @@ static void edge_unthrottle(struct tty_struct *tty);
216static void edge_set_termios(struct tty_struct *tty, 216static void edge_set_termios(struct tty_struct *tty,
217 struct usb_serial_port *port, 217 struct usb_serial_port *port,
218 struct ktermios *old_termios); 218 struct ktermios *old_termios);
219static int edge_ioctl(struct tty_struct *tty, struct file *file, 219static int edge_ioctl(struct tty_struct *tty,
220 unsigned int cmd, unsigned long arg); 220 unsigned int cmd, unsigned long arg);
221static void edge_break(struct tty_struct *tty, int break_state); 221static void edge_break(struct tty_struct *tty, int break_state);
222static int edge_tiocmget(struct tty_struct *tty, struct file *file); 222static int edge_tiocmget(struct tty_struct *tty);
223static int edge_tiocmset(struct tty_struct *tty, struct file *file, 223static int edge_tiocmset(struct tty_struct *tty,
224 unsigned int set, unsigned int clear); 224 unsigned int set, unsigned int clear);
225static int edge_get_icount(struct tty_struct *tty,
226 struct serial_icounter_struct *icount);
225static int edge_startup(struct usb_serial *serial); 227static int edge_startup(struct usb_serial *serial);
226static void edge_disconnect(struct usb_serial *serial); 228static void edge_disconnect(struct usb_serial *serial);
227static void edge_release(struct usb_serial *serial); 229static void edge_release(struct usb_serial *serial);
@@ -1465,8 +1467,6 @@ static void edge_throttle(struct tty_struct *tty)
1465 if (status != 0) 1467 if (status != 0)
1466 return; 1468 return;
1467 } 1469 }
1468
1469 return;
1470} 1470}
1471 1471
1472 1472
@@ -1568,7 +1568,7 @@ static int get_lsr_info(struct edgeport_port *edge_port,
1568 return 0; 1568 return 0;
1569} 1569}
1570 1570
1571static int edge_tiocmset(struct tty_struct *tty, struct file *file, 1571static int edge_tiocmset(struct tty_struct *tty,
1572 unsigned int set, unsigned int clear) 1572 unsigned int set, unsigned int clear)
1573{ 1573{
1574 struct usb_serial_port *port = tty->driver_data; 1574 struct usb_serial_port *port = tty->driver_data;
@@ -1599,7 +1599,7 @@ static int edge_tiocmset(struct tty_struct *tty, struct file *file,
1599 return 0; 1599 return 0;
1600} 1600}
1601 1601
1602static int edge_tiocmget(struct tty_struct *tty, struct file *file) 1602static int edge_tiocmget(struct tty_struct *tty)
1603{ 1603{
1604 struct usb_serial_port *port = tty->driver_data; 1604 struct usb_serial_port *port = tty->driver_data;
1605 struct edgeport_port *edge_port = usb_get_serial_port_data(port); 1605 struct edgeport_port *edge_port = usb_get_serial_port_data(port);
@@ -1624,6 +1624,31 @@ static int edge_tiocmget(struct tty_struct *tty, struct file *file)
1624 return result; 1624 return result;
1625} 1625}
1626 1626
1627static int edge_get_icount(struct tty_struct *tty,
1628 struct serial_icounter_struct *icount)
1629{
1630 struct usb_serial_port *port = tty->driver_data;
1631 struct edgeport_port *edge_port = usb_get_serial_port_data(port);
1632 struct async_icount cnow;
1633 cnow = edge_port->icount;
1634
1635 icount->cts = cnow.cts;
1636 icount->dsr = cnow.dsr;
1637 icount->rng = cnow.rng;
1638 icount->dcd = cnow.dcd;
1639 icount->rx = cnow.rx;
1640 icount->tx = cnow.tx;
1641 icount->frame = cnow.frame;
1642 icount->overrun = cnow.overrun;
1643 icount->parity = cnow.parity;
1644 icount->brk = cnow.brk;
1645 icount->buf_overrun = cnow.buf_overrun;
1646
1647 dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d",
1648 __func__, port->number, icount->rx, icount->tx);
1649 return 0;
1650}
1651
1627static int get_serial_info(struct edgeport_port *edge_port, 1652static int get_serial_info(struct edgeport_port *edge_port,
1628 struct serial_struct __user *retinfo) 1653 struct serial_struct __user *retinfo)
1629{ 1654{
@@ -1650,12 +1675,11 @@ static int get_serial_info(struct edgeport_port *edge_port,
1650} 1675}
1651 1676
1652 1677
1653
1654/***************************************************************************** 1678/*****************************************************************************
1655 * SerialIoctl 1679 * SerialIoctl
1656 * this function handles any ioctl calls to the driver 1680 * this function handles any ioctl calls to the driver
1657 *****************************************************************************/ 1681 *****************************************************************************/
1658static int edge_ioctl(struct tty_struct *tty, struct file *file, 1682static int edge_ioctl(struct tty_struct *tty,
1659 unsigned int cmd, unsigned long arg) 1683 unsigned int cmd, unsigned long arg)
1660{ 1684{
1661 struct usb_serial_port *port = tty->driver_data; 1685 struct usb_serial_port *port = tty->driver_data;
@@ -1663,7 +1687,6 @@ static int edge_ioctl(struct tty_struct *tty, struct file *file,
1663 struct edgeport_port *edge_port = usb_get_serial_port_data(port); 1687 struct edgeport_port *edge_port = usb_get_serial_port_data(port);
1664 struct async_icount cnow; 1688 struct async_icount cnow;
1665 struct async_icount cprev; 1689 struct async_icount cprev;
1666 struct serial_icounter_struct icount;
1667 1690
1668 dbg("%s - port %d, cmd = 0x%x", __func__, port->number, cmd); 1691 dbg("%s - port %d, cmd = 0x%x", __func__, port->number, cmd);
1669 1692
@@ -1702,26 +1725,6 @@ static int edge_ioctl(struct tty_struct *tty, struct file *file,
1702 /* NOTREACHED */ 1725 /* NOTREACHED */
1703 break; 1726 break;
1704 1727
1705 case TIOCGICOUNT:
1706 cnow = edge_port->icount;
1707 memset(&icount, 0, sizeof(icount));
1708 icount.cts = cnow.cts;
1709 icount.dsr = cnow.dsr;
1710 icount.rng = cnow.rng;
1711 icount.dcd = cnow.dcd;
1712 icount.rx = cnow.rx;
1713 icount.tx = cnow.tx;
1714 icount.frame = cnow.frame;
1715 icount.overrun = cnow.overrun;
1716 icount.parity = cnow.parity;
1717 icount.brk = cnow.brk;
1718 icount.buf_overrun = cnow.buf_overrun;
1719
1720 dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d",
1721 __func__, port->number, icount.rx, icount.tx);
1722 if (copy_to_user((void __user *)arg, &icount, sizeof(icount)))
1723 return -EFAULT;
1724 return 0;
1725 } 1728 }
1726 return -ENOIOCTLCMD; 1729 return -ENOIOCTLCMD;
1727} 1730}
@@ -1770,8 +1773,6 @@ static void edge_break(struct tty_struct *tty, int break_state)
1770 dbg("%s - error sending break set/clear command.", 1773 dbg("%s - error sending break set/clear command.",
1771 __func__); 1774 __func__);
1772 } 1775 }
1773
1774 return;
1775} 1776}
1776 1777
1777 1778
@@ -1980,7 +1981,7 @@ static void process_rcvd_status(struct edgeport_serial *edge_serial,
1980 if (code == IOSP_STATUS_OPEN_RSP) { 1981 if (code == IOSP_STATUS_OPEN_RSP) {
1981 edge_port->txCredits = GET_TX_BUFFER_SIZE(byte3); 1982 edge_port->txCredits = GET_TX_BUFFER_SIZE(byte3);
1982 edge_port->maxTxCredits = edge_port->txCredits; 1983 edge_port->maxTxCredits = edge_port->txCredits;
1983 dbg("%s - Port %u Open Response Inital MSR = %02x TxBufferSize = %d", __func__, edge_serial->rxPort, byte2, edge_port->txCredits); 1984 dbg("%s - Port %u Open Response Initial MSR = %02x TxBufferSize = %d", __func__, edge_serial->rxPort, byte2, edge_port->txCredits);
1984 handle_new_msr(edge_port, byte2); 1985 handle_new_msr(edge_port, byte2);
1985 1986
1986 /* send the current line settings to the port so we are 1987 /* send the current line settings to the port so we are
@@ -2042,7 +2043,6 @@ static void process_rcvd_status(struct edgeport_serial *edge_serial,
2042 dbg("%s - Unrecognized IOSP status code %u", __func__, code); 2043 dbg("%s - Unrecognized IOSP status code %u", __func__, code);
2043 break; 2044 break;
2044 } 2045 }
2045 return;
2046} 2046}
2047 2047
2048 2048
@@ -2095,8 +2095,6 @@ static void handle_new_msr(struct edgeport_port *edge_port, __u8 newMsr)
2095 2095
2096 /* Save the new modem status */ 2096 /* Save the new modem status */
2097 edge_port->shadowMSR = newMsr & 0xf0; 2097 edge_port->shadowMSR = newMsr & 0xf0;
2098
2099 return;
2100} 2098}
2101 2099
2102 2100
@@ -2143,8 +2141,6 @@ static void handle_new_lsr(struct edgeport_port *edge_port, __u8 lsrData,
2143 icount->parity++; 2141 icount->parity++;
2144 if (newLsr & LSR_FRM_ERR) 2142 if (newLsr & LSR_FRM_ERR)
2145 icount->frame++; 2143 icount->frame++;
2146
2147 return;
2148} 2144}
2149 2145
2150 2146
@@ -2347,7 +2343,6 @@ static int write_cmd_usb(struct edgeport_port *edge_port,
2347 usb_get_serial_data(edge_port->port->serial); 2343 usb_get_serial_data(edge_port->port->serial);
2348 int status = 0; 2344 int status = 0;
2349 struct urb *urb; 2345 struct urb *urb;
2350 int timeout;
2351 2346
2352 usb_serial_debug_data(debug, &edge_port->port->dev, 2347 usb_serial_debug_data(debug, &edge_port->port->dev,
2353 __func__, length, buffer); 2348 __func__, length, buffer);
@@ -2380,8 +2375,6 @@ static int write_cmd_usb(struct edgeport_port *edge_port,
2380 return status; 2375 return status;
2381 } 2376 }
2382 2377
2383 /* wait for command to finish */
2384 timeout = COMMAND_TIMEOUT;
2385#if 0 2378#if 0
2386 wait_event(&edge_port->wait_command, !edge_port->commandPending); 2379 wait_event(&edge_port->wait_command, !edge_port->commandPending);
2387 2380
@@ -2720,7 +2713,6 @@ static void change_port_settings(struct tty_struct *tty,
2720 baud = tty_termios_baud_rate(old_termios); 2713 baud = tty_termios_baud_rate(old_termios);
2721 tty_encode_baud_rate(tty, baud, baud); 2714 tty_encode_baud_rate(tty, baud, baud);
2722 } 2715 }
2723 return;
2724} 2716}
2725 2717
2726 2718
@@ -2894,8 +2886,8 @@ static void load_application_firmware(struct edgeport_serial *edge_serial)
2894 2886
2895 dbg("%s %d.%d.%d", fw_info, rec->data[0], rec->data[1], build); 2887 dbg("%s %d.%d.%d", fw_info, rec->data[0], rec->data[1], build);
2896 2888
2897 edge_serial->product_info.FirmwareMajorVersion = fw->data[0]; 2889 edge_serial->product_info.FirmwareMajorVersion = rec->data[0];
2898 edge_serial->product_info.FirmwareMinorVersion = fw->data[1]; 2890 edge_serial->product_info.FirmwareMinorVersion = rec->data[1];
2899 edge_serial->product_info.FirmwareBuildNumber = cpu_to_le16(build); 2891 edge_serial->product_info.FirmwareBuildNumber = cpu_to_le16(build);
2900 2892
2901 for (rec = ihex_next_binrec(rec); rec; 2893 for (rec = ihex_next_binrec(rec); rec;
@@ -2922,7 +2914,6 @@ static void load_application_firmware(struct edgeport_serial *edge_serial)
2922 0x40, 0x4000, 0x0001, NULL, 0, 3000); 2914 0x40, 0x4000, 0x0001, NULL, 0, 3000);
2923 2915
2924 release_firmware(fw); 2916 release_firmware(fw);
2925 return;
2926} 2917}
2927 2918
2928 2919