aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/ftdi_sio.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/ftdi_sio.c')
-rw-r--r--drivers/usb/serial/ftdi_sio.c138
1 files changed, 64 insertions, 74 deletions
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 0c8d1c226273..be845873e23d 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -48,14 +48,9 @@
48#include "ftdi_sio.h" 48#include "ftdi_sio.h"
49#include "ftdi_sio_ids.h" 49#include "ftdi_sio_ids.h"
50 50
51/*
52 * Version Information
53 */
54#define DRIVER_VERSION "v1.6.0"
55#define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>, Bill Ryder <bryder@sgi.com>, Kuba Ober <kuba@mareimbrium.org>, Andreas Mohr, Johan Hovold <jhovold@gmail.com>" 51#define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>, Bill Ryder <bryder@sgi.com>, Kuba Ober <kuba@mareimbrium.org>, Andreas Mohr, Johan Hovold <jhovold@gmail.com>"
56#define DRIVER_DESC "USB FTDI Serial Converters Driver" 52#define DRIVER_DESC "USB FTDI Serial Converters Driver"
57 53
58static bool debug;
59static __u16 vendor = FTDI_VID; 54static __u16 vendor = FTDI_VID;
60static __u16 product; 55static __u16 product;
61 56
@@ -584,6 +579,8 @@ static struct usb_device_id id_table_combined [] = {
584 { USB_DEVICE(FTDI_VID, FTDI_IBS_PEDO_PID) }, 579 { USB_DEVICE(FTDI_VID, FTDI_IBS_PEDO_PID) },
585 { USB_DEVICE(FTDI_VID, FTDI_IBS_PROD_PID) }, 580 { USB_DEVICE(FTDI_VID, FTDI_IBS_PROD_PID) },
586 { USB_DEVICE(FTDI_VID, FTDI_TAVIR_STK500_PID) }, 581 { USB_DEVICE(FTDI_VID, FTDI_TAVIR_STK500_PID) },
582 { USB_DEVICE(FTDI_VID, FTDI_TIAO_UMPA_PID),
583 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
587 /* 584 /*
588 * ELV devices: 585 * ELV devices:
589 */ 586 */
@@ -1063,11 +1060,12 @@ static int update_mctrl(struct usb_serial_port *port, unsigned int set,
1063 unsigned int clear) 1060 unsigned int clear)
1064{ 1061{
1065 struct ftdi_private *priv = usb_get_serial_port_data(port); 1062 struct ftdi_private *priv = usb_get_serial_port_data(port);
1063 struct device *dev = &port->dev;
1066 unsigned urb_value; 1064 unsigned urb_value;
1067 int rv; 1065 int rv;
1068 1066
1069 if (((set | clear) & (TIOCM_DTR | TIOCM_RTS)) == 0) { 1067 if (((set | clear) & (TIOCM_DTR | TIOCM_RTS)) == 0) {
1070 dbg("%s - DTR|RTS not being set|cleared", __func__); 1068 dev_dbg(dev, "%s - DTR|RTS not being set|cleared\n", __func__);
1071 return 0; /* no change */ 1069 return 0; /* no change */
1072 } 1070 }
1073 1071
@@ -1088,18 +1086,14 @@ static int update_mctrl(struct usb_serial_port *port, unsigned int set,
1088 urb_value, priv->interface, 1086 urb_value, priv->interface,
1089 NULL, 0, WDR_TIMEOUT); 1087 NULL, 0, WDR_TIMEOUT);
1090 if (rv < 0) { 1088 if (rv < 0) {
1091 dbg("%s Error from MODEM_CTRL urb: DTR %s, RTS %s", 1089 dev_dbg(dev, "%s Error from MODEM_CTRL urb: DTR %s, RTS %s\n",
1092 __func__, 1090 __func__,
1093 (set & TIOCM_DTR) ? "HIGH" : 1091 (set & TIOCM_DTR) ? "HIGH" : (clear & TIOCM_DTR) ? "LOW" : "unchanged",
1094 (clear & TIOCM_DTR) ? "LOW" : "unchanged", 1092 (set & TIOCM_RTS) ? "HIGH" : (clear & TIOCM_RTS) ? "LOW" : "unchanged");
1095 (set & TIOCM_RTS) ? "HIGH" :
1096 (clear & TIOCM_RTS) ? "LOW" : "unchanged");
1097 } else { 1093 } else {
1098 dbg("%s - DTR %s, RTS %s", __func__, 1094 dev_dbg(dev, "%s - DTR %s, RTS %s\n", __func__,
1099 (set & TIOCM_DTR) ? "HIGH" : 1095 (set & TIOCM_DTR) ? "HIGH" : (clear & TIOCM_DTR) ? "LOW" : "unchanged",
1100 (clear & TIOCM_DTR) ? "LOW" : "unchanged", 1096 (set & TIOCM_RTS) ? "HIGH" : (clear & TIOCM_RTS) ? "LOW" : "unchanged");
1101 (set & TIOCM_RTS) ? "HIGH" :
1102 (clear & TIOCM_RTS) ? "LOW" : "unchanged");
1103 /* FIXME: locking on last_dtr_rts */ 1097 /* FIXME: locking on last_dtr_rts */
1104 priv->last_dtr_rts = (priv->last_dtr_rts & ~clear) | set; 1098 priv->last_dtr_rts = (priv->last_dtr_rts & ~clear) | set;
1105 } 1099 }
@@ -1111,6 +1105,7 @@ static __u32 get_ftdi_divisor(struct tty_struct *tty,
1111 struct usb_serial_port *port) 1105 struct usb_serial_port *port)
1112{ 1106{
1113 struct ftdi_private *priv = usb_get_serial_port_data(port); 1107 struct ftdi_private *priv = usb_get_serial_port_data(port);
1108 struct device *dev = &port->dev;
1114 __u32 div_value = 0; 1109 __u32 div_value = 0;
1115 int div_okay = 1; 1110 int div_okay = 1;
1116 int baud; 1111 int baud;
@@ -1146,7 +1141,7 @@ static __u32 get_ftdi_divisor(struct tty_struct *tty,
1146 alt_speed hack */ 1141 alt_speed hack */
1147 1142
1148 baud = tty_get_baud_rate(tty); 1143 baud = tty_get_baud_rate(tty);
1149 dbg("%s - tty_get_baud_rate reports speed %d", __func__, baud); 1144 dev_dbg(dev, "%s - tty_get_baud_rate reports speed %d\n", __func__, baud);
1150 1145
1151 /* 2. Observe async-compatible custom_divisor hack, update baudrate 1146 /* 2. Observe async-compatible custom_divisor hack, update baudrate
1152 if needed */ 1147 if needed */
@@ -1155,8 +1150,8 @@ static __u32 get_ftdi_divisor(struct tty_struct *tty,
1155 ((priv->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) && 1150 ((priv->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) &&
1156 (priv->custom_divisor)) { 1151 (priv->custom_divisor)) {
1157 baud = priv->baud_base / priv->custom_divisor; 1152 baud = priv->baud_base / priv->custom_divisor;
1158 dbg("%s - custom divisor %d sets baud rate to %d", 1153 dev_dbg(dev, "%s - custom divisor %d sets baud rate to %d\n",
1159 __func__, priv->custom_divisor, baud); 1154 __func__, priv->custom_divisor, baud);
1160 } 1155 }
1161 1156
1162 /* 3. Convert baudrate to device-specific divisor */ 1157 /* 3. Convert baudrate to device-specific divisor */
@@ -1178,8 +1173,8 @@ static __u32 get_ftdi_divisor(struct tty_struct *tty,
1178 case 115200: div_value = ftdi_sio_b115200; break; 1173 case 115200: div_value = ftdi_sio_b115200; break;
1179 } /* baud */ 1174 } /* baud */
1180 if (div_value == 0) { 1175 if (div_value == 0) {
1181 dbg("%s - Baudrate (%d) requested is not supported", 1176 dev_dbg(dev, "%s - Baudrate (%d) requested is not supported\n",
1182 __func__, baud); 1177 __func__, baud);
1183 div_value = ftdi_sio_b9600; 1178 div_value = ftdi_sio_b9600;
1184 baud = 9600; 1179 baud = 9600;
1185 div_okay = 0; 1180 div_okay = 0;
@@ -1189,7 +1184,7 @@ static __u32 get_ftdi_divisor(struct tty_struct *tty,
1189 if (baud <= 3000000) { 1184 if (baud <= 3000000) {
1190 div_value = ftdi_232am_baud_to_divisor(baud); 1185 div_value = ftdi_232am_baud_to_divisor(baud);
1191 } else { 1186 } else {
1192 dbg("%s - Baud rate too high!", __func__); 1187 dev_dbg(dev, "%s - Baud rate too high!\n", __func__);
1193 baud = 9600; 1188 baud = 9600;
1194 div_value = ftdi_232am_baud_to_divisor(9600); 1189 div_value = ftdi_232am_baud_to_divisor(9600);
1195 div_okay = 0; 1190 div_okay = 0;
@@ -1212,7 +1207,7 @@ static __u32 get_ftdi_divisor(struct tty_struct *tty,
1212 } 1207 }
1213 div_value = ftdi_232bm_baud_to_divisor(baud); 1208 div_value = ftdi_232bm_baud_to_divisor(baud);
1214 } else { 1209 } else {
1215 dbg("%s - Baud rate too high!", __func__); 1210 dev_dbg(dev, "%s - Baud rate too high!\n", __func__);
1216 div_value = ftdi_232bm_baud_to_divisor(9600); 1211 div_value = ftdi_232bm_baud_to_divisor(9600);
1217 div_okay = 0; 1212 div_okay = 0;
1218 baud = 9600; 1213 baud = 9600;
@@ -1226,7 +1221,7 @@ static __u32 get_ftdi_divisor(struct tty_struct *tty,
1226 } else if (baud < 1200) { 1221 } else if (baud < 1200) {
1227 div_value = ftdi_232bm_baud_to_divisor(baud); 1222 div_value = ftdi_232bm_baud_to_divisor(baud);
1228 } else { 1223 } else {
1229 dbg("%s - Baud rate too high!", __func__); 1224 dev_dbg(dev, "%s - Baud rate too high!\n", __func__);
1230 div_value = ftdi_232bm_baud_to_divisor(9600); 1225 div_value = ftdi_232bm_baud_to_divisor(9600);
1231 div_okay = 0; 1226 div_okay = 0;
1232 baud = 9600; 1227 baud = 9600;
@@ -1235,7 +1230,7 @@ static __u32 get_ftdi_divisor(struct tty_struct *tty,
1235 } /* priv->chip_type */ 1230 } /* priv->chip_type */
1236 1231
1237 if (div_okay) { 1232 if (div_okay) {
1238 dbg("%s - Baud rate set to %d (divisor 0x%lX) on chip %s", 1233 dev_dbg(dev, "%s - Baud rate set to %d (divisor 0x%lX) on chip %s\n",
1239 __func__, baud, (unsigned long)div_value, 1234 __func__, baud, (unsigned long)div_value,
1240 ftdi_chip_name[priv->chip_type]); 1235 ftdi_chip_name[priv->chip_type]);
1241 } 1236 }
@@ -1281,7 +1276,7 @@ static int write_latency_timer(struct usb_serial_port *port)
1281 if (priv->flags & ASYNC_LOW_LATENCY) 1276 if (priv->flags & ASYNC_LOW_LATENCY)
1282 l = 1; 1277 l = 1;
1283 1278
1284 dbg("%s: setting latency timer = %i", __func__, l); 1279 dev_dbg(&port->dev, "%s: setting latency timer = %i\n", __func__, l);
1285 1280
1286 rv = usb_control_msg(udev, 1281 rv = usb_control_msg(udev,
1287 usb_sndctrlpipe(udev, 0), 1282 usb_sndctrlpipe(udev, 0),
@@ -1436,8 +1431,8 @@ static void ftdi_determine_type(struct usb_serial_port *port)
1436 1431
1437 version = le16_to_cpu(udev->descriptor.bcdDevice); 1432 version = le16_to_cpu(udev->descriptor.bcdDevice);
1438 interfaces = udev->actconfig->desc.bNumInterfaces; 1433 interfaces = udev->actconfig->desc.bNumInterfaces;
1439 dbg("%s: bcdDevice = 0x%x, bNumInterfaces = %u", __func__, 1434 dev_dbg(&port->dev, "%s: bcdDevice = 0x%x, bNumInterfaces = %u\n", __func__,
1440 version, interfaces); 1435 version, interfaces);
1441 if (interfaces > 1) { 1436 if (interfaces > 1) {
1442 int inter; 1437 int inter;
1443 1438
@@ -1467,8 +1462,9 @@ static void ftdi_determine_type(struct usb_serial_port *port)
1467 /* BM-type devices have a bug where bcdDevice gets set 1462 /* BM-type devices have a bug where bcdDevice gets set
1468 * to 0x200 when iSerialNumber is 0. */ 1463 * to 0x200 when iSerialNumber is 0. */
1469 if (version < 0x500) { 1464 if (version < 0x500) {
1470 dbg("%s: something fishy - bcdDevice too low for multi-interface device", 1465 dev_dbg(&port->dev,
1471 __func__); 1466 "%s: something fishy - bcdDevice too low for multi-interface device\n",
1467 __func__);
1472 } 1468 }
1473 } else if (version < 0x200) { 1469 } else if (version < 0x200) {
1474 /* Old device. Assume it's the original SIO. */ 1470 /* Old device. Assume it's the original SIO. */
@@ -1582,7 +1578,7 @@ static ssize_t store_event_char(struct device *dev,
1582 int v = simple_strtoul(valbuf, NULL, 10); 1578 int v = simple_strtoul(valbuf, NULL, 10);
1583 int rv; 1579 int rv;
1584 1580
1585 dbg("%s: setting event char = %i", __func__, v); 1581 dev_dbg(&port->dev, "%s: setting event char = %i\n", __func__, v);
1586 1582
1587 rv = usb_control_msg(udev, 1583 rv = usb_control_msg(udev,
1588 usb_sndctrlpipe(udev, 0), 1584 usb_sndctrlpipe(udev, 0),
@@ -1591,7 +1587,7 @@ static ssize_t store_event_char(struct device *dev,
1591 v, priv->interface, 1587 v, priv->interface,
1592 NULL, 0, WDR_TIMEOUT); 1588 NULL, 0, WDR_TIMEOUT);
1593 if (rv < 0) { 1589 if (rv < 0) {
1594 dbg("Unable to write event character: %i", rv); 1590 dev_dbg(&port->dev, "Unable to write event character: %i\n", rv);
1595 return -EIO; 1591 return -EIO;
1596 } 1592 }
1597 1593
@@ -1610,7 +1606,7 @@ static int create_sysfs_attrs(struct usb_serial_port *port)
1610 /* XXX I've no idea if the original SIO supports the event_char 1606 /* XXX I've no idea if the original SIO supports the event_char
1611 * sysfs parameter, so I'm playing it safe. */ 1607 * sysfs parameter, so I'm playing it safe. */
1612 if (priv->chip_type != SIO) { 1608 if (priv->chip_type != SIO) {
1613 dbg("sysfs attributes for %s", ftdi_chip_name[priv->chip_type]); 1609 dev_dbg(&port->dev, "sysfs attributes for %s\n", ftdi_chip_name[priv->chip_type]);
1614 retval = device_create_file(&port->dev, &dev_attr_event_char); 1610 retval = device_create_file(&port->dev, &dev_attr_event_char);
1615 if ((!retval) && 1611 if ((!retval) &&
1616 (priv->chip_type == FT232BM || 1612 (priv->chip_type == FT232BM ||
@@ -1750,8 +1746,8 @@ static int ftdi_NDI_device_setup(struct usb_serial *serial)
1750 if (latency > 99) 1746 if (latency > 99)
1751 latency = 99; 1747 latency = 99;
1752 1748
1753 dbg("%s setting NDI device latency to %d", __func__, latency); 1749 dev_dbg(&udev->dev, "%s setting NDI device latency to %d\n", __func__, latency);
1754 dev_info(&udev->dev, "NDI device with a latency value of %d", latency); 1750 dev_info(&udev->dev, "NDI device with a latency value of %d\n", latency);
1755 1751
1756 /* FIXME: errors are not returned */ 1752 /* FIXME: errors are not returned */
1757 usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 1753 usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
@@ -1969,7 +1965,7 @@ static int ftdi_process_packet(struct tty_struct *tty,
1969 char *ch; 1965 char *ch;
1970 1966
1971 if (len < 2) { 1967 if (len < 2) {
1972 dbg("malformed packet"); 1968 dev_dbg(&port->dev, "malformed packet\n");
1973 return 0; 1969 return 0;
1974 } 1970 }
1975 1971
@@ -2084,12 +2080,12 @@ static void ftdi_break_ctl(struct tty_struct *tty, int break_state)
2084 FTDI_SIO_SET_DATA_REQUEST_TYPE, 2080 FTDI_SIO_SET_DATA_REQUEST_TYPE,
2085 urb_value , priv->interface, 2081 urb_value , priv->interface,
2086 NULL, 0, WDR_TIMEOUT) < 0) { 2082 NULL, 0, WDR_TIMEOUT) < 0) {
2087 dev_err(&port->dev, "%s FAILED to enable/disable break state " 2083 dev_err(&port->dev, "%s FAILED to enable/disable break state (state was %d)\n",
2088 "(state was %d)\n", __func__, break_state); 2084 __func__, break_state);
2089 } 2085 }
2090 2086
2091 dbg("%s break state is %d - urb is %d", __func__, 2087 dev_dbg(&port->dev, "%s break state is %d - urb is %d\n", __func__,
2092 break_state, urb_value); 2088 break_state, urb_value);
2093 2089
2094} 2090}
2095 2091
@@ -2101,6 +2097,7 @@ static void ftdi_set_termios(struct tty_struct *tty,
2101 struct usb_serial_port *port, struct ktermios *old_termios) 2097 struct usb_serial_port *port, struct ktermios *old_termios)
2102{ 2098{
2103 struct usb_device *dev = port->serial->dev; 2099 struct usb_device *dev = port->serial->dev;
2100 struct device *ddev = &port->dev;
2104 struct ftdi_private *priv = usb_get_serial_port_data(port); 2101 struct ftdi_private *priv = usb_get_serial_port_data(port);
2105 struct ktermios *termios = &tty->termios; 2102 struct ktermios *termios = &tty->termios;
2106 unsigned int cflag = termios->c_cflag; 2103 unsigned int cflag = termios->c_cflag;
@@ -2114,20 +2111,20 @@ static void ftdi_set_termios(struct tty_struct *tty,
2114 /* Force baud rate if this device requires it, unless it is set to 2111 /* Force baud rate if this device requires it, unless it is set to
2115 B0. */ 2112 B0. */
2116 if (priv->force_baud && ((termios->c_cflag & CBAUD) != B0)) { 2113 if (priv->force_baud && ((termios->c_cflag & CBAUD) != B0)) {
2117 dbg("%s: forcing baud rate for this device", __func__); 2114 dev_dbg(ddev, "%s: forcing baud rate for this device\n", __func__);
2118 tty_encode_baud_rate(tty, priv->force_baud, 2115 tty_encode_baud_rate(tty, priv->force_baud,
2119 priv->force_baud); 2116 priv->force_baud);
2120 } 2117 }
2121 2118
2122 /* Force RTS-CTS if this device requires it. */ 2119 /* Force RTS-CTS if this device requires it. */
2123 if (priv->force_rtscts) { 2120 if (priv->force_rtscts) {
2124 dbg("%s: forcing rtscts for this device", __func__); 2121 dev_dbg(ddev, "%s: forcing rtscts for this device\n", __func__);
2125 termios->c_cflag |= CRTSCTS; 2122 termios->c_cflag |= CRTSCTS;
2126 } 2123 }
2127 2124
2128 cflag = termios->c_cflag; 2125 cflag = termios->c_cflag;
2129 2126
2130 if (old_termios == 0) 2127 if (!old_termios)
2131 goto no_skip; 2128 goto no_skip;
2132 2129
2133 if (old_termios->c_cflag == termios->c_cflag 2130 if (old_termios->c_cflag == termios->c_cflag
@@ -2163,10 +2160,16 @@ no_skip:
2163 } 2160 }
2164 if (cflag & CSIZE) { 2161 if (cflag & CSIZE) {
2165 switch (cflag & CSIZE) { 2162 switch (cflag & CSIZE) {
2166 case CS7: urb_value |= 7; dbg("Setting CS7"); break; 2163 case CS7:
2167 case CS8: urb_value |= 8; dbg("Setting CS8"); break; 2164 urb_value |= 7;
2165 dev_dbg(ddev, "Setting CS7\n");
2166 break;
2167 case CS8:
2168 urb_value |= 8;
2169 dev_dbg(ddev, "Setting CS8\n");
2170 break;
2168 default: 2171 default:
2169 dev_err(&port->dev, "CSIZE was set but not CS7-CS8\n"); 2172 dev_err(ddev, "CSIZE was set but not CS7-CS8\n");
2170 } 2173 }
2171 } 2174 }
2172 2175
@@ -2179,8 +2182,8 @@ no_skip:
2179 FTDI_SIO_SET_DATA_REQUEST_TYPE, 2182 FTDI_SIO_SET_DATA_REQUEST_TYPE,
2180 urb_value , priv->interface, 2183 urb_value , priv->interface,
2181 NULL, 0, WDR_SHORT_TIMEOUT) < 0) { 2184 NULL, 0, WDR_SHORT_TIMEOUT) < 0) {
2182 dev_err(&port->dev, "%s FAILED to set " 2185 dev_err(ddev, "%s FAILED to set databits/stopbits/parity\n",
2183 "databits/stopbits/parity\n", __func__); 2186 __func__);
2184 } 2187 }
2185 2188
2186 /* Now do the baudrate */ 2189 /* Now do the baudrate */
@@ -2192,8 +2195,7 @@ no_data_parity_stop_changes:
2192 FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE, 2195 FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,
2193 0, priv->interface, 2196 0, priv->interface,
2194 NULL, 0, WDR_TIMEOUT) < 0) { 2197 NULL, 0, WDR_TIMEOUT) < 0) {
2195 dev_err(&port->dev, 2198 dev_err(ddev, "%s error from disable flowcontrol urb\n",
2196 "%s error from disable flowcontrol urb\n",
2197 __func__); 2199 __func__);
2198 } 2200 }
2199 /* Drop RTS and DTR */ 2201 /* Drop RTS and DTR */
@@ -2202,8 +2204,7 @@ no_data_parity_stop_changes:
2202 /* set the baudrate determined before */ 2204 /* set the baudrate determined before */
2203 mutex_lock(&priv->cfg_lock); 2205 mutex_lock(&priv->cfg_lock);
2204 if (change_speed(tty, port)) 2206 if (change_speed(tty, port))
2205 dev_err(&port->dev, "%s urb failed to set baudrate\n", 2207 dev_err(ddev, "%s urb failed to set baudrate\n", __func__);
2206 __func__);
2207 mutex_unlock(&priv->cfg_lock); 2208 mutex_unlock(&priv->cfg_lock);
2208 /* Ensure RTS and DTR are raised when baudrate changed from 0 */ 2209 /* Ensure RTS and DTR are raised when baudrate changed from 0 */
2209 if (!old_termios || (old_termios->c_cflag & CBAUD) == B0) 2210 if (!old_termios || (old_termios->c_cflag & CBAUD) == B0)
@@ -2214,17 +2215,15 @@ no_data_parity_stop_changes:
2214 /* Note device also supports DTR/CD (ugh) and Xon/Xoff in hardware */ 2215 /* Note device also supports DTR/CD (ugh) and Xon/Xoff in hardware */
2215no_c_cflag_changes: 2216no_c_cflag_changes:
2216 if (cflag & CRTSCTS) { 2217 if (cflag & CRTSCTS) {
2217 dbg("%s Setting to CRTSCTS flow control", __func__); 2218 dev_dbg(ddev, "%s Setting to CRTSCTS flow control\n", __func__);
2218 if (usb_control_msg(dev, 2219 if (usb_control_msg(dev,
2219 usb_sndctrlpipe(dev, 0), 2220 usb_sndctrlpipe(dev, 0),
2220 FTDI_SIO_SET_FLOW_CTRL_REQUEST, 2221 FTDI_SIO_SET_FLOW_CTRL_REQUEST,
2221 FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE, 2222 FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,
2222 0 , (FTDI_SIO_RTS_CTS_HS | priv->interface), 2223 0 , (FTDI_SIO_RTS_CTS_HS | priv->interface),
2223 NULL, 0, WDR_TIMEOUT) < 0) { 2224 NULL, 0, WDR_TIMEOUT) < 0) {
2224 dev_err(&port->dev, 2225 dev_err(ddev, "urb failed to set to rts/cts flow control\n");
2225 "urb failed to set to rts/cts flow control\n");
2226 } 2226 }
2227
2228 } else { 2227 } else {
2229 /* 2228 /*
2230 * Xon/Xoff code 2229 * Xon/Xoff code
@@ -2234,8 +2233,8 @@ no_c_cflag_changes:
2234 * code is executed. 2233 * code is executed.
2235 */ 2234 */
2236 if (iflag & IXOFF) { 2235 if (iflag & IXOFF) {
2237 dbg("%s request to enable xonxoff iflag=%04x", 2236 dev_dbg(ddev, "%s request to enable xonxoff iflag=%04x\n",
2238 __func__, iflag); 2237 __func__, iflag);
2239 /* Try to enable the XON/XOFF on the ftdi_sio 2238 /* Try to enable the XON/XOFF on the ftdi_sio
2240 * Set the vstart and vstop -- could have been done up 2239 * Set the vstart and vstop -- could have been done up
2241 * above where a lot of other dereferencing is done but 2240 * above where a lot of other dereferencing is done but
@@ -2260,18 +2259,16 @@ no_c_cflag_changes:
2260 /* else clause to only run if cflag ! CRTSCTS and iflag 2259 /* else clause to only run if cflag ! CRTSCTS and iflag
2261 * ! XOFF. CHECKME Assuming XON/XOFF handled by tty 2260 * ! XOFF. CHECKME Assuming XON/XOFF handled by tty
2262 * stack - not by device */ 2261 * stack - not by device */
2263 dbg("%s Turning off hardware flow control", __func__); 2262 dev_dbg(ddev, "%s Turning off hardware flow control\n", __func__);
2264 if (usb_control_msg(dev, 2263 if (usb_control_msg(dev,
2265 usb_sndctrlpipe(dev, 0), 2264 usb_sndctrlpipe(dev, 0),
2266 FTDI_SIO_SET_FLOW_CTRL_REQUEST, 2265 FTDI_SIO_SET_FLOW_CTRL_REQUEST,
2267 FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE, 2266 FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,
2268 0, priv->interface, 2267 0, priv->interface,
2269 NULL, 0, WDR_TIMEOUT) < 0) { 2268 NULL, 0, WDR_TIMEOUT) < 0) {
2270 dev_err(&port->dev, 2269 dev_err(ddev, "urb failed to clear flow control\n");
2271 "urb failed to clear flow control\n");
2272 } 2270 }
2273 } 2271 }
2274
2275 } 2272 }
2276} 2273}
2277 2274
@@ -2365,7 +2362,7 @@ static int ftdi_ioctl(struct tty_struct *tty,
2365 struct async_icount cnow; 2362 struct async_icount cnow;
2366 struct async_icount cprev; 2363 struct async_icount cprev;
2367 2364
2368 dbg("%s cmd 0x%04x", __func__, cmd); 2365 dev_dbg(&port->dev, "%s cmd 0x%04x\n", __func__, cmd);
2369 2366
2370 /* Based on code from acm.c and others */ 2367 /* Based on code from acm.c and others */
2371 switch (cmd) { 2368 switch (cmd) {
@@ -2413,14 +2410,13 @@ static int ftdi_ioctl(struct tty_struct *tty,
2413 /* This is not necessarily an error - turns out the higher layers 2410 /* This is not necessarily an error - turns out the higher layers
2414 * will do some ioctls themselves (see comment above) 2411 * will do some ioctls themselves (see comment above)
2415 */ 2412 */
2416 dbg("%s arg not supported - it was 0x%04x - check /usr/include/asm/ioctls.h", __func__, cmd); 2413 dev_dbg(&port->dev, "%s arg not supported - it was 0x%04x - check /usr/include/asm/ioctls.h\n",
2414 __func__, cmd);
2417 return -ENOIOCTLCMD; 2415 return -ENOIOCTLCMD;
2418} 2416}
2419 2417
2420static int __init ftdi_init(void) 2418static int __init ftdi_init(void)
2421{ 2419{
2422 int retval;
2423
2424 if (vendor > 0 && product > 0) { 2420 if (vendor > 0 && product > 0) {
2425 /* Add user specified VID/PID to reserved element of table. */ 2421 /* Add user specified VID/PID to reserved element of table. */
2426 int i; 2422 int i;
@@ -2430,11 +2426,7 @@ static int __init ftdi_init(void)
2430 id_table_combined[i].idVendor = vendor; 2426 id_table_combined[i].idVendor = vendor;
2431 id_table_combined[i].idProduct = product; 2427 id_table_combined[i].idProduct = product;
2432 } 2428 }
2433 retval = usb_serial_register_drivers(serial_drivers, KBUILD_MODNAME, id_table_combined); 2429 return usb_serial_register_drivers(serial_drivers, KBUILD_MODNAME, id_table_combined);
2434 if (retval == 0)
2435 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
2436 DRIVER_DESC "\n");
2437 return retval;
2438} 2430}
2439 2431
2440static void __exit ftdi_exit(void) 2432static void __exit ftdi_exit(void)
@@ -2450,8 +2442,6 @@ MODULE_AUTHOR(DRIVER_AUTHOR);
2450MODULE_DESCRIPTION(DRIVER_DESC); 2442MODULE_DESCRIPTION(DRIVER_DESC);
2451MODULE_LICENSE("GPL"); 2443MODULE_LICENSE("GPL");
2452 2444
2453module_param(debug, bool, S_IRUGO | S_IWUSR);
2454MODULE_PARM_DESC(debug, "Debug enabled or not");
2455module_param(vendor, ushort, 0); 2445module_param(vendor, ushort, 0);
2456MODULE_PARM_DESC(vendor, "User specified vendor ID (default=" 2446MODULE_PARM_DESC(vendor, "User specified vendor ID (default="
2457 __MODULE_STRING(FTDI_VID)")"); 2447 __MODULE_STRING(FTDI_VID)")");