aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-07-16 12:19:26 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-07-16 12:19:26 -0400
commit46865bf3d6b4ec96e243e333b5a2fac1a790e283 (patch)
treec7c0201e289bc09ba38be66b03a03b0a10f467ec /drivers/usb/serial
parent85bf20d18ac0cf6e729465efcb8758b5db2ec6c2 (diff)
parent5bc9e5933a41888f9e0d77dedc9f8a972fa1f493 (diff)
Merge tag 'usb-serial-3.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial into usb-next
Johan writes: USB-serial updates for v3.17-rc1 Here are some minor fixes and clean-ups to the ftdi_sio, mos7840 and kl5kusb105 drivers for v3.17-rc1. Signed-off-by: Johan Hovold <johan@kernel.org>
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r--drivers/usb/serial/ftdi_sio.c82
1 files changed, 23 insertions, 59 deletions
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 8a3813be1b28..b9035c319766 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -87,7 +87,6 @@ struct ftdi_sio_quirk {
87}; 87};
88 88
89static int ftdi_jtag_probe(struct usb_serial *serial); 89static int ftdi_jtag_probe(struct usb_serial *serial);
90static int ftdi_mtxorb_hack_setup(struct usb_serial *serial);
91static int ftdi_NDI_device_setup(struct usb_serial *serial); 90static int ftdi_NDI_device_setup(struct usb_serial *serial);
92static int ftdi_stmclite_probe(struct usb_serial *serial); 91static int ftdi_stmclite_probe(struct usb_serial *serial);
93static int ftdi_8u2232c_probe(struct usb_serial *serial); 92static int ftdi_8u2232c_probe(struct usb_serial *serial);
@@ -98,10 +97,6 @@ static struct ftdi_sio_quirk ftdi_jtag_quirk = {
98 .probe = ftdi_jtag_probe, 97 .probe = ftdi_jtag_probe,
99}; 98};
100 99
101static struct ftdi_sio_quirk ftdi_mtxorb_hack_quirk = {
102 .probe = ftdi_mtxorb_hack_setup,
103};
104
105static struct ftdi_sio_quirk ftdi_NDI_device_quirk = { 100static struct ftdi_sio_quirk ftdi_NDI_device_quirk = {
106 .probe = ftdi_NDI_device_setup, 101 .probe = ftdi_NDI_device_setup,
107}; 102};
@@ -256,14 +251,12 @@ static const struct usb_device_id id_table_combined[] = {
256 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0124_PID) }, 251 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0124_PID) },
257 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0125_PID) }, 252 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0125_PID) },
258 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0126_PID) }, 253 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0126_PID) },
259 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0127_PID), 254 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0127_PID) },
260 .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk },
261 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0128_PID) }, 255 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0128_PID) },
262 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0129_PID) }, 256 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0129_PID) },
263 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012A_PID) }, 257 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012A_PID) },
264 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012B_PID) }, 258 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012B_PID) },
265 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012C_PID), 259 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012C_PID) },
266 .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk },
267 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012D_PID) }, 260 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012D_PID) },
268 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012E_PID) }, 261 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012E_PID) },
269 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012F_PID) }, 262 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012F_PID) },
@@ -302,18 +295,12 @@ static const struct usb_device_id id_table_combined[] = {
302 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0150_PID) }, 295 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0150_PID) },
303 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0151_PID) }, 296 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0151_PID) },
304 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0152_PID) }, 297 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0152_PID) },
305 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0153_PID), 298 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0153_PID) },
306 .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, 299 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0154_PID) },
307 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0154_PID), 300 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0155_PID) },
308 .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, 301 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0156_PID) },
309 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0155_PID), 302 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0157_PID) },
310 .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, 303 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0158_PID) },
311 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0156_PID),
312 .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk },
313 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0157_PID),
314 .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk },
315 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0158_PID),
316 .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk },
317 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0159_PID) }, 304 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0159_PID) },
318 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_015A_PID) }, 305 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_015A_PID) },
319 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_015B_PID) }, 306 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_015B_PID) },
@@ -1559,45 +1546,40 @@ static void ftdi_determine_type(struct usb_serial_port *port)
1559} 1546}
1560 1547
1561 1548
1562/* Determine the maximum packet size for the device. This depends on the chip 1549/*
1563 * type and the USB host capabilities. The value should be obtained from the 1550 * Determine the maximum packet size for the device. This depends on the chip
1564 * device descriptor as the chip will use the appropriate values for the host.*/ 1551 * type and the USB host capabilities. The value should be obtained from the
1552 * device descriptor as the chip will use the appropriate values for the host.
1553 */
1565static void ftdi_set_max_packet_size(struct usb_serial_port *port) 1554static void ftdi_set_max_packet_size(struct usb_serial_port *port)
1566{ 1555{
1567 struct ftdi_private *priv = usb_get_serial_port_data(port); 1556 struct ftdi_private *priv = usb_get_serial_port_data(port);
1568 struct usb_serial *serial = port->serial; 1557 struct usb_interface *interface = port->serial->interface;
1569 struct usb_device *udev = serial->dev;
1570
1571 struct usb_interface *interface = serial->interface;
1572 struct usb_endpoint_descriptor *ep_desc; 1558 struct usb_endpoint_descriptor *ep_desc;
1573
1574 unsigned num_endpoints; 1559 unsigned num_endpoints;
1575 unsigned i; 1560 unsigned i;
1576 1561
1577 num_endpoints = interface->cur_altsetting->desc.bNumEndpoints; 1562 num_endpoints = interface->cur_altsetting->desc.bNumEndpoints;
1578 dev_info(&udev->dev, "Number of endpoints %d\n", num_endpoints);
1579
1580 if (!num_endpoints) 1563 if (!num_endpoints)
1581 return; 1564 return;
1582 1565
1583 /* NOTE: some customers have programmed FT232R/FT245R devices 1566 /*
1584 * with an endpoint size of 0 - not good. In this case, we 1567 * NOTE: Some customers have programmed FT232R/FT245R devices
1568 * with an endpoint size of 0 - not good. In this case, we
1585 * want to override the endpoint descriptor setting and use a 1569 * want to override the endpoint descriptor setting and use a
1586 * value of 64 for wMaxPacketSize */ 1570 * value of 64 for wMaxPacketSize.
1571 */
1587 for (i = 0; i < num_endpoints; i++) { 1572 for (i = 0; i < num_endpoints; i++) {
1588 dev_info(&udev->dev, "Endpoint %d MaxPacketSize %d\n", i+1,
1589 interface->cur_altsetting->endpoint[i].desc.wMaxPacketSize);
1590 ep_desc = &interface->cur_altsetting->endpoint[i].desc; 1573 ep_desc = &interface->cur_altsetting->endpoint[i].desc;
1591 if (ep_desc->wMaxPacketSize == 0) { 1574 if (!ep_desc->wMaxPacketSize) {
1592 ep_desc->wMaxPacketSize = cpu_to_le16(0x40); 1575 ep_desc->wMaxPacketSize = cpu_to_le16(0x40);
1593 dev_info(&udev->dev, "Overriding wMaxPacketSize on endpoint %d\n", i); 1576 dev_warn(&port->dev, "Overriding wMaxPacketSize on endpoint %d\n",
1577 usb_endpoint_num(ep_desc));
1594 } 1578 }
1595 } 1579 }
1596 1580
1597 /* set max packet size based on descriptor */ 1581 /* Set max packet size based on last descriptor. */
1598 priv->max_packet_size = usb_endpoint_maxp(ep_desc); 1582 priv->max_packet_size = usb_endpoint_maxp(ep_desc);
1599
1600 dev_info(&udev->dev, "Setting MaxPacketSize %d\n", priv->max_packet_size);
1601} 1583}
1602 1584
1603 1585
@@ -1866,24 +1848,6 @@ static int ftdi_stmclite_probe(struct usb_serial *serial)
1866 return 0; 1848 return 0;
1867} 1849}
1868 1850
1869/*
1870 * The Matrix Orbital VK204-25-USB has an invalid IN endpoint.
1871 * We have to correct it if we want to read from it.
1872 */
1873static int ftdi_mtxorb_hack_setup(struct usb_serial *serial)
1874{
1875 struct usb_host_endpoint *ep = serial->dev->ep_in[1];
1876 struct usb_endpoint_descriptor *ep_desc = &ep->desc;
1877
1878 if (ep->enabled && ep_desc->wMaxPacketSize == 0) {
1879 ep_desc->wMaxPacketSize = cpu_to_le16(0x40);
1880 dev_info(&serial->dev->dev,
1881 "Fixing invalid wMaxPacketSize on read pipe\n");
1882 }
1883
1884 return 0;
1885}
1886
1887static int ftdi_sio_port_remove(struct usb_serial_port *port) 1851static int ftdi_sio_port_remove(struct usb_serial_port *port)
1888{ 1852{
1889 struct ftdi_private *priv = usb_get_serial_port_data(port); 1853 struct ftdi_private *priv = usb_get_serial_port_data(port);