xref: /openbmc/linux/drivers/usb/serial/ftdi_sio.c (revision e03cdf22a2727c60307be6a729233edab3bfda9c)
11da177e4SLinus Torvalds /*
21da177e4SLinus Torvalds  * USB FTDI SIO driver
31da177e4SLinus Torvalds  *
4659597b7SJohan Hovold  *	Copyright (C) 2009 - 2013
5d3901a06SJohan Hovold  *	    Johan Hovold (jhovold@gmail.com)
61da177e4SLinus Torvalds  *	Copyright (C) 1999 - 2001
71da177e4SLinus Torvalds  *	    Greg Kroah-Hartman (greg@kroah.com)
81da177e4SLinus Torvalds  *          Bill Ryder (bryder@sgi.com)
91da177e4SLinus Torvalds  *	Copyright (C) 2002
101da177e4SLinus Torvalds  *	    Kuba Ober (kuba@mareimbrium.org)
111da177e4SLinus Torvalds  *
121da177e4SLinus Torvalds  *	This program is free software; you can redistribute it and/or modify
131da177e4SLinus Torvalds  *	it under the terms of the GNU General Public License as published by
141da177e4SLinus Torvalds  *	the Free Software Foundation; either version 2 of the License, or
151da177e4SLinus Torvalds  *	(at your option) any later version.
161da177e4SLinus Torvalds  *
17464cbb24SAlan Cox  * See Documentation/usb/usb-serial.txt for more information on using this
18464cbb24SAlan Cox  * driver
191da177e4SLinus Torvalds  *
201da177e4SLinus Torvalds  * See http://ftdi-usb-sio.sourceforge.net for up to date testing info
211da177e4SLinus Torvalds  *	and extra documentation
221da177e4SLinus Torvalds  *
23504b55ccSGreg Kroah-Hartman  * Change entries from 2004 and earlier can be found in versions of this
24504b55ccSGreg Kroah-Hartman  * file in kernel versions prior to the 2.6.24 release.
251da177e4SLinus Torvalds  *
261da177e4SLinus Torvalds  */
271da177e4SLinus Torvalds 
281da177e4SLinus Torvalds /* Bill Ryder - bryder@sgi.com - wrote the FTDI_SIO implementation */
291da177e4SLinus Torvalds /* Thanx to FTDI for so kindly providing details of the protocol required */
301da177e4SLinus Torvalds /*   to talk to the device */
31464cbb24SAlan Cox /* Thanx to gkh and the rest of the usb dev group for all code I have
32464cbb24SAlan Cox    assimilated :-) */
331da177e4SLinus Torvalds 
341da177e4SLinus Torvalds #include <linux/kernel.h>
351da177e4SLinus Torvalds #include <linux/errno.h>
361da177e4SLinus Torvalds #include <linux/slab.h>
371da177e4SLinus Torvalds #include <linux/tty.h>
381da177e4SLinus Torvalds #include <linux/tty_driver.h>
391da177e4SLinus Torvalds #include <linux/tty_flip.h>
401da177e4SLinus Torvalds #include <linux/module.h>
411da177e4SLinus Torvalds #include <linux/spinlock.h>
42bd09a9f5SAlessio Igor Bogani #include <linux/mutex.h>
43464cbb24SAlan Cox #include <linux/uaccess.h>
441da177e4SLinus Torvalds #include <linux/usb.h>
451da177e4SLinus Torvalds #include <linux/serial.h>
46a969888cSGreg Kroah-Hartman #include <linux/usb/serial.h>
471da177e4SLinus Torvalds #include "ftdi_sio.h"
4831844d55SAndreas Mohr #include "ftdi_sio_ids.h"
491da177e4SLinus Torvalds 
50d3901a06SJohan Hovold #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>"
511da177e4SLinus Torvalds #define DRIVER_DESC "USB FTDI Serial Converters Driver"
521da177e4SLinus Torvalds 
531da177e4SLinus Torvalds 
540ffbbe25SOliver Neukum struct ftdi_private {
553bb36aa2SGreg Kroah-Hartman 	enum ftdi_chip_type chip_type;
56464cbb24SAlan Cox 				/* type of device, either SIO or FT8U232AM */
570ffbbe25SOliver Neukum 	int baud_base;		/* baud base clock for divisor setting */
58464cbb24SAlan Cox 	int custom_divisor;	/* custom_divisor kludge, this is for
59464cbb24SAlan Cox 				   baud_base (different from what goes to the
60464cbb24SAlan Cox 				   chip!) */
610ffbbe25SOliver Neukum 	__u16 last_set_data_urb_value ;
62464cbb24SAlan Cox 				/* the last data state set - needed for doing
63464cbb24SAlan Cox 				 * a break
64464cbb24SAlan Cox 				 */
650ffbbe25SOliver Neukum 	int flags;		/* some ASYNC_xxxx flags are supported */
660ffbbe25SOliver Neukum 	unsigned long last_dtr_rts;	/* saved modem control outputs */
67fca5430dSSimon Arlott 	char prev_status;        /* Used for TIOCMIWAIT */
68c466cd2bSGreg Kroah-Hartman 	char transmit_empty;	/* If transmitter is empty or not */
69094c2e6dSMark Adamson 	__u16 interface;	/* FT2232C, FT2232H or FT4232H port interface
70094c2e6dSMark Adamson 				   (0 for FT232/245) */
710ffbbe25SOliver Neukum 
72464cbb24SAlan Cox 	speed_t force_baud;	/* if non-zero, force the baud rate to
73464cbb24SAlan Cox 				   this value */
74464cbb24SAlan Cox 	int force_rtscts;	/* if non-zero, force RTS-CTS to always
75464cbb24SAlan Cox 				   be enabled */
760ffbbe25SOliver Neukum 
77557aaa7fSAlan Cox 	unsigned int latency;		/* latency setting in use */
78895f28baSMark Adamson 	unsigned short max_packet_size;
799c67d28eSAlessio Igor Bogani 	struct mutex cfg_lock; /* Avoid mess by parallel calls of config ioctl() and change_speed() */
800ffbbe25SOliver Neukum };
810ffbbe25SOliver Neukum 
828f977e42SIan Abbott /* struct ftdi_sio_quirk is used by devices requiring special attention. */
838f977e42SIan Abbott struct ftdi_sio_quirk {
84fa91d43bSTony Lindgren 	int (*probe)(struct usb_serial *);
85464cbb24SAlan Cox 	/* Special settings for probed ports. */
86464cbb24SAlan Cox 	void (*port_probe)(struct ftdi_private *);
878f977e42SIan Abbott };
888f977e42SIan Abbott 
8920734345SHarald Welte static int   ftdi_jtag_probe(struct usb_serial *serial);
90b760dac2SMartin Geleynse static int   ftdi_NDI_device_setup(struct usb_serial *serial);
916ec2f46cSJean-Christophe PLAGNIOL-VILLARD static int   ftdi_stmclite_probe(struct usb_serial *serial);
92c96fbdd0SJean-Christophe PLAGNIOL-VILLARD static int   ftdi_8u2232c_probe(struct usb_serial *serial);
930ffbbe25SOliver Neukum static void  ftdi_USB_UIRT_setup(struct ftdi_private *priv);
940ffbbe25SOliver Neukum static void  ftdi_HE_TIRA1_setup(struct ftdi_private *priv);
958f977e42SIan Abbott 
9620734345SHarald Welte static struct ftdi_sio_quirk ftdi_jtag_quirk = {
9720734345SHarald Welte 	.probe	= ftdi_jtag_probe,
98fa91d43bSTony Lindgren };
99fa91d43bSTony Lindgren 
100b760dac2SMartin Geleynse static struct ftdi_sio_quirk ftdi_NDI_device_quirk = {
101b760dac2SMartin Geleynse 	.probe	= ftdi_NDI_device_setup,
102b760dac2SMartin Geleynse };
103b760dac2SMartin Geleynse 
1048f977e42SIan Abbott static struct ftdi_sio_quirk ftdi_USB_UIRT_quirk = {
1050ffbbe25SOliver Neukum 	.port_probe = ftdi_USB_UIRT_setup,
1068f977e42SIan Abbott };
1078f977e42SIan Abbott 
1088f977e42SIan Abbott static struct ftdi_sio_quirk ftdi_HE_TIRA1_quirk = {
1090ffbbe25SOliver Neukum 	.port_probe = ftdi_HE_TIRA1_setup,
1101da177e4SLinus Torvalds };
1111da177e4SLinus Torvalds 
1126ec2f46cSJean-Christophe PLAGNIOL-VILLARD static struct ftdi_sio_quirk ftdi_stmclite_quirk = {
1136ec2f46cSJean-Christophe PLAGNIOL-VILLARD 	.probe	= ftdi_stmclite_probe,
1146ec2f46cSJean-Christophe PLAGNIOL-VILLARD };
1156ec2f46cSJean-Christophe PLAGNIOL-VILLARD 
116c96fbdd0SJean-Christophe PLAGNIOL-VILLARD static struct ftdi_sio_quirk ftdi_8u2232c_quirk = {
117c96fbdd0SJean-Christophe PLAGNIOL-VILLARD 	.probe	= ftdi_8u2232c_probe,
118c96fbdd0SJean-Christophe PLAGNIOL-VILLARD };
119c96fbdd0SJean-Christophe PLAGNIOL-VILLARD 
1201da177e4SLinus Torvalds /*
1211da177e4SLinus Torvalds  * The 8U232AM has the same API as the sio except for:
1221da177e4SLinus Torvalds  * - it can support MUCH higher baudrates; up to:
1231da177e4SLinus Torvalds  *   o 921600 for RS232 and 2000000 for RS422/485 at 48MHz
1241da177e4SLinus Torvalds  *   o 230400 at 12MHz
1251da177e4SLinus Torvalds  *   so .. 8U232AM's baudrate setting codes are different
1261da177e4SLinus Torvalds  * - it has a two byte status code.
1271da177e4SLinus Torvalds  * - it returns characters every 16ms (the FTDI does it every 40ms)
1281da177e4SLinus Torvalds  *
1291da177e4SLinus Torvalds  * the bcdDevice value is used to differentiate FT232BM and FT245BM from
1301da177e4SLinus Torvalds  * the earlier FT8U232AM and FT8U232BM.  For now, include all known VID/PID
1311da177e4SLinus Torvalds  * combinations in both tables.
1328f977e42SIan Abbott  * FIXME: perhaps bcdDevice can also identify 12MHz FT8U232AM devices,
1338f977e42SIan Abbott  * but I don't know if those ever went into mass production. [Ian Abbott]
1341da177e4SLinus Torvalds  */
1351da177e4SLinus Torvalds 
1361da177e4SLinus Torvalds 
1371da177e4SLinus Torvalds 
13865e1ec67SAndreas Mohr /*
139e17c1aa2SJohan Hovold  * Device ID not listed? Test it using
140e17c1aa2SJohan Hovold  * /sys/bus/usb-serial/drivers/ftdi_sio/new_id and send a patch or report.
14165e1ec67SAndreas Mohr  */
1425c6b98ddSJohan Hovold static const struct usb_device_id id_table_combined[] = {
1437f2719f0SPerry Hung 	{ USB_DEVICE(FTDI_VID, FTDI_BRICK_PID) },
144ce7e9065SArtur Zimmer 	{ USB_DEVICE(FTDI_VID, FTDI_ZEITCONTROL_TAGTRACE_MIFARE_PID) },
1455a9443f0SChristian Simon 	{ USB_DEVICE(FTDI_VID, FTDI_CTI_MINI_PID) },
1465a9443f0SChristian Simon 	{ USB_DEVICE(FTDI_VID, FTDI_CTI_NANO_PID) },
1472011e924SJonathan Davies 	{ USB_DEVICE(FTDI_VID, FTDI_AMC232_PID) },
1482011e924SJonathan Davies 	{ USB_DEVICE(FTDI_VID, FTDI_CANUSB_PID) },
14901ba0856SAndrew Ewert 	{ USB_DEVICE(FTDI_VID, FTDI_CANDAPTER_PID) },
1506552cc7fSJohan Hovold 	{ USB_DEVICE(FTDI_VID, FTDI_BM_ATOM_NANO_PID) },
15165e1ec67SAndreas Mohr 	{ USB_DEVICE(FTDI_VID, FTDI_NXTCAM_PID) },
15267847baeSBjørn Mork 	{ USB_DEVICE(FTDI_VID, FTDI_EV3CON_PID) },
1536e1ab3edSPeter Mack 	{ USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_0_PID) },
1546e1ab3edSPeter Mack 	{ USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_1_PID) },
1556e1ab3edSPeter Mack 	{ USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_2_PID) },
1566e1ab3edSPeter Mack 	{ USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_3_PID) },
1576e1ab3edSPeter Mack 	{ USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_4_PID) },
1586e1ab3edSPeter Mack 	{ USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_5_PID) },
1596e1ab3edSPeter Mack 	{ USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_6_PID) },
1606e1ab3edSPeter Mack 	{ USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_7_PID) },
161b6180ef7Sdranch@trinnet.net 	{ USB_DEVICE(FTDI_VID, FTDI_USINT_CAT_PID) },
162b6180ef7Sdranch@trinnet.net 	{ USB_DEVICE(FTDI_VID, FTDI_USINT_WKEY_PID) },
163b6180ef7Sdranch@trinnet.net 	{ USB_DEVICE(FTDI_VID, FTDI_USINT_RS232_PID) },
16472a9f958SRazvan Gavril 	{ USB_DEVICE(FTDI_VID, FTDI_ACTZWAVE_PID) },
1651da177e4SLinus Torvalds 	{ USB_DEVICE(FTDI_VID, FTDI_IRTRANS_PID) },
16669737dfaSLuiz Fernando N. Capitulino 	{ USB_DEVICE(FTDI_VID, FTDI_IPLUS_PID) },
167d099321bSLuiz Fernando N. Capitulino 	{ USB_DEVICE(FTDI_VID, FTDI_IPLUS2_PID) },
168fad14a0dSFrank Sievertsen 	{ USB_DEVICE(FTDI_VID, FTDI_DMX4ALL) },
1691da177e4SLinus Torvalds 	{ USB_DEVICE(FTDI_VID, FTDI_SIO_PID) },
1701da177e4SLinus Torvalds 	{ USB_DEVICE(FTDI_VID, FTDI_8U232AM_PID) },
1711da177e4SLinus Torvalds 	{ USB_DEVICE(FTDI_VID, FTDI_8U232AM_ALT_PID) },
172d8b21606SGard Spreemann 	{ USB_DEVICE(FTDI_VID, FTDI_232RL_PID) },
173c96fbdd0SJean-Christophe PLAGNIOL-VILLARD 	{ USB_DEVICE(FTDI_VID, FTDI_8U2232C_PID) ,
174c96fbdd0SJean-Christophe PLAGNIOL-VILLARD 		.driver_info = (kernel_ulong_t)&ftdi_8u2232c_quirk },
175094c2e6dSMark Adamson 	{ USB_DEVICE(FTDI_VID, FTDI_4232H_PID) },
176309427b6SUwe Bonnes 	{ USB_DEVICE(FTDI_VID, FTDI_232H_PID) },
177dc0827c1SJim Paris 	{ USB_DEVICE(FTDI_VID, FTDI_FTX_PID) },
178c0f8d561SChristophe Mariac 	{ USB_DEVICE(FTDI_VID, FTDI_MICRO_CHAMELEON_PID) },
1791da177e4SLinus Torvalds 	{ USB_DEVICE(FTDI_VID, FTDI_RELAIS_PID) },
1802adb80e9SGuido Scholz 	{ USB_DEVICE(FTDI_VID, FTDI_OPENDCC_PID) },
181ec3815c3Smail@rainerkeller.de 	{ USB_DEVICE(FTDI_VID, FTDI_OPENDCC_SNIFFER_PID) },
182ec3815c3Smail@rainerkeller.de 	{ USB_DEVICE(FTDI_VID, FTDI_OPENDCC_THROTTLE_PID) },
183ec3815c3Smail@rainerkeller.de 	{ USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GATEWAY_PID) },
18499c1e4f8SRainer Keller 	{ USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GBM_PID) },
18558f8b6c4SStefani Seibold 	{ USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GBM_BOOST_PID) },
186d7e14b37SMartin Teichmann 	{ USB_DEVICE(NEWPORT_VID, NEWPORT_AGILIS_PID) },
18771381439SGomella, Andrew (NIH/NHLBI) [F] 	{ USB_DEVICE(NEWPORT_VID, NEWPORT_CONEX_CC_PID) },
18871381439SGomella, Andrew (NIH/NHLBI) [F] 	{ USB_DEVICE(NEWPORT_VID, NEWPORT_CONEX_AGP_PID) },
1891da177e4SLinus Torvalds 	{ USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) },
1901da177e4SLinus Torvalds 	{ USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) },
191f2ee6955SAlan Cox 	{ USB_DEVICE(FTDI_VID, FTDI_SPROG_II) },
19276f24e3fSUlrich Hahn 	{ USB_DEVICE(FTDI_VID, FTDI_TAGSYS_LP101_PID) },
19376f24e3fSUlrich Hahn 	{ USB_DEVICE(FTDI_VID, FTDI_TAGSYS_P200X_PID) },
194ea233f80SGalen Seitz 	{ USB_DEVICE(FTDI_VID, FTDI_LENZ_LIUSB_PID) },
1951da177e4SLinus Torvalds 	{ USB_DEVICE(FTDI_VID, FTDI_XF_632_PID) },
1961da177e4SLinus Torvalds 	{ USB_DEVICE(FTDI_VID, FTDI_XF_634_PID) },
1971da177e4SLinus Torvalds 	{ USB_DEVICE(FTDI_VID, FTDI_XF_547_PID) },
1981da177e4SLinus Torvalds 	{ USB_DEVICE(FTDI_VID, FTDI_XF_633_PID) },
1991da177e4SLinus Torvalds 	{ USB_DEVICE(FTDI_VID, FTDI_XF_631_PID) },
2001da177e4SLinus Torvalds 	{ USB_DEVICE(FTDI_VID, FTDI_XF_635_PID) },
2011da177e4SLinus Torvalds 	{ USB_DEVICE(FTDI_VID, FTDI_XF_640_PID) },
2021da177e4SLinus Torvalds 	{ USB_DEVICE(FTDI_VID, FTDI_XF_642_PID) },
2031da177e4SLinus Torvalds 	{ USB_DEVICE(FTDI_VID, FTDI_DSS20_PID) },
20474bdf22bSHakan Kvist 	{ USB_DEVICE(FTDI_VID, FTDI_URBAN_0_PID) },
20574bdf22bSHakan Kvist 	{ USB_DEVICE(FTDI_VID, FTDI_URBAN_1_PID) },
2061da177e4SLinus Torvalds 	{ USB_DEVICE(FTDI_NF_RIC_VID, FTDI_NF_RIC_PID) },
2071da177e4SLinus Torvalds 	{ USB_DEVICE(FTDI_VID, FTDI_VNHCPCUSB_D_PID) },
2088f977e42SIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_MTXORB_0_PID) },
2098f977e42SIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_MTXORB_1_PID) },
2108f977e42SIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_MTXORB_2_PID) },
2118f977e42SIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_MTXORB_3_PID) },
2128f977e42SIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_MTXORB_4_PID) },
2138f977e42SIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_MTXORB_5_PID) },
2148f977e42SIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) },
215b34efeeaSFolkert van Heusden 	{ USB_DEVICE(FTDI_VID, FTDI_R2000KU_TRUE_RNG) },
2166fdbad80SJacques Viviers 	{ USB_DEVICE(FTDI_VID, FTDI_VARDAAN_PID) },
217ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0100_PID) },
218ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0101_PID) },
219ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0102_PID) },
220ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0103_PID) },
221ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0104_PID) },
222ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0105_PID) },
223ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0106_PID) },
224ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0107_PID) },
225ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0108_PID) },
226ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0109_PID) },
227ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_010A_PID) },
228ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_010B_PID) },
229ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_010C_PID) },
230ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_010D_PID) },
231ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_010E_PID) },
232ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_010F_PID) },
233ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0110_PID) },
234ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0111_PID) },
235ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0112_PID) },
236ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0113_PID) },
237ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0114_PID) },
238ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0115_PID) },
239ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0116_PID) },
240ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0117_PID) },
241ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0118_PID) },
242ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0119_PID) },
243ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_011A_PID) },
244ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_011B_PID) },
245ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_011C_PID) },
246ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_011D_PID) },
247ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_011E_PID) },
248ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_011F_PID) },
249ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0120_PID) },
250ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0121_PID) },
251ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0122_PID) },
252ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0123_PID) },
253ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0124_PID) },
254ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0125_PID) },
255ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0126_PID) },
25619de4278SJohan Hovold 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0127_PID) },
257ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0128_PID) },
258ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0129_PID) },
259ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012A_PID) },
260ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012B_PID) },
26119de4278SJohan Hovold 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012C_PID) },
262ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012D_PID) },
263ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012E_PID) },
264ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012F_PID) },
265ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0130_PID) },
266ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0131_PID) },
267ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0132_PID) },
268ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0133_PID) },
269ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0134_PID) },
270ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0135_PID) },
271ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0136_PID) },
272ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0137_PID) },
273ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0138_PID) },
274ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0139_PID) },
275ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_013A_PID) },
276ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_013B_PID) },
277ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_013C_PID) },
278ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_013D_PID) },
279ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_013E_PID) },
280ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_013F_PID) },
281ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0140_PID) },
282ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0141_PID) },
283ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0142_PID) },
284ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0143_PID) },
285ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0144_PID) },
286ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0145_PID) },
287ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0146_PID) },
288ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0147_PID) },
289ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0148_PID) },
290ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0149_PID) },
291ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_014A_PID) },
292ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_014B_PID) },
293ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_014C_PID) },
294ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_014D_PID) },
295ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_014E_PID) },
296ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_014F_PID) },
297ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0150_PID) },
298ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0151_PID) },
299ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0152_PID) },
30019de4278SJohan Hovold 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0153_PID) },
30119de4278SJohan Hovold 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0154_PID) },
30219de4278SJohan Hovold 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0155_PID) },
30319de4278SJohan Hovold 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0156_PID) },
30419de4278SJohan Hovold 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0157_PID) },
30519de4278SJohan Hovold 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0158_PID) },
306ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0159_PID) },
307ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_015A_PID) },
308ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_015B_PID) },
309ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_015C_PID) },
310ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_015D_PID) },
311ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_015E_PID) },
312ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_015F_PID) },
313ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0160_PID) },
314ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0161_PID) },
315ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0162_PID) },
316ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0163_PID) },
317ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0164_PID) },
318ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0165_PID) },
319ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0166_PID) },
320ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0167_PID) },
321ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0168_PID) },
322ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0169_PID) },
323ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_016A_PID) },
324ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_016B_PID) },
325ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_016C_PID) },
326ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_016D_PID) },
327ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_016E_PID) },
328ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_016F_PID) },
329ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0170_PID) },
330ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0171_PID) },
331ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0172_PID) },
332ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0173_PID) },
333ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0174_PID) },
334ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0175_PID) },
335ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0176_PID) },
336ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0177_PID) },
337ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0178_PID) },
338ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0179_PID) },
339ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_017A_PID) },
340ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_017B_PID) },
341ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_017C_PID) },
342ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_017D_PID) },
343ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_017E_PID) },
344ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_017F_PID) },
345ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0180_PID) },
346ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0181_PID) },
347ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0182_PID) },
348ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0183_PID) },
349ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0184_PID) },
350ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0185_PID) },
351ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0186_PID) },
352ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0187_PID) },
353ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0188_PID) },
354ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0189_PID) },
355ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_018A_PID) },
356ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_018B_PID) },
357ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_018C_PID) },
358ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_018D_PID) },
359ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_018E_PID) },
360ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_018F_PID) },
361ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0190_PID) },
362ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0191_PID) },
363ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0192_PID) },
364ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0193_PID) },
365ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0194_PID) },
366ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0195_PID) },
367ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0196_PID) },
368ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0197_PID) },
369ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0198_PID) },
370ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0199_PID) },
371ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_019A_PID) },
372ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_019B_PID) },
373ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_019C_PID) },
374ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_019D_PID) },
375ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_019E_PID) },
376ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_019F_PID) },
377ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A0_PID) },
378ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A1_PID) },
379ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A2_PID) },
380ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A3_PID) },
381ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A4_PID) },
382ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A5_PID) },
383ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A6_PID) },
384ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A7_PID) },
385ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A8_PID) },
386ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A9_PID) },
387ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01AA_PID) },
388ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01AB_PID) },
389ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01AC_PID) },
390ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01AD_PID) },
391ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01AE_PID) },
392ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01AF_PID) },
393ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B0_PID) },
394ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B1_PID) },
395ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B2_PID) },
396ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B3_PID) },
397ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B4_PID) },
398ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B5_PID) },
399ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B6_PID) },
400ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B7_PID) },
401ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B8_PID) },
402ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B9_PID) },
403ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01BA_PID) },
404ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01BB_PID) },
405ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01BC_PID) },
406ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01BD_PID) },
407ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01BE_PID) },
408ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01BF_PID) },
409ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C0_PID) },
410ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C1_PID) },
411ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C2_PID) },
412ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C3_PID) },
413ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C4_PID) },
414ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C5_PID) },
415ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C6_PID) },
416ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C7_PID) },
417ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C8_PID) },
418ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C9_PID) },
419ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01CA_PID) },
420ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01CB_PID) },
421ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01CC_PID) },
422ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01CD_PID) },
423ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01CE_PID) },
424ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01CF_PID) },
425ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D0_PID) },
426ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D1_PID) },
427ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D2_PID) },
428ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D3_PID) },
429ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D4_PID) },
430ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D5_PID) },
431ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D6_PID) },
432ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D7_PID) },
433ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D8_PID) },
434ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D9_PID) },
435ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01DA_PID) },
436ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01DB_PID) },
437ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01DC_PID) },
438ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01DD_PID) },
439ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01DE_PID) },
440ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01DF_PID) },
441ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E0_PID) },
442ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E1_PID) },
443ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E2_PID) },
444ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E3_PID) },
445ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E4_PID) },
446ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E5_PID) },
447ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E6_PID) },
448ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E7_PID) },
449ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E8_PID) },
450ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E9_PID) },
451ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01EA_PID) },
452ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01EB_PID) },
453ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01EC_PID) },
454ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01ED_PID) },
455ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01EE_PID) },
456ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01EF_PID) },
457ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F0_PID) },
458ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F1_PID) },
459ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F2_PID) },
460ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F3_PID) },
461ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F4_PID) },
462ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F5_PID) },
463ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F6_PID) },
464ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F7_PID) },
465ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F8_PID) },
466ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F9_PID) },
467ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FA_PID) },
468ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FB_PID) },
469ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FC_PID) },
470ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FD_PID) },
471ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FE_PID) },
472ebb3770cSRay Molenkamp 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FF_PID) },
473204ec6e0STroy Clark 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_4701_PID) },
474204ec6e0STroy Clark 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9300_PID) },
475204ec6e0STroy Clark 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9301_PID) },
476204ec6e0STroy Clark 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9302_PID) },
477204ec6e0STroy Clark 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9303_PID) },
478204ec6e0STroy Clark 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9304_PID) },
479204ec6e0STroy Clark 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9305_PID) },
480204ec6e0STroy Clark 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9306_PID) },
481204ec6e0STroy Clark 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9307_PID) },
482204ec6e0STroy Clark 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9308_PID) },
483204ec6e0STroy Clark 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9309_PID) },
484204ec6e0STroy Clark 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930A_PID) },
485204ec6e0STroy Clark 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930B_PID) },
486204ec6e0STroy Clark 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930C_PID) },
487204ec6e0STroy Clark 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930D_PID) },
488204ec6e0STroy Clark 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930E_PID) },
489204ec6e0STroy Clark 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930F_PID) },
490204ec6e0STroy Clark 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9310_PID) },
491204ec6e0STroy Clark 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9311_PID) },
492204ec6e0STroy Clark 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9312_PID) },
493204ec6e0STroy Clark 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9313_PID) },
494204ec6e0STroy Clark 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9314_PID) },
495204ec6e0STroy Clark 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9315_PID) },
496204ec6e0STroy Clark 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9316_PID) },
497204ec6e0STroy Clark 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9317_PID) },
498204ec6e0STroy Clark 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9318_PID) },
499204ec6e0STroy Clark 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9319_PID) },
500204ec6e0STroy Clark 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931A_PID) },
501204ec6e0STroy Clark 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931B_PID) },
502204ec6e0STroy Clark 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931C_PID) },
503204ec6e0STroy Clark 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931D_PID) },
504204ec6e0STroy Clark 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931E_PID) },
505204ec6e0STroy Clark 	{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931F_PID) },
5068f977e42SIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) },
5071da177e4SLinus Torvalds 	{ USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) },
508274a4bbcSDave Platt 	{ USB_DEVICE(FTDI_VID, FTDI_TNC_X_PID) },
509868e440dSJelle Foks 	{ USB_DEVICE(FTDI_VID, FTDI_USBX_707_PID) },
5101da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2101_PID) },
5111da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2102_PID) },
5121da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2103_PID) },
5131da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2104_PID) },
514a1484827SJustin Carlson 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2106_PID) },
5151da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2201_1_PID) },
5161da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2201_2_PID) },
5171da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2202_1_PID) },
5181da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2202_2_PID) },
5191da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2203_1_PID) },
5201da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2203_2_PID) },
5211da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2401_1_PID) },
5221da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2401_2_PID) },
5231da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2401_3_PID) },
5241da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2401_4_PID) },
5251da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2402_1_PID) },
5261da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2402_2_PID) },
5271da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2402_3_PID) },
5281da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2402_4_PID) },
5291da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2403_1_PID) },
5301da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2403_2_PID) },
5311da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2403_3_PID) },
5321da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2403_4_PID) },
5331da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2801_1_PID) },
5341da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2801_2_PID) },
5351da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2801_3_PID) },
5361da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2801_4_PID) },
5371da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2801_5_PID) },
5381da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2801_6_PID) },
5391da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2801_7_PID) },
5401da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2801_8_PID) },
5411da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2802_1_PID) },
5421da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2802_2_PID) },
5431da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2802_3_PID) },
5441da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2802_4_PID) },
5451da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2802_5_PID) },
5461da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2802_6_PID) },
5471da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2802_7_PID) },
5481da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2802_8_PID) },
5491da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_1_PID) },
5501da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_2_PID) },
5511da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_3_PID) },
5521da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_4_PID) },
5531da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_5_PID) },
5541da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_6_PID) },
5551da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_7_PID) },
5561da177e4SLinus Torvalds 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_8_PID) },
5576d161b99SScott Dial 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803R_1_PID) },
5586d161b99SScott Dial 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803R_2_PID) },
5596d161b99SScott Dial 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803R_3_PID) },
5606d161b99SScott Dial 	{ USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803R_4_PID) },
5611da177e4SLinus Torvalds 	{ USB_DEVICE(IDTECH_VID, IDTECH_IDT1221U_PID) },
5621da177e4SLinus Torvalds 	{ USB_DEVICE(OCT_VID, OCT_US101_PID) },
56311a31d84SJohan Hovold 	{ USB_DEVICE(OCT_VID, OCT_DK201_PID) },
5648f977e42SIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_HE_TIRA1_PID),
5658f977e42SIan Abbott 		.driver_info = (kernel_ulong_t)&ftdi_HE_TIRA1_quirk },
5668f977e42SIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_USB_UIRT_PID),
5678f977e42SIan Abbott 		.driver_info = (kernel_ulong_t)&ftdi_USB_UIRT_quirk },
5681da177e4SLinus Torvalds 	{ USB_DEVICE(FTDI_VID, PROTEGO_SPECIAL_1) },
5691da177e4SLinus Torvalds 	{ USB_DEVICE(FTDI_VID, PROTEGO_R2X0) },
5701da177e4SLinus Torvalds 	{ USB_DEVICE(FTDI_VID, PROTEGO_SPECIAL_3) },
5711da177e4SLinus Torvalds 	{ USB_DEVICE(FTDI_VID, PROTEGO_SPECIAL_4) },
5728f977e42SIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E808_PID) },
5738f977e42SIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E809_PID) },
5748f977e42SIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E80A_PID) },
5758f977e42SIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E80B_PID) },
5768f977e42SIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E80C_PID) },
5778f977e42SIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E80D_PID) },
5788f977e42SIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E80E_PID) },
5798f977e42SIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E80F_PID) },
5808f977e42SIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E888_PID) },
5818f977e42SIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E889_PID) },
5828f977e42SIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E88A_PID) },
5838f977e42SIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E88B_PID) },
5848f977e42SIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E88C_PID) },
5858f977e42SIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E88D_PID) },
5868f977e42SIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E88E_PID) },
5878f977e42SIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E88F_PID) },
5881da177e4SLinus Torvalds 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_UO100_PID) },
58947900743SIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_UM100_PID) },
590e6ac4a40SIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_UR100_PID) },
591e6ac4a40SIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_ALC8500_PID) },
592207c47e1SThomas Riewe 	{ USB_DEVICE(FTDI_VID, FTDI_PYRAMID_PID) },
593bde62185SMartin Hagelin 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_FHZ1000PC_PID) },
5944eaf60e0SThomas Schleusener 	{ USB_DEVICE(FTDI_VID, FTDI_IBS_US485_PID) },
5954eaf60e0SThomas Schleusener 	{ USB_DEVICE(FTDI_VID, FTDI_IBS_PICPRO_PID) },
5964eaf60e0SThomas Schleusener 	{ USB_DEVICE(FTDI_VID, FTDI_IBS_PCMCIA_PID) },
5974eaf60e0SThomas Schleusener 	{ USB_DEVICE(FTDI_VID, FTDI_IBS_PK1_PID) },
5984eaf60e0SThomas Schleusener 	{ USB_DEVICE(FTDI_VID, FTDI_IBS_RS232MON_PID) },
5994eaf60e0SThomas Schleusener 	{ USB_DEVICE(FTDI_VID, FTDI_IBS_APP70_PID) },
6004eaf60e0SThomas Schleusener 	{ USB_DEVICE(FTDI_VID, FTDI_IBS_PEDO_PID) },
6014eaf60e0SThomas Schleusener 	{ USB_DEVICE(FTDI_VID, FTDI_IBS_PROD_PID) },
60237909fe5SBenedek László 	{ USB_DEVICE(FTDI_VID, FTDI_TAVIR_STK500_PID) },
60354575b05SAntonio Ospite 	{ USB_DEVICE(FTDI_VID, FTDI_TIAO_UMPA_PID),
60454575b05SAntonio Ospite 		.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
605d0839d75SGeorge McCollister 	{ USB_DEVICE(FTDI_VID, FTDI_NT_ORIONLXM_PID),
606d0839d75SGeorge McCollister 		.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
6074899c054SDoug Goldstein 	{ USB_DEVICE(FTDI_VID, FTDI_SYNAPSE_SS200_PID) },
6081fb8dc36SMatthijs Kooijman 	{ USB_DEVICE(FTDI_VID, FTDI_CUSTOMWARE_MINIPLEX_PID) },
6091fb8dc36SMatthijs Kooijman 	{ USB_DEVICE(FTDI_VID, FTDI_CUSTOMWARE_MINIPLEX2_PID) },
6101fb8dc36SMatthijs Kooijman 	{ USB_DEVICE(FTDI_VID, FTDI_CUSTOMWARE_MINIPLEX2WI_PID) },
6111fb8dc36SMatthijs Kooijman 	{ USB_DEVICE(FTDI_VID, FTDI_CUSTOMWARE_MINIPLEX3_PID) },
612e6ac4a40SIan Abbott 	/*
61365e1ec67SAndreas Mohr 	 * ELV devices:
614e6ac4a40SIan Abbott 	 */
615c249f911SSven Killig 	{ USB_DEVICE(FTDI_ELV_VID, FTDI_ELV_WS300_PID) },
61665e1ec67SAndreas Mohr 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_USR_PID) },
61765e1ec67SAndreas Mohr 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_MSM1_PID) },
61865e1ec67SAndreas Mohr 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_KL100_PID) },
61965e1ec67SAndreas Mohr 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_WS550_PID) },
62065e1ec67SAndreas Mohr 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_EC3000_PID) },
62165e1ec67SAndreas Mohr 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_WS888_PID) },
62265e1ec67SAndreas Mohr 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_TWS550_PID) },
62365e1ec67SAndreas Mohr 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_FEM_PID) },
62442f8aa94SPeter Stark 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_CLI7000_PID) },
62542f8aa94SPeter Stark 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_PPS7330_PID) },
62642f8aa94SPeter Stark 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_TFM100_PID) },
62742f8aa94SPeter Stark 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_UDF77_PID) },
62842f8aa94SPeter Stark 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_UIO88_PID) },
62942f8aa94SPeter Stark 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_UAD8_PID) },
63042f8aa94SPeter Stark 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_UDA7_PID) },
63142f8aa94SPeter Stark 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_USI2_PID) },
63242f8aa94SPeter Stark 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_T1100_PID) },
63342f8aa94SPeter Stark 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_PCD200_PID) },
63442f8aa94SPeter Stark 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_ULA200_PID) },
63542f8aa94SPeter Stark 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_CSI8_PID) },
63642f8aa94SPeter Stark 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_EM1000DL_PID) },
63742f8aa94SPeter Stark 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_PCK100_PID) },
63842f8aa94SPeter Stark 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_RFP500_PID) },
63942f8aa94SPeter Stark 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_FS20SIG_PID) },
64065e1ec67SAndreas Mohr 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_UTP8_PID) },
64142f8aa94SPeter Stark 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_WS300PC_PID) },
64265e1ec67SAndreas Mohr 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_WS444PC_PID) },
64342f8aa94SPeter Stark 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_FHZ1300PC_PID) },
6444ae897dfSSven Andersen 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_EM1010PC_PID) },
64542f8aa94SPeter Stark 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_WS500_PID) },
646b5894a50SAndré Schenk 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_HS485_PID) },
64765e1ec67SAndreas Mohr 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_UMS100_PID) },
64865e1ec67SAndreas Mohr 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_TFD128_PID) },
64965e1ec67SAndreas Mohr 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_FM3RX_PID) },
65065e1ec67SAndreas Mohr 	{ USB_DEVICE(FTDI_VID, FTDI_ELV_WS777_PID) },
6518f977e42SIan Abbott 	{ USB_DEVICE(FTDI_VID, LINX_SDMUSBQSS_PID) },
6528f977e42SIan Abbott 	{ USB_DEVICE(FTDI_VID, LINX_MASTERDEVEL2_PID) },
6538f977e42SIan Abbott 	{ USB_DEVICE(FTDI_VID, LINX_FUTURE_0_PID) },
6548f977e42SIan Abbott 	{ USB_DEVICE(FTDI_VID, LINX_FUTURE_1_PID) },
6558f977e42SIan Abbott 	{ USB_DEVICE(FTDI_VID, LINX_FUTURE_2_PID) },
6561da177e4SLinus Torvalds 	{ USB_DEVICE(FTDI_VID, FTDI_CCSICDU20_0_PID) },
6571da177e4SLinus Torvalds 	{ USB_DEVICE(FTDI_VID, FTDI_CCSICDU40_1_PID) },
658ec434e9bSJan Capek 	{ USB_DEVICE(FTDI_VID, FTDI_CCSMACHX_2_PID) },
6599d37ff64SJan Capek 	{ USB_DEVICE(FTDI_VID, FTDI_CCSLOAD_N_GO_3_PID) },
6609d37ff64SJan Capek 	{ USB_DEVICE(FTDI_VID, FTDI_CCSICDU64_4_PID) },
6619d37ff64SJan Capek 	{ USB_DEVICE(FTDI_VID, FTDI_CCSPRIME8_5_PID) },
6621da177e4SLinus Torvalds 	{ USB_DEVICE(FTDI_VID, INSIDE_ACCESSO) },
6631da177e4SLinus Torvalds 	{ USB_DEVICE(INTREPID_VID, INTREPID_VALUECAN_PID) },
6641da177e4SLinus Torvalds 	{ USB_DEVICE(INTREPID_VID, INTREPID_NEOVI_PID) },
6651da177e4SLinus Torvalds 	{ USB_DEVICE(FALCOM_VID, FALCOM_TWIST_PID) },
666e6ac4a40SIan Abbott 	{ USB_DEVICE(FALCOM_VID, FALCOM_SAMBA_PID) },
6671da177e4SLinus Torvalds 	{ USB_DEVICE(FTDI_VID, FTDI_SUUNTO_SPORTS_PID) },
668c3d36c45SVladimir Vukicevic 	{ USB_DEVICE(FTDI_VID, FTDI_OCEANIC_PID) },
669ef31fec0SMichael Olberg 	{ USB_DEVICE(TTI_VID, TTI_QL355P_PID) },
6706f92872cSIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_RM_CANVIEW_PID) },
67128fe2eb0SMichael Williamson 	{ USB_DEVICE(ACTON_VID, ACTON_SPECTRAPRO_PID) },
67246b72d78SDaniel Sangorrin 	{ USB_DEVICE(CONTEC_VID, CONTEC_COM1USBH_PID) },
673482b0b5dSKonstantin Holoborodko 	{ USB_DEVICE(MITSUBISHI_VID, MITSUBISHI_FXUSB_PID) },
6741da177e4SLinus Torvalds 	{ USB_DEVICE(BANDB_VID, BANDB_USOTL4_PID) },
6751da177e4SLinus Torvalds 	{ USB_DEVICE(BANDB_VID, BANDB_USTL4_PID) },
6761da177e4SLinus Torvalds 	{ USB_DEVICE(BANDB_VID, BANDB_USO9ML2_PID) },
677a8cbd90aSCliff Brake 	{ USB_DEVICE(BANDB_VID, BANDB_USOPTL4_PID) },
678a8cbd90aSCliff Brake 	{ USB_DEVICE(BANDB_VID, BANDB_USPTL4_PID) },
679a8cbd90aSCliff Brake 	{ USB_DEVICE(BANDB_VID, BANDB_USO9ML2DR_2_PID) },
680a8cbd90aSCliff Brake 	{ USB_DEVICE(BANDB_VID, BANDB_USO9ML2DR_PID) },
681a8cbd90aSCliff Brake 	{ USB_DEVICE(BANDB_VID, BANDB_USOPTL4DR2_PID) },
682a8cbd90aSCliff Brake 	{ USB_DEVICE(BANDB_VID, BANDB_USOPTL4DR_PID) },
683a8cbd90aSCliff Brake 	{ USB_DEVICE(BANDB_VID, BANDB_485USB9F_2W_PID) },
684a8cbd90aSCliff Brake 	{ USB_DEVICE(BANDB_VID, BANDB_485USB9F_4W_PID) },
685a8cbd90aSCliff Brake 	{ USB_DEVICE(BANDB_VID, BANDB_232USB9M_PID) },
686a8cbd90aSCliff Brake 	{ USB_DEVICE(BANDB_VID, BANDB_485USBTB_2W_PID) },
687a8cbd90aSCliff Brake 	{ USB_DEVICE(BANDB_VID, BANDB_485USBTB_4W_PID) },
688a8cbd90aSCliff Brake 	{ USB_DEVICE(BANDB_VID, BANDB_TTL5USB9M_PID) },
689a8cbd90aSCliff Brake 	{ USB_DEVICE(BANDB_VID, BANDB_TTL3USB9M_PID) },
690a8cbd90aSCliff Brake 	{ USB_DEVICE(BANDB_VID, BANDB_ZZ_PROG1_USB_PID) },
6911da177e4SLinus Torvalds 	{ USB_DEVICE(FTDI_VID, EVER_ECO_PRO_CDS) },
6926f92872cSIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_1_PID) },
6936f92872cSIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_2_PID) },
694a26d31ceSSteffen Sledz 	{ USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_3_PID) },
695e6ac4a40SIan Abbott 	{ USB_DEVICE(FTDI_VID, XSENS_CONVERTER_0_PID) },
696e6ac4a40SIan Abbott 	{ USB_DEVICE(FTDI_VID, XSENS_CONVERTER_1_PID) },
697e6ac4a40SIan Abbott 	{ USB_DEVICE(FTDI_VID, XSENS_CONVERTER_2_PID) },
698e6ac4a40SIan Abbott 	{ USB_DEVICE(FTDI_VID, XSENS_CONVERTER_3_PID) },
699e6ac4a40SIan Abbott 	{ USB_DEVICE(FTDI_VID, XSENS_CONVERTER_4_PID) },
700e6ac4a40SIan Abbott 	{ USB_DEVICE(FTDI_VID, XSENS_CONVERTER_5_PID) },
701e6ac4a40SIan Abbott 	{ USB_DEVICE(FTDI_VID, XSENS_CONVERTER_6_PID) },
702e6ac4a40SIan Abbott 	{ USB_DEVICE(FTDI_VID, XSENS_CONVERTER_7_PID) },
703edd74ffaSFrans Klaver 	{ USB_DEVICE(XSENS_VID, XSENS_AWINDA_DONGLE_PID) },
704edd74ffaSFrans Klaver 	{ USB_DEVICE(XSENS_VID, XSENS_AWINDA_STATION_PID) },
7054bdcde35SPatrick Riphagen 	{ USB_DEVICE(XSENS_VID, XSENS_CONVERTER_PID) },
7061df5b888SPatrick Riphagen 	{ USB_DEVICE(XSENS_VID, XSENS_MTDEVBOARD_PID) },
7074bdcde35SPatrick Riphagen 	{ USB_DEVICE(XSENS_VID, XSENS_MTW_PID) },
7080ba3b2ccSPetr Kubánek 	{ USB_DEVICE(FTDI_VID, FTDI_OMNI1509) },
7096f92872cSIan Abbott 	{ USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) },
7108f977e42SIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_ACTIVE_ROBOTS_PID) },
71134d1a8aaSIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_MHAM_KW_PID) },
71234d1a8aaSIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_MHAM_YS_PID) },
7139b1513d9SIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_MHAM_Y6_PID) },
7149b1513d9SIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_MHAM_Y8_PID) },
71534d1a8aaSIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_MHAM_IC_PID) },
71634d1a8aaSIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_MHAM_DB9_PID) },
71734d1a8aaSIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_MHAM_RS232_PID) },
71834d1a8aaSIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_MHAM_Y9_PID) },
719740a4282SIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_TERATRONIK_VCP_PID) },
720740a4282SIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_TERATRONIK_D2XX_PID) },
7219b1513d9SIan Abbott 	{ USB_DEVICE(EVOLUTION_VID, EVOLUTION_ER1_PID) },
722c1f8ea7dSSøren Hauberg 	{ USB_DEVICE(EVOLUTION_VID, EVO_HYBRID_PID) },
723c1f8ea7dSSøren Hauberg 	{ USB_DEVICE(EVOLUTION_VID, EVO_RCM4_PID) },
724c9c7746dSRui Santos 	{ USB_DEVICE(FTDI_VID, FTDI_ARTEMIS_PID) },
725c9c7746dSRui Santos 	{ USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16_PID) },
72609c280a2SRui Santos 	{ USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16C_PID) },
727c9c7746dSRui Santos 	{ USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16HR_PID) },
72809c280a2SRui Santos 	{ USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16HRC_PID) },
72934910434SFranco Lanza 	{ USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16IC_PID) },
730b4723ae3SIan Abbott 	{ USB_DEVICE(KOBIL_VID, KOBIL_CONV_B1_PID) },
731b4723ae3SIan Abbott 	{ USB_DEVICE(KOBIL_VID, KOBIL_CONV_KAAN_PID) },
732effac8beSPavel Fedin 	{ USB_DEVICE(POSIFLEX_VID, POSIFLEX_PP7000_PID) },
733641adaaeSLouis Nyffenegger 	{ USB_DEVICE(FTDI_VID, FTDI_TTUSB_PID) },
7347e1c0b86SIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_ECLO_COM_1WIRE_PID) },
735a94b52acSIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_WESTREX_MODEL_777_PID) },
736a94b52acSIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_WESTREX_MODEL_8900F_PID) },
737ce40d290SWouter Paesen 	{ USB_DEVICE(FTDI_VID, FTDI_PCDJ_DAC2_PID) },
738cdd3b156SNathan Bronson 	{ USB_DEVICE(FTDI_VID, FTDI_RRCIRKITS_LOCOBUFFER_PID) },
7397e0258fdSIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_ASK_RDR400_PID) },
74026a538b9SHorst Schirmeier 	{ USB_DEVICE(FTDI_VID, FTDI_NZR_SEM_USB_PID) },
741a9d61bc4SPieter Maes 	{ USB_DEVICE(ICOM_VID, ICOM_ID_1_PID) },
742a9d61bc4SPieter Maes 	{ USB_DEVICE(ICOM_VID, ICOM_OPC_U_UC_PID) },
743a9d61bc4SPieter Maes 	{ USB_DEVICE(ICOM_VID, ICOM_ID_RP2C1_PID) },
744a9d61bc4SPieter Maes 	{ USB_DEVICE(ICOM_VID, ICOM_ID_RP2C2_PID) },
745a9d61bc4SPieter Maes 	{ USB_DEVICE(ICOM_VID, ICOM_ID_RP2D_PID) },
746a9d61bc4SPieter Maes 	{ USB_DEVICE(ICOM_VID, ICOM_ID_RP2VT_PID) },
747a9d61bc4SPieter Maes 	{ USB_DEVICE(ICOM_VID, ICOM_ID_RP2VR_PID) },
748a9d61bc4SPieter Maes 	{ USB_DEVICE(ICOM_VID, ICOM_ID_RP4KVT_PID) },
749a9d61bc4SPieter Maes 	{ USB_DEVICE(ICOM_VID, ICOM_ID_RP4KVR_PID) },
750a9d61bc4SPieter Maes 	{ USB_DEVICE(ICOM_VID, ICOM_ID_RP2KVT_PID) },
751a9d61bc4SPieter Maes 	{ USB_DEVICE(ICOM_VID, ICOM_ID_RP2KVR_PID) },
75220a0f47eSIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_ACG_HFDUAL_PID) },
753eb79b4fdSIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_YEI_SERVOCENTER31_PID) },
75448437486SD. Peter Siddons 	{ USB_DEVICE(FTDI_VID, FTDI_THORLABS_PID) },
7555a7fbe7eSBert Vermeulen 	{ USB_DEVICE(TESTO_VID, TESTO_1_PID) },
7565a7fbe7eSBert Vermeulen 	{ USB_DEVICE(TESTO_VID, TESTO_3_PID) },
757eaede2cbSRalf Schlatterbeck 	{ USB_DEVICE(FTDI_VID, FTDI_GAMMA_SCOUT_PID) },
7589978f9e1SIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_TACTRIX_OPENPORT_13M_PID) },
7599978f9e1SIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_TACTRIX_OPENPORT_13S_PID) },
7609978f9e1SIan Abbott 	{ USB_DEVICE(FTDI_VID, FTDI_TACTRIX_OPENPORT_13U_PID) },
76140c36092SKjell Myksvoll 	{ USB_DEVICE(ELEKTOR_VID, ELEKTOR_FT323R_PID) },
762b760dac2SMartin Geleynse 	{ USB_DEVICE(FTDI_VID, FTDI_NDI_HUC_PID),
763b760dac2SMartin Geleynse 		.driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk },
764b760dac2SMartin Geleynse 	{ USB_DEVICE(FTDI_VID, FTDI_NDI_SPECTRA_SCU_PID),
765b760dac2SMartin Geleynse 		.driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk },
766b760dac2SMartin Geleynse 	{ USB_DEVICE(FTDI_VID, FTDI_NDI_FUTURE_2_PID),
767b760dac2SMartin Geleynse 		.driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk },
768b760dac2SMartin Geleynse 	{ USB_DEVICE(FTDI_VID, FTDI_NDI_FUTURE_3_PID),
769b760dac2SMartin Geleynse 		.driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk },
770b760dac2SMartin Geleynse 	{ USB_DEVICE(FTDI_VID, FTDI_NDI_AURORA_SCU_PID),
771b760dac2SMartin Geleynse 		.driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk },
772822c7ef4SMicke Prag 	{ USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) },
773ee444609SJohan Hovold 	{ USB_DEVICE(NOVITUS_VID, NOVITUS_BONO_E_PID) },
774fed1f1edSRick Farina (Zero_Chaos) 	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_S03_PID) },
775fed1f1edSRick Farina (Zero_Chaos) 	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_59_PID) },
776fed1f1edSRick Farina (Zero_Chaos) 	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_57A_PID) },
777fed1f1edSRick Farina (Zero_Chaos) 	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_57B_PID) },
778fed1f1edSRick Farina (Zero_Chaos) 	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_29A_PID) },
779fed1f1edSRick Farina (Zero_Chaos) 	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_29B_PID) },
780fed1f1edSRick Farina (Zero_Chaos) 	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_29F_PID) },
781fed1f1edSRick Farina (Zero_Chaos) 	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_62B_PID) },
782fed1f1edSRick Farina (Zero_Chaos) 	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_S01_PID) },
783fed1f1edSRick Farina (Zero_Chaos) 	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_63_PID) },
784fed1f1edSRick Farina (Zero_Chaos) 	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_29C_PID) },
785fed1f1edSRick Farina (Zero_Chaos) 	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_81B_PID) },
786fed1f1edSRick Farina (Zero_Chaos) 	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_82B_PID) },
787fed1f1edSRick Farina (Zero_Chaos) 	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_K5D_PID) },
788fed1f1edSRick Farina (Zero_Chaos) 	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_K4Y_PID) },
789fed1f1edSRick Farina (Zero_Chaos) 	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_K5G_PID) },
790fed1f1edSRick Farina (Zero_Chaos) 	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_S05_PID) },
791fed1f1edSRick Farina (Zero_Chaos) 	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_60_PID) },
792fed1f1edSRick Farina (Zero_Chaos) 	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_61_PID) },
793fed1f1edSRick Farina (Zero_Chaos) 	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_62_PID) },
794fed1f1edSRick Farina (Zero_Chaos) 	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_63B_PID) },
795fed1f1edSRick Farina (Zero_Chaos) 	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_64_PID) },
796fed1f1edSRick Farina (Zero_Chaos) 	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_65_PID) },
797fed1f1edSRick Farina (Zero_Chaos) 	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_92_PID) },
798fed1f1edSRick Farina (Zero_Chaos) 	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_92D_PID) },
799fed1f1edSRick Farina (Zero_Chaos) 	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_W5R_PID) },
800fed1f1edSRick Farina (Zero_Chaos) 	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_A5R_PID) },
801fed1f1edSRick Farina (Zero_Chaos) 	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_PW1_PID) },
802762e92faSNeil \"Superna\" ARMSTRONG 	{ USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) },
803a5f62399SLex Ross 	{ USB_DEVICE(FTDI_VID, FTDI_PHI_FISCO_PID) },
804d7fde2d6SPierre Castella 	{ USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) },
8054bb0ef19SEd Beroset 	{ USB_DEVICE(FTDI_VID, FTDI_ELSTER_UNICOM_PID) },
80611171d1bSMirko Bordignon 	{ USB_DEVICE(FTDI_VID, FTDI_PROPOX_JTAGCABLEII_PID) },
807307369b0SMarcin Kościelnicki 	{ USB_DEVICE(FTDI_VID, FTDI_PROPOX_ISPCABLEIII_PID) },
808c7d373c3SMax Mansfield 	{ USB_DEVICE(FTDI_VID, CYBER_CORTEX_AV_PID),
809c7d373c3SMax Mansfield 		.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
810fa91d43bSTony Lindgren 	{ USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_PID),
81120734345SHarald Welte 		.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
812b88ccf6fSJF Argentino 	{ USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_H_PID),
813b88ccf6fSJF Argentino 		.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
81420734345SHarald Welte 	{ USB_DEVICE(FIC_VID, FIC_NEO1973_DEBUG_PID),
81520734345SHarald Welte 		.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
81620734345SHarald Welte 	{ USB_DEVICE(FTDI_VID, FTDI_OOCDLINK_PID),
81720734345SHarald Welte 		.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
818a00c3cadSFrederik Kriewitz 	{ USB_DEVICE(FTDI_VID, LMI_LM3S_DEVEL_BOARD_PID),
819a00c3cadSFrederik Kriewitz 		.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
820a00c3cadSFrederik Kriewitz 	{ USB_DEVICE(FTDI_VID, LMI_LM3S_EVAL_BOARD_PID),
821a00c3cadSFrederik Kriewitz 		.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
8223687f641SPeter Stuge 	{ USB_DEVICE(FTDI_VID, LMI_LM3S_ICDI_BOARD_PID),
8233687f641SPeter Stuge 		.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
82414511412SKrzysztof Halasa 	{ USB_DEVICE(FTDI_VID, FTDI_TURTELIZER_PID),
82514511412SKrzysztof Halasa 		.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
82626ab7053SAtsushi Nemoto 	{ USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) },
827*e03cdf22SGreg Kroah-Hartman 	{ USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_SCU18) },
8282542335cSJon K Hellan 	{ USB_DEVICE(FTDI_VID, FTDI_REU_TINY_PID) },
82959c6ccd9SDaniel Suchy 
83059c6ccd9SDaniel Suchy 	/* Papouch devices based on FTDI chip */
83159c6ccd9SDaniel Suchy 	{ USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB485_PID) },
83259c6ccd9SDaniel Suchy 	{ USB_DEVICE(PAPOUCH_VID, PAPOUCH_AP485_PID) },
83359c6ccd9SDaniel Suchy 	{ USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB422_PID) },
83459c6ccd9SDaniel Suchy 	{ USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB485_2_PID) },
83559c6ccd9SDaniel Suchy 	{ USB_DEVICE(PAPOUCH_VID, PAPOUCH_AP485_2_PID) },
83659c6ccd9SDaniel Suchy 	{ USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB422_2_PID) },
83759c6ccd9SDaniel Suchy 	{ USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB485S_PID) },
83859c6ccd9SDaniel Suchy 	{ USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB485C_PID) },
83959c6ccd9SDaniel Suchy 	{ USB_DEVICE(PAPOUCH_VID, PAPOUCH_LEC_PID) },
84059c6ccd9SDaniel Suchy 	{ USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB232_PID) },
84159c6ccd9SDaniel Suchy 	{ USB_DEVICE(PAPOUCH_VID, PAPOUCH_TMU_PID) },
84259c6ccd9SDaniel Suchy 	{ USB_DEVICE(PAPOUCH_VID, PAPOUCH_IRAMP_PID) },
84359c6ccd9SDaniel Suchy 	{ USB_DEVICE(PAPOUCH_VID, PAPOUCH_DRAK5_PID) },
84459c6ccd9SDaniel Suchy 	{ USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO8x8_PID) },
845a18f80b4SJaroslav Kysela 	{ USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO4x4_PID) },
84659c6ccd9SDaniel Suchy 	{ USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO2x2_PID) },
84759c6ccd9SDaniel Suchy 	{ USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO10x1_PID) },
84859c6ccd9SDaniel Suchy 	{ USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO30x3_PID) },
84959c6ccd9SDaniel Suchy 	{ USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO60x3_PID) },
85059c6ccd9SDaniel Suchy 	{ USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO2x16_PID) },
85159c6ccd9SDaniel Suchy 	{ USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO3x32_PID) },
85259c6ccd9SDaniel Suchy 	{ USB_DEVICE(PAPOUCH_VID, PAPOUCH_DRAK6_PID) },
85359c6ccd9SDaniel Suchy 	{ USB_DEVICE(PAPOUCH_VID, PAPOUCH_UPSUSB_PID) },
85459c6ccd9SDaniel Suchy 	{ USB_DEVICE(PAPOUCH_VID, PAPOUCH_MU_PID) },
85559c6ccd9SDaniel Suchy 	{ USB_DEVICE(PAPOUCH_VID, PAPOUCH_SIMUKEY_PID) },
856a7787e50SRadek Liboska 	{ USB_DEVICE(PAPOUCH_VID, PAPOUCH_AD4USB_PID) },
85759c6ccd9SDaniel Suchy 	{ USB_DEVICE(PAPOUCH_VID, PAPOUCH_GMUX_PID) },
85859c6ccd9SDaniel Suchy 	{ USB_DEVICE(PAPOUCH_VID, PAPOUCH_GMSR_PID) },
85959c6ccd9SDaniel Suchy 
86096285cb8SGaetan Carlier 	{ USB_DEVICE(FTDI_VID, FTDI_DOMINTELL_DGQG_PID) },
86196285cb8SGaetan Carlier 	{ USB_DEVICE(FTDI_VID, FTDI_DOMINTELL_DUSB_PID) },
86245eeff84SRobie Basak 	{ USB_DEVICE(ALTI2_VID, ALTI2_N3_PID) },
863ca80801bSMhayk Whandson 	{ USB_DEVICE(FTDI_VID, DIEBOLD_BCS_SE923_PID) },
8647f82b6ddSAxel Wachtler 	{ USB_DEVICE(ATMEL_VID, STK541_PID) },
8657f82b6ddSAxel Wachtler 	{ USB_DEVICE(DE_VID, STB_PID) },
8667f82b6ddSAxel Wachtler 	{ USB_DEVICE(DE_VID, WHT_PID) },
867b0d65900SMichael Hennerich 	{ USB_DEVICE(ADI_VID, ADI_GNICE_PID),
868b0d65900SMichael Hennerich 		.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
86911eaf170SMichael Hennerich 	{ USB_DEVICE(ADI_VID, ADI_GNICEPLUS_PID),
87011eaf170SMichael Hennerich 		.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
871f08dea73SBjørn Mork 	{ USB_DEVICE_AND_INTERFACE_INFO(MICROCHIP_VID, MICROCHIP_USB_BOARD_PID,
872f08dea73SBjørn Mork 					USB_CLASS_VENDOR_SPEC,
873f08dea73SBjørn Mork 					USB_SUBCLASS_VENDOR_SPEC, 0x00) },
874ae27d843SPeter Korsgaard 	{ USB_DEVICE(JETI_VID, JETI_SPC1201_PID) },
8751002bb77SNicolas Pitre 	{ USB_DEVICE(MARVELL_VID, MARVELL_SHEEVAPLUG_PID),
8761002bb77SNicolas Pitre 		.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
877d46130abSDaniel Suchy 	{ USB_DEVICE(LARSENBRUSGAARD_VID, LB_ALTITRACK_PID) },
878fca4404cSVille Sundberg 	{ USB_DEVICE(GN_OTOMETRICS_VID, AURICAL_USB_PID) },
879dafc4f7bSÉric Piel 	{ USB_DEVICE(FTDI_VID, PI_C865_PID) },
880dafc4f7bSÉric Piel 	{ USB_DEVICE(FTDI_VID, PI_C857_PID) },
881dafc4f7bSÉric Piel 	{ USB_DEVICE(PI_VID, PI_C866_PID) },
882dafc4f7bSÉric Piel 	{ USB_DEVICE(PI_VID, PI_C663_PID) },
883dafc4f7bSÉric Piel 	{ USB_DEVICE(PI_VID, PI_C725_PID) },
884dafc4f7bSÉric Piel 	{ USB_DEVICE(PI_VID, PI_E517_PID) },
885dafc4f7bSÉric Piel 	{ USB_DEVICE(PI_VID, PI_C863_PID) },
886b69cc672SÉric Piel 	{ USB_DEVICE(PI_VID, PI_E861_PID) },
887dafc4f7bSÉric Piel 	{ USB_DEVICE(PI_VID, PI_C867_PID) },
888dafc4f7bSÉric Piel 	{ USB_DEVICE(PI_VID, PI_E609_PID) },
889dafc4f7bSÉric Piel 	{ USB_DEVICE(PI_VID, PI_E709_PID) },
890dafc4f7bSÉric Piel 	{ USB_DEVICE(PI_VID, PI_100F_PID) },
891dafc4f7bSÉric Piel 	{ USB_DEVICE(PI_VID, PI_1011_PID) },
892dafc4f7bSÉric Piel 	{ USB_DEVICE(PI_VID, PI_1012_PID) },
893dafc4f7bSÉric Piel 	{ USB_DEVICE(PI_VID, PI_1013_PID) },
894dafc4f7bSÉric Piel 	{ USB_DEVICE(PI_VID, PI_1014_PID) },
895dafc4f7bSÉric Piel 	{ USB_DEVICE(PI_VID, PI_1015_PID) },
896dafc4f7bSÉric Piel 	{ USB_DEVICE(PI_VID, PI_1016_PID) },
8977724a1edSOzan Çağlayan 	{ USB_DEVICE(KONDO_VID, KONDO_USB_SERIAL_PID) },
898c47aacc6SMarko Hänninen 	{ USB_DEVICE(BAYER_VID, BAYER_CONTOUR_CABLE_PID) },
89950d0678eSDhaval Vasa 	{ USB_DEVICE(FTDI_VID, MARVELL_OPENRD_PID),
90050d0678eSDhaval Vasa 		.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
90155f13aeaSPeter Korsgaard 	{ USB_DEVICE(FTDI_VID, TI_XDS100V2_PID),
90255f13aeaSPeter Korsgaard 		.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
903e7d7fcc0SPawel Ludwikow 	{ USB_DEVICE(FTDI_VID, HAMEG_HO820_PID) },
904c53c2fabSPaul Friedrich 	{ USB_DEVICE(FTDI_VID, HAMEG_HO720_PID) },
905c53c2fabSPaul Friedrich 	{ USB_DEVICE(FTDI_VID, HAMEG_HO730_PID) },
906e7d7fcc0SPawel Ludwikow 	{ USB_DEVICE(FTDI_VID, HAMEG_HO870_PID) },
9079714080dSMitchell Solomon 	{ USB_DEVICE(FTDI_VID, MJSG_GENERIC_PID) },
9089714080dSMitchell Solomon 	{ USB_DEVICE(FTDI_VID, MJSG_SR_RADIO_PID) },
9099714080dSMitchell Solomon 	{ USB_DEVICE(FTDI_VID, MJSG_HD_RADIO_PID) },
9109714080dSMitchell Solomon 	{ USB_DEVICE(FTDI_VID, MJSG_XM_RADIO_PID) },
91177dbd74eSColin Leitner 	{ USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_ST_PID),
91277dbd74eSColin Leitner 		.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
91377dbd74eSColin Leitner 	{ USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_SLITE_PID),
91477dbd74eSColin Leitner 		.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
91577dbd74eSColin Leitner 	{ USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_SH2_PID),
91677dbd74eSColin Leitner 		.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
91777dbd74eSColin Leitner 	{ USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_SH4_PID),
91877dbd74eSColin Leitner 		.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
919afad1964SJohn G. Rogers 	{ USB_DEVICE(FTDI_VID, SEGWAY_RMP200_PID) },
9203126d823SRich Mattes 	{ USB_DEVICE(FTDI_VID, ACCESIO_COM4SM_PID) },
921666cc076SMartin Michlmayr 	{ USB_DEVICE(IONICS_VID, IONICS_PLUGCOMPUTER_PID),
922666cc076SMartin Michlmayr 		.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
92365737388SLuke Lowrey 	{ USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_24_MASTER_WING_PID) },
92465737388SLuke Lowrey 	{ USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_PC_WING_PID) },
92565737388SLuke Lowrey 	{ USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_USB_DMX_PID) },
92665737388SLuke Lowrey 	{ USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_MIDI_TIMECODE_PID) },
92765737388SLuke Lowrey 	{ USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_MINI_WING_PID) },
92865737388SLuke Lowrey 	{ USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_MAXI_WING_PID) },
92965737388SLuke Lowrey 	{ USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_MEDIA_WING_PID) },
93065737388SLuke Lowrey 	{ USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_WING_PID) },
9310f266abdSGreg Kroah-Hartman 	{ USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LOGBOOKML_PID) },
9320f266abdSGreg Kroah-Hartman 	{ USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LS_LOGBOOK_PID) },
9330f266abdSGreg Kroah-Hartman 	{ USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_HS_LOGBOOK_PID) },
93490451e69SMilan Kocian 	{ USB_DEVICE(FTDI_VID, FTDI_CINTERION_MC55I_PID) },
9355363cdc3SFlorian Faber 	{ USB_DEVICE(FTDI_VID, FTDI_DOTEC_PID) },
9367fea0f71SSebastien Bourdeauducq 	{ USB_DEVICE(QIHARDWARE_VID, MILKYMISTONE_JTAGSERIAL_PID),
9377fea0f71SSebastien Bourdeauducq 		.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
9389f06d15fSAdrian Thomasset 	{ USB_DEVICE(ST_VID, ST_STMCLT_2232_PID),
9399f06d15fSAdrian Thomasset 		.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
9409f06d15fSAdrian Thomasset 	{ USB_DEVICE(ST_VID, ST_STMCLT_4232_PID),
9416ec2f46cSJean-Christophe PLAGNIOL-VILLARD 		.driver_info = (kernel_ulong_t)&ftdi_stmclite_quirk },
942fc216ec3SPeter Naulls 	{ USB_DEVICE(FTDI_VID, FTDI_RF_R106) },
94347594d55SMichał Wróbel 	{ USB_DEVICE(FTDI_VID, FTDI_DISTORTEC_JTAG_LOCK_PICK_PID),
94447594d55SMichał Wróbel 		.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
94557e596f3SMichał Wróbel 	{ USB_DEVICE(FTDI_VID, FTDI_LUMEL_PD12_PID) },
9468cf65dc3STomasz Mloduchowski 	/* Crucible Devices */
9478cf65dc3STomasz Mloduchowski 	{ USB_DEVICE(FTDI_VID, FTDI_CT_COMET_PID) },
948e1466ad5SАлексей Крамаренко 	{ USB_DEVICE(FTDI_VID, FTDI_Z3X_PID) },
9496dbd46c8SJoerg Dorchain 	/* Cressi Devices */
9506dbd46c8SJoerg Dorchain 	{ USB_DEVICE(FTDI_VID, FTDI_CRESSI_PID) },
951efe26e16SMichele Baldessari 	/* Brainboxes Devices */
952efe26e16SMichele Baldessari 	{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_VX_001_PID) },
953efe26e16SMichele Baldessari 	{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_VX_012_PID) },
954efe26e16SMichele Baldessari 	{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_VX_023_PID) },
955efe26e16SMichele Baldessari 	{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_VX_034_PID) },
956efe26e16SMichele Baldessari 	{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_101_PID) },
957efe26e16SMichele Baldessari 	{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_1_PID) },
958efe26e16SMichele Baldessari 	{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_2_PID) },
959efe26e16SMichele Baldessari 	{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_3_PID) },
960efe26e16SMichele Baldessari 	{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_4_PID) },
961efe26e16SMichele Baldessari 	{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_5_PID) },
962efe26e16SMichele Baldessari 	{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_6_PID) },
963efe26e16SMichele Baldessari 	{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_7_PID) },
964efe26e16SMichele Baldessari 	{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_8_PID) },
965efe26e16SMichele Baldessari 	{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_257_PID) },
966efe26e16SMichele Baldessari 	{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_279_1_PID) },
967efe26e16SMichele Baldessari 	{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_279_2_PID) },
968efe26e16SMichele Baldessari 	{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_279_3_PID) },
969efe26e16SMichele Baldessari 	{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_279_4_PID) },
970efe26e16SMichele Baldessari 	{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_313_PID) },
971efe26e16SMichele Baldessari 	{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_324_PID) },
972efe26e16SMichele Baldessari 	{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_346_1_PID) },
973efe26e16SMichele Baldessari 	{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_346_2_PID) },
974efe26e16SMichele Baldessari 	{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_357_PID) },
975efe26e16SMichele Baldessari 	{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_606_1_PID) },
976efe26e16SMichele Baldessari 	{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_606_2_PID) },
977efe26e16SMichele Baldessari 	{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_606_3_PID) },
978efe26e16SMichele Baldessari 	{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_701_1_PID) },
979efe26e16SMichele Baldessari 	{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_701_2_PID) },
980efe26e16SMichele Baldessari 	{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_1_PID) },
981efe26e16SMichele Baldessari 	{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_2_PID) },
982efe26e16SMichele Baldessari 	{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_3_PID) },
983efe26e16SMichele Baldessari 	{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_4_PID) },
984646907f5SJaša Bartelj 	/* ekey Devices */
985646907f5SJaša Bartelj 	{ USB_DEVICE(FTDI_VID, FTDI_EKEY_CONV_USB_PID) },
986d8279a40SMichal Sojka 	/* Infineon Devices */
987d8279a40SMichal Sojka 	{ USB_DEVICE_INTERFACE_NUMBER(INFINEON_VID, INFINEON_TRIBOARD_PID, 1) },
9889c491c37STaylor Braun-Jones 	/* GE Healthcare devices */
9899c491c37STaylor Braun-Jones 	{ USB_DEVICE(GE_HEALTHCARE_VID, GE_HEALTHCARE_NEMO_TRACKER_PID) },
990f6950344SMark Glover 	/* Active Research (Actisense) devices */
991f6950344SMark Glover 	{ USB_DEVICE(FTDI_VID, ACTISENSE_NDC_PID) },
992f6950344SMark Glover 	{ USB_DEVICE(FTDI_VID, ACTISENSE_USG_PID) },
993f6950344SMark Glover 	{ USB_DEVICE(FTDI_VID, ACTISENSE_NGT_PID) },
994f6950344SMark Glover 	{ USB_DEVICE(FTDI_VID, ACTISENSE_NGW_PID) },
995f6950344SMark Glover 	{ USB_DEVICE(FTDI_VID, ACTISENSE_D9AC_PID) },
996f6950344SMark Glover 	{ USB_DEVICE(FTDI_VID, ACTISENSE_D9AD_PID) },
997f6950344SMark Glover 	{ USB_DEVICE(FTDI_VID, ACTISENSE_D9AE_PID) },
998f6950344SMark Glover 	{ USB_DEVICE(FTDI_VID, ACTISENSE_D9AF_PID) },
999f6950344SMark Glover 	{ USB_DEVICE(FTDI_VID, CHETCO_SEAGAUGE_PID) },
1000f6950344SMark Glover 	{ USB_DEVICE(FTDI_VID, CHETCO_SEASWITCH_PID) },
1001f6950344SMark Glover 	{ USB_DEVICE(FTDI_VID, CHETCO_SEASMART_NMEA2000_PID) },
1002f6950344SMark Glover 	{ USB_DEVICE(FTDI_VID, CHETCO_SEASMART_ETHERNET_PID) },
1003f6950344SMark Glover 	{ USB_DEVICE(FTDI_VID, CHETCO_SEASMART_WIFI_PID) },
1004f6950344SMark Glover 	{ USB_DEVICE(FTDI_VID, CHETCO_SEASMART_DISPLAY_PID) },
1005f6950344SMark Glover 	{ USB_DEVICE(FTDI_VID, CHETCO_SEASMART_LITE_PID) },
1006f6950344SMark Glover 	{ USB_DEVICE(FTDI_VID, CHETCO_SEASMART_ANALOG_PID) },
10071da177e4SLinus Torvalds 	{ }					/* Terminating entry */
10081da177e4SLinus Torvalds };
10091da177e4SLinus Torvalds 
10101da177e4SLinus Torvalds MODULE_DEVICE_TABLE(usb, id_table_combined);
10111da177e4SLinus Torvalds 
10124c4c9432SArjan van de Ven static const char *ftdi_chip_name[] = {
10131da177e4SLinus Torvalds 	[SIO] = "SIO",	/* the serial part of FT8U100AX */
10141da177e4SLinus Torvalds 	[FT8U232AM] = "FT8U232AM",
10151da177e4SLinus Torvalds 	[FT232BM] = "FT232BM",
10161da177e4SLinus Torvalds 	[FT2232C] = "FT2232C",
1017d8b21606SGard Spreemann 	[FT232RL] = "FT232RL",
1018094c2e6dSMark Adamson 	[FT2232H] = "FT2232H",
1019309427b6SUwe Bonnes 	[FT4232H] = "FT4232H",
1020dc0827c1SJim Paris 	[FT232H]  = "FT232H",
1021dc0827c1SJim Paris 	[FTX]     = "FT-X"
10221da177e4SLinus Torvalds };
10231da177e4SLinus Torvalds 
10241da177e4SLinus Torvalds 
10251da177e4SLinus Torvalds /* Used for TIOCMIWAIT */
10261da177e4SLinus Torvalds #define FTDI_STATUS_B0_MASK	(FTDI_RS0_CTS | FTDI_RS0_DSR | FTDI_RS0_RI | FTDI_RS0_RLSD)
10271da177e4SLinus Torvalds #define FTDI_STATUS_B1_MASK	(FTDI_RS_BI)
10281da177e4SLinus Torvalds /* End TIOCMIWAIT */
10291da177e4SLinus Torvalds 
10301da177e4SLinus Torvalds /* function prototypes for a FTDI serial converter */
1031464cbb24SAlan Cox static int  ftdi_sio_probe(struct usb_serial *serial,
1032464cbb24SAlan Cox 					const struct usb_device_id *id);
103312bdbe03SJim Radford static int  ftdi_sio_port_probe(struct usb_serial_port *port);
103412bdbe03SJim Radford static int  ftdi_sio_port_remove(struct usb_serial_port *port);
1035a509a7e4SAlan Cox static int  ftdi_open(struct tty_struct *tty, struct usb_serial_port *port);
1036335f8514SAlan Cox static void ftdi_dtr_rts(struct usb_serial_port *port, int on);
10371b551015SJohan Hovold static void ftdi_process_read_urb(struct urb *urb);
1038d3901a06SJohan Hovold static int ftdi_prepare_write_buffer(struct usb_serial_port *port,
1039c23e5fc1SJohan Hovold 						void *dest, size_t size);
1040464cbb24SAlan Cox static void ftdi_set_termios(struct tty_struct *tty,
1041464cbb24SAlan Cox 			struct usb_serial_port *port, struct ktermios *old);
104260b33c13SAlan Cox static int  ftdi_tiocmget(struct tty_struct *tty);
104320b9d177SAlan Cox static int  ftdi_tiocmset(struct tty_struct *tty,
1044464cbb24SAlan Cox 			unsigned int set, unsigned int clear);
104500a0d0d6SAlan Cox static int  ftdi_ioctl(struct tty_struct *tty,
1046464cbb24SAlan Cox 			unsigned int cmd, unsigned long arg);
104795da310eSAlan Cox static void ftdi_break_ctl(struct tty_struct *tty, int break_state);
1048a37025b5SJohan Hovold static bool ftdi_tx_empty(struct usb_serial_port *port);
1049c4133648SJohan Hovold static int ftdi_get_modem_status(struct usb_serial_port *port,
10505fb0432eSJohan Hovold 						unsigned char status[2]);
10511da177e4SLinus Torvalds 
10521da177e4SLinus Torvalds static unsigned short int ftdi_232am_baud_base_to_divisor(int baud, int base);
10531da177e4SLinus Torvalds static unsigned short int ftdi_232am_baud_to_divisor(int baud);
10541da177e4SLinus Torvalds static __u32 ftdi_232bm_baud_base_to_divisor(int baud, int base);
10551da177e4SLinus Torvalds static __u32 ftdi_232bm_baud_to_divisor(int baud);
1056094c2e6dSMark Adamson static __u32 ftdi_2232h_baud_base_to_divisor(int baud, int base);
1057094c2e6dSMark Adamson static __u32 ftdi_2232h_baud_to_divisor(int baud);
10581da177e4SLinus Torvalds 
1059ea65370dSGreg Kroah-Hartman static struct usb_serial_driver ftdi_sio_device = {
106018fcac35SGreg Kroah-Hartman 	.driver = {
10611da177e4SLinus Torvalds 		.owner =	THIS_MODULE,
1062269bda1cSGreg Kroah-Hartman 		.name =		"ftdi_sio",
106318fcac35SGreg Kroah-Hartman 	},
1064269bda1cSGreg Kroah-Hartman 	.description =		"FTDI USB Serial Device",
10658f977e42SIan Abbott 	.id_table =		id_table_combined,
10661da177e4SLinus Torvalds 	.num_ports =		1,
1067bbcb2b90SJohan Hovold 	.bulk_in_size =		512,
1068c23e5fc1SJohan Hovold 	.bulk_out_size =	256,
10698f977e42SIan Abbott 	.probe =		ftdi_sio_probe,
107012bdbe03SJim Radford 	.port_probe =		ftdi_sio_port_probe,
107112bdbe03SJim Radford 	.port_remove =		ftdi_sio_port_remove,
10721da177e4SLinus Torvalds 	.open =			ftdi_open,
1073335f8514SAlan Cox 	.dtr_rts =		ftdi_dtr_rts,
10741b551015SJohan Hovold 	.throttle =		usb_serial_generic_throttle,
10751b551015SJohan Hovold 	.unthrottle =		usb_serial_generic_unthrottle,
10761b551015SJohan Hovold 	.process_read_urb =	ftdi_process_read_urb,
1077d3901a06SJohan Hovold 	.prepare_write_buffer =	ftdi_prepare_write_buffer,
10781da177e4SLinus Torvalds 	.tiocmget =		ftdi_tiocmget,
10791da177e4SLinus Torvalds 	.tiocmset =		ftdi_tiocmset,
1080f307e5cdSJohan Hovold 	.tiocmiwait =		usb_serial_generic_tiocmiwait,
10816f86fec9SJohan Hovold 	.get_icount =           usb_serial_generic_get_icount,
10821da177e4SLinus Torvalds 	.ioctl =		ftdi_ioctl,
10831da177e4SLinus Torvalds 	.set_termios =		ftdi_set_termios,
10841da177e4SLinus Torvalds 	.break_ctl =		ftdi_break_ctl,
1085a37025b5SJohan Hovold 	.tx_empty =		ftdi_tx_empty,
10861da177e4SLinus Torvalds };
10871da177e4SLinus Torvalds 
108897b6b6d2SAlan Stern static struct usb_serial_driver * const serial_drivers[] = {
108997b6b6d2SAlan Stern 	&ftdi_sio_device, NULL
109097b6b6d2SAlan Stern };
109197b6b6d2SAlan Stern 
10921da177e4SLinus Torvalds 
10931da177e4SLinus Torvalds #define WDR_TIMEOUT 5000 /* default urb timeout */
1094279e1545SIan Abbott #define WDR_SHORT_TIMEOUT 1000	/* shorter urb timeout */
10951da177e4SLinus Torvalds 
10961da177e4SLinus Torvalds /*
10971da177e4SLinus Torvalds  * ***************************************************************************
1098fa91d43bSTony Lindgren  * Utility functions
10991da177e4SLinus Torvalds  * ***************************************************************************
11001da177e4SLinus Torvalds  */
11011da177e4SLinus Torvalds 
11021da177e4SLinus Torvalds static unsigned short int ftdi_232am_baud_base_to_divisor(int baud, int base)
11031da177e4SLinus Torvalds {
11041da177e4SLinus Torvalds 	unsigned short int divisor;
1105464cbb24SAlan Cox 	/* divisor shifted 3 bits to the left */
1106464cbb24SAlan Cox 	int divisor3 = base / 2 / baud;
1107464cbb24SAlan Cox 	if ((divisor3 & 0x7) == 7)
1108464cbb24SAlan Cox 		divisor3++; /* round x.7/8 up to x+1 */
11091da177e4SLinus Torvalds 	divisor = divisor3 >> 3;
11101da177e4SLinus Torvalds 	divisor3 &= 0x7;
1111464cbb24SAlan Cox 	if (divisor3 == 1)
1112464cbb24SAlan Cox 		divisor |= 0xc000;
1113464cbb24SAlan Cox 	else if (divisor3 >= 4)
1114464cbb24SAlan Cox 		divisor |= 0x4000;
1115464cbb24SAlan Cox 	else if (divisor3 != 0)
1116464cbb24SAlan Cox 		divisor |= 0x8000;
1117464cbb24SAlan Cox 	else if (divisor == 1)
1118464cbb24SAlan Cox 		divisor = 0;	/* special case for maximum baud rate */
11191da177e4SLinus Torvalds 	return divisor;
11201da177e4SLinus Torvalds }
11211da177e4SLinus Torvalds 
11221da177e4SLinus Torvalds static unsigned short int ftdi_232am_baud_to_divisor(int baud)
11231da177e4SLinus Torvalds {
1124464cbb24SAlan Cox 	 return ftdi_232am_baud_base_to_divisor(baud, 48000000);
11251da177e4SLinus Torvalds }
11261da177e4SLinus Torvalds 
11271da177e4SLinus Torvalds static __u32 ftdi_232bm_baud_base_to_divisor(int baud, int base)
11281da177e4SLinus Torvalds {
11291da177e4SLinus Torvalds 	static const unsigned char divfrac[8] = { 0, 3, 2, 4, 1, 5, 6, 7 };
11301da177e4SLinus Torvalds 	__u32 divisor;
1131464cbb24SAlan Cox 	/* divisor shifted 3 bits to the left */
1132464cbb24SAlan Cox 	int divisor3 = base / 2 / baud;
11331da177e4SLinus Torvalds 	divisor = divisor3 >> 3;
11341da177e4SLinus Torvalds 	divisor |= (__u32)divfrac[divisor3 & 0x7] << 14;
11351da177e4SLinus Torvalds 	/* Deal with special cases for highest baud rates. */
1136464cbb24SAlan Cox 	if (divisor == 1)
1137464cbb24SAlan Cox 		divisor = 0;
1138464cbb24SAlan Cox 	else if (divisor == 0x4001)
1139464cbb24SAlan Cox 		divisor = 1;
11401da177e4SLinus Torvalds 	return divisor;
11411da177e4SLinus Torvalds }
11421da177e4SLinus Torvalds 
11431da177e4SLinus Torvalds static __u32 ftdi_232bm_baud_to_divisor(int baud)
11441da177e4SLinus Torvalds {
1145464cbb24SAlan Cox 	 return ftdi_232bm_baud_base_to_divisor(baud, 48000000);
11461da177e4SLinus Torvalds }
11471da177e4SLinus Torvalds 
1148094c2e6dSMark Adamson static __u32 ftdi_2232h_baud_base_to_divisor(int baud, int base)
1149094c2e6dSMark Adamson {
1150094c2e6dSMark Adamson 	static const unsigned char divfrac[8] = { 0, 3, 2, 4, 1, 5, 6, 7 };
1151094c2e6dSMark Adamson 	__u32 divisor;
1152094c2e6dSMark Adamson 	int divisor3;
1153094c2e6dSMark Adamson 
1154094c2e6dSMark Adamson 	/* hi-speed baud rate is 10-bit sampling instead of 16-bit */
1155f6c259a3SDaniel Glöckner 	divisor3 = base * 8 / (baud * 10);
1156094c2e6dSMark Adamson 
1157094c2e6dSMark Adamson 	divisor = divisor3 >> 3;
1158094c2e6dSMark Adamson 	divisor |= (__u32)divfrac[divisor3 & 0x7] << 14;
1159094c2e6dSMark Adamson 	/* Deal with special cases for highest baud rates. */
1160094c2e6dSMark Adamson 	if (divisor == 1)
1161094c2e6dSMark Adamson 		divisor = 0;
1162094c2e6dSMark Adamson 	else if (divisor == 0x4001)
1163094c2e6dSMark Adamson 		divisor = 1;
1164094c2e6dSMark Adamson 	/*
1165094c2e6dSMark Adamson 	 * Set this bit to turn off a divide by 2.5 on baud rate generator
1166094c2e6dSMark Adamson 	 * This enables baud rates up to 12Mbaud but cannot reach below 1200
1167094c2e6dSMark Adamson 	 * baud with this bit set
1168094c2e6dSMark Adamson 	 */
1169094c2e6dSMark Adamson 	divisor |= 0x00020000;
1170094c2e6dSMark Adamson 	return divisor;
1171094c2e6dSMark Adamson }
1172094c2e6dSMark Adamson 
1173094c2e6dSMark Adamson static __u32 ftdi_2232h_baud_to_divisor(int baud)
1174094c2e6dSMark Adamson {
1175094c2e6dSMark Adamson 	 return ftdi_2232h_baud_base_to_divisor(baud, 120000000);
1176094c2e6dSMark Adamson }
1177094c2e6dSMark Adamson 
117874ede0ffSIan Abbott #define set_mctrl(port, set)		update_mctrl((port), (set), 0)
117974ede0ffSIan Abbott #define clear_mctrl(port, clear)	update_mctrl((port), 0, (clear))
118074ede0ffSIan Abbott 
1181464cbb24SAlan Cox static int update_mctrl(struct usb_serial_port *port, unsigned int set,
1182464cbb24SAlan Cox 							unsigned int clear)
11831da177e4SLinus Torvalds {
11841da177e4SLinus Torvalds 	struct ftdi_private *priv = usb_get_serial_port_data(port);
1185bfc51614SGreg Kroah-Hartman 	struct device *dev = &port->dev;
118674ede0ffSIan Abbott 	unsigned urb_value;
11871da177e4SLinus Torvalds 	int rv;
11881da177e4SLinus Torvalds 
118974ede0ffSIan Abbott 	if (((set | clear) & (TIOCM_DTR | TIOCM_RTS)) == 0) {
1190bfc51614SGreg Kroah-Hartman 		dev_dbg(dev, "%s - DTR|RTS not being set|cleared\n", __func__);
119174ede0ffSIan Abbott 		return 0;	/* no change */
11921da177e4SLinus Torvalds 	}
119374ede0ffSIan Abbott 
119474ede0ffSIan Abbott 	clear &= ~set;	/* 'set' takes precedence over 'clear' */
119574ede0ffSIan Abbott 	urb_value = 0;
119674ede0ffSIan Abbott 	if (clear & TIOCM_DTR)
119774ede0ffSIan Abbott 		urb_value |= FTDI_SIO_SET_DTR_LOW;
119874ede0ffSIan Abbott 	if (clear & TIOCM_RTS)
119974ede0ffSIan Abbott 		urb_value |= FTDI_SIO_SET_RTS_LOW;
120074ede0ffSIan Abbott 	if (set & TIOCM_DTR)
120174ede0ffSIan Abbott 		urb_value |= FTDI_SIO_SET_DTR_HIGH;
120274ede0ffSIan Abbott 	if (set & TIOCM_RTS)
120374ede0ffSIan Abbott 		urb_value |= FTDI_SIO_SET_RTS_HIGH;
12041da177e4SLinus Torvalds 	rv = usb_control_msg(port->serial->dev,
12051da177e4SLinus Torvalds 			       usb_sndctrlpipe(port->serial->dev, 0),
12061da177e4SLinus Torvalds 			       FTDI_SIO_SET_MODEM_CTRL_REQUEST,
12071da177e4SLinus Torvalds 			       FTDI_SIO_SET_MODEM_CTRL_REQUEST_TYPE,
120874ede0ffSIan Abbott 			       urb_value, priv->interface,
120966e47e60SJohan Hovold 			       NULL, 0, WDR_TIMEOUT);
121074ede0ffSIan Abbott 	if (rv < 0) {
1211bfc51614SGreg Kroah-Hartman 		dev_dbg(dev, "%s Error from MODEM_CTRL urb: DTR %s, RTS %s\n",
1212441b62c1SHarvey Harrison 			__func__,
1213bfc51614SGreg Kroah-Hartman 			(set & TIOCM_DTR) ? "HIGH" : (clear & TIOCM_DTR) ? "LOW" : "unchanged",
1214bfc51614SGreg Kroah-Hartman 			(set & TIOCM_RTS) ? "HIGH" : (clear & TIOCM_RTS) ? "LOW" : "unchanged");
12152c2ee545SJohan Hovold 		rv = usb_translate_errors(rv);
12161da177e4SLinus Torvalds 	} else {
1217bfc51614SGreg Kroah-Hartman 		dev_dbg(dev, "%s - DTR %s, RTS %s\n", __func__,
1218bfc51614SGreg Kroah-Hartman 			(set & TIOCM_DTR) ? "HIGH" : (clear & TIOCM_DTR) ? "LOW" : "unchanged",
1219bfc51614SGreg Kroah-Hartman 			(set & TIOCM_RTS) ? "HIGH" : (clear & TIOCM_RTS) ? "LOW" : "unchanged");
12209b0f2582SAlan Cox 		/* FIXME: locking on last_dtr_rts */
122174ede0ffSIan Abbott 		priv->last_dtr_rts = (priv->last_dtr_rts & ~clear) | set;
12221da177e4SLinus Torvalds 	}
12231da177e4SLinus Torvalds 	return rv;
12241da177e4SLinus Torvalds }
12251da177e4SLinus Torvalds 
12261da177e4SLinus Torvalds 
1227464cbb24SAlan Cox static __u32 get_ftdi_divisor(struct tty_struct *tty,
1228464cbb24SAlan Cox 						struct usb_serial_port *port)
1229e49bbce1SJohan Hovold {
12301da177e4SLinus Torvalds 	struct ftdi_private *priv = usb_get_serial_port_data(port);
1231bfc51614SGreg Kroah-Hartman 	struct device *dev = &port->dev;
12321da177e4SLinus Torvalds 	__u32 div_value = 0;
12331da177e4SLinus Torvalds 	int div_okay = 1;
12341da177e4SLinus Torvalds 	int baud;
12351da177e4SLinus Torvalds 
12361da177e4SLinus Torvalds 	/*
1237464cbb24SAlan Cox 	 * The logic involved in setting the baudrate can be cleanly split into
1238464cbb24SAlan Cox 	 * 3 steps.
12391da177e4SLinus Torvalds 	 * 1. Standard baud rates are set in tty->termios->c_cflag
1240464cbb24SAlan Cox 	 * 2. If these are not enough, you can set any speed using alt_speed as
1241464cbb24SAlan Cox 	 * follows:
12421da177e4SLinus Torvalds 	 *    - set tty->termios->c_cflag speed to B38400
12431da177e4SLinus Torvalds 	 *    - set your real speed in tty->alt_speed; it gets ignored when
12441da177e4SLinus Torvalds 	 *      alt_speed==0, (or)
1245464cbb24SAlan Cox 	 *    - call TIOCSSERIAL ioctl with (struct serial_struct) set as
1246464cbb24SAlan Cox 	 *	follows:
1247464cbb24SAlan Cox 	 *      flags & ASYNC_SPD_MASK == ASYNC_SPD_[HI, VHI, SHI, WARP],
1248464cbb24SAlan Cox 	 *	this just sets alt_speed to (HI: 57600, VHI: 115200,
1249464cbb24SAlan Cox 	 *	SHI: 230400, WARP: 460800)
12501da177e4SLinus Torvalds 	 * ** Steps 1, 2 are done courtesy of tty_get_baud_rate
12511da177e4SLinus Torvalds 	 * 3. You can also set baud rate by setting custom divisor as follows
12521da177e4SLinus Torvalds 	 *    - set tty->termios->c_cflag speed to B38400
1253464cbb24SAlan Cox 	 *    - call TIOCSSERIAL ioctl with (struct serial_struct) set as
1254464cbb24SAlan Cox 	 *	follows:
12551da177e4SLinus Torvalds 	 *      o flags & ASYNC_SPD_MASK == ASYNC_SPD_CUST
12561da177e4SLinus Torvalds 	 *      o custom_divisor set to baud_base / your_new_baudrate
1257464cbb24SAlan Cox 	 * ** Step 3 is done courtesy of code borrowed from serial.c
1258464cbb24SAlan Cox 	 *    I should really spend some time and separate + move this common
1259464cbb24SAlan Cox 	 *    code to serial.c, it is replicated in nearly every serial driver
1260464cbb24SAlan Cox 	 *    you see.
12611da177e4SLinus Torvalds 	 */
12621da177e4SLinus Torvalds 
1263464cbb24SAlan Cox 	/* 1. Get the baud rate from the tty settings, this observes
1264464cbb24SAlan Cox 	      alt_speed hack */
12651da177e4SLinus Torvalds 
126695da310eSAlan Cox 	baud = tty_get_baud_rate(tty);
1267bfc51614SGreg Kroah-Hartman 	dev_dbg(dev, "%s - tty_get_baud_rate reports speed %d\n", __func__, baud);
12681da177e4SLinus Torvalds 
1269464cbb24SAlan Cox 	/* 2. Observe async-compatible custom_divisor hack, update baudrate
1270464cbb24SAlan Cox 	   if needed */
12711da177e4SLinus Torvalds 
12721da177e4SLinus Torvalds 	if (baud == 38400 &&
12731da177e4SLinus Torvalds 	    ((priv->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) &&
12741da177e4SLinus Torvalds 	     (priv->custom_divisor)) {
12751da177e4SLinus Torvalds 		baud = priv->baud_base / priv->custom_divisor;
1276bfc51614SGreg Kroah-Hartman 		dev_dbg(dev, "%s - custom divisor %d sets baud rate to %d\n",
1277464cbb24SAlan Cox 			__func__, priv->custom_divisor, baud);
12781da177e4SLinus Torvalds 	}
12791da177e4SLinus Torvalds 
12801da177e4SLinus Torvalds 	/* 3. Convert baudrate to device-specific divisor */
12811da177e4SLinus Torvalds 
1282464cbb24SAlan Cox 	if (!baud)
1283464cbb24SAlan Cox 		baud = 9600;
12841da177e4SLinus Torvalds 	switch (priv->chip_type) {
12851da177e4SLinus Torvalds 	case SIO: /* SIO chip */
12861da177e4SLinus Torvalds 		switch (baud) {
12871da177e4SLinus Torvalds 		case 300: div_value = ftdi_sio_b300; break;
12881da177e4SLinus Torvalds 		case 600: div_value = ftdi_sio_b600; break;
12891da177e4SLinus Torvalds 		case 1200: div_value = ftdi_sio_b1200; break;
12901da177e4SLinus Torvalds 		case 2400: div_value = ftdi_sio_b2400; break;
12911da177e4SLinus Torvalds 		case 4800: div_value = ftdi_sio_b4800; break;
12921da177e4SLinus Torvalds 		case 9600: div_value = ftdi_sio_b9600; break;
12931da177e4SLinus Torvalds 		case 19200: div_value = ftdi_sio_b19200; break;
12941da177e4SLinus Torvalds 		case 38400: div_value = ftdi_sio_b38400; break;
12951da177e4SLinus Torvalds 		case 57600: div_value = ftdi_sio_b57600;  break;
12961da177e4SLinus Torvalds 		case 115200: div_value = ftdi_sio_b115200; break;
12971da177e4SLinus Torvalds 		} /* baud */
12981da177e4SLinus Torvalds 		if (div_value == 0) {
1299bfc51614SGreg Kroah-Hartman 			dev_dbg(dev, "%s - Baudrate (%d) requested is not supported\n",
1300464cbb24SAlan Cox 				__func__,  baud);
13011da177e4SLinus Torvalds 			div_value = ftdi_sio_b9600;
1302669a6db1SAlan Cox 			baud = 9600;
13031da177e4SLinus Torvalds 			div_okay = 0;
13041da177e4SLinus Torvalds 		}
13051da177e4SLinus Torvalds 		break;
13061da177e4SLinus Torvalds 	case FT8U232AM: /* 8U232AM chip */
13071da177e4SLinus Torvalds 		if (baud <= 3000000) {
13081da177e4SLinus Torvalds 			div_value = ftdi_232am_baud_to_divisor(baud);
13091da177e4SLinus Torvalds 		} else {
1310bfc51614SGreg Kroah-Hartman 			dev_dbg(dev, "%s - Baud rate too high!\n", __func__);
1311669a6db1SAlan Cox 			baud = 9600;
13121da177e4SLinus Torvalds 			div_value = ftdi_232am_baud_to_divisor(9600);
13131da177e4SLinus Torvalds 			div_okay = 0;
13141da177e4SLinus Torvalds 		}
13151da177e4SLinus Torvalds 		break;
13161da177e4SLinus Torvalds 	case FT232BM: /* FT232BM chip */
13171da177e4SLinus Torvalds 	case FT2232C: /* FT2232C chip */
1318dc0827c1SJim Paris 	case FT232RL: /* FT232RL chip */
1319dc0827c1SJim Paris 	case FTX:     /* FT-X series */
13201da177e4SLinus Torvalds 		if (baud <= 3000000) {
1321b760dac2SMartin Geleynse 			__u16 product_id = le16_to_cpu(
1322b760dac2SMartin Geleynse 				port->serial->dev->descriptor.idProduct);
1323b760dac2SMartin Geleynse 			if (((FTDI_NDI_HUC_PID == product_id) ||
1324b760dac2SMartin Geleynse 			     (FTDI_NDI_SPECTRA_SCU_PID == product_id) ||
1325b760dac2SMartin Geleynse 			     (FTDI_NDI_FUTURE_2_PID == product_id) ||
1326b760dac2SMartin Geleynse 			     (FTDI_NDI_FUTURE_3_PID == product_id) ||
1327b760dac2SMartin Geleynse 			     (FTDI_NDI_AURORA_SCU_PID == product_id)) &&
1328b760dac2SMartin Geleynse 			    (baud == 19200)) {
1329b760dac2SMartin Geleynse 				baud = 1200000;
1330b760dac2SMartin Geleynse 			}
13311da177e4SLinus Torvalds 			div_value = ftdi_232bm_baud_to_divisor(baud);
13321da177e4SLinus Torvalds 		} else {
1333bfc51614SGreg Kroah-Hartman 			dev_dbg(dev, "%s - Baud rate too high!\n", __func__);
13341da177e4SLinus Torvalds 			div_value = ftdi_232bm_baud_to_divisor(9600);
13351da177e4SLinus Torvalds 			div_okay = 0;
1336669a6db1SAlan Cox 			baud = 9600;
13371da177e4SLinus Torvalds 		}
13381da177e4SLinus Torvalds 		break;
1339094c2e6dSMark Adamson 	case FT2232H: /* FT2232H chip */
1340094c2e6dSMark Adamson 	case FT4232H: /* FT4232H chip */
1341309427b6SUwe Bonnes 	case FT232H:  /* FT232H chip */
13421862cdd5SIonut Nicu 		if ((baud <= 12000000) && (baud >= 1200)) {
1343094c2e6dSMark Adamson 			div_value = ftdi_2232h_baud_to_divisor(baud);
1344094c2e6dSMark Adamson 		} else if (baud < 1200) {
1345094c2e6dSMark Adamson 			div_value = ftdi_232bm_baud_to_divisor(baud);
1346094c2e6dSMark Adamson 		} else {
1347bfc51614SGreg Kroah-Hartman 			dev_dbg(dev, "%s - Baud rate too high!\n", __func__);
1348094c2e6dSMark Adamson 			div_value = ftdi_232bm_baud_to_divisor(9600);
1349094c2e6dSMark Adamson 			div_okay = 0;
1350094c2e6dSMark Adamson 			baud = 9600;
1351094c2e6dSMark Adamson 		}
1352094c2e6dSMark Adamson 		break;
13531da177e4SLinus Torvalds 	} /* priv->chip_type */
13541da177e4SLinus Torvalds 
13551da177e4SLinus Torvalds 	if (div_okay) {
1356bfc51614SGreg Kroah-Hartman 		dev_dbg(dev, "%s - Baud rate set to %d (divisor 0x%lX) on chip %s\n",
1357441b62c1SHarvey Harrison 			__func__, baud, (unsigned long)div_value,
13581da177e4SLinus Torvalds 			ftdi_chip_name[priv->chip_type]);
13591da177e4SLinus Torvalds 	}
13601da177e4SLinus Torvalds 
136195da310eSAlan Cox 	tty_encode_baud_rate(tty, baud, baud);
1362464cbb24SAlan Cox 	return div_value;
13631da177e4SLinus Torvalds }
13641da177e4SLinus Torvalds 
136595da310eSAlan Cox static int change_speed(struct tty_struct *tty, struct usb_serial_port *port)
136695da310eSAlan Cox {
136795da310eSAlan Cox 	struct ftdi_private *priv = usb_get_serial_port_data(port);
136895da310eSAlan Cox 	__u16 urb_value;
136995da310eSAlan Cox 	__u16 urb_index;
137095da310eSAlan Cox 	__u32 urb_index_value;
137195da310eSAlan Cox 	int rv;
137295da310eSAlan Cox 
137395da310eSAlan Cox 	urb_index_value = get_ftdi_divisor(tty, port);
137495da310eSAlan Cox 	urb_value = (__u16)urb_index_value;
137595da310eSAlan Cox 	urb_index = (__u16)(urb_index_value >> 16);
13760ee404ccSUwe Bonnes 	if ((priv->chip_type == FT2232C) || (priv->chip_type == FT2232H) ||
13770ee404ccSUwe Bonnes 		(priv->chip_type == FT4232H) || (priv->chip_type == FT232H)) {
13780ee404ccSUwe Bonnes 		/* Probably the BM type needs the MSB of the encoded fractional
13790ee404ccSUwe Bonnes 		 * divider also moved like for the chips above. Any infos? */
138095da310eSAlan Cox 		urb_index = (__u16)((urb_index << 8) | priv->interface);
138195da310eSAlan Cox 	}
138295da310eSAlan Cox 
138395da310eSAlan Cox 	rv = usb_control_msg(port->serial->dev,
138495da310eSAlan Cox 			    usb_sndctrlpipe(port->serial->dev, 0),
138595da310eSAlan Cox 			    FTDI_SIO_SET_BAUDRATE_REQUEST,
138695da310eSAlan Cox 			    FTDI_SIO_SET_BAUDRATE_REQUEST_TYPE,
138795da310eSAlan Cox 			    urb_value, urb_index,
138866e47e60SJohan Hovold 			    NULL, 0, WDR_SHORT_TIMEOUT);
138995da310eSAlan Cox 	return rv;
139095da310eSAlan Cox }
139195da310eSAlan Cox 
1392557aaa7fSAlan Cox static int write_latency_timer(struct usb_serial_port *port)
1393557aaa7fSAlan Cox {
1394557aaa7fSAlan Cox 	struct ftdi_private *priv = usb_get_serial_port_data(port);
1395557aaa7fSAlan Cox 	struct usb_device *udev = port->serial->dev;
1396c1284d77SJohan Hovold 	int rv;
1397557aaa7fSAlan Cox 	int l = priv->latency;
139895da310eSAlan Cox 
1399557aaa7fSAlan Cox 	if (priv->flags & ASYNC_LOW_LATENCY)
1400557aaa7fSAlan Cox 		l = 1;
1401557aaa7fSAlan Cox 
1402bfc51614SGreg Kroah-Hartman 	dev_dbg(&port->dev, "%s: setting latency timer = %i\n", __func__, l);
1403557aaa7fSAlan Cox 
1404557aaa7fSAlan Cox 	rv = usb_control_msg(udev,
1405557aaa7fSAlan Cox 			     usb_sndctrlpipe(udev, 0),
1406557aaa7fSAlan Cox 			     FTDI_SIO_SET_LATENCY_TIMER_REQUEST,
1407557aaa7fSAlan Cox 			     FTDI_SIO_SET_LATENCY_TIMER_REQUEST_TYPE,
1408557aaa7fSAlan Cox 			     l, priv->interface,
140966e47e60SJohan Hovold 			     NULL, 0, WDR_TIMEOUT);
1410557aaa7fSAlan Cox 	if (rv < 0)
1411557aaa7fSAlan Cox 		dev_err(&port->dev, "Unable to write latency timer: %i\n", rv);
1412557aaa7fSAlan Cox 	return rv;
1413557aaa7fSAlan Cox }
1414557aaa7fSAlan Cox 
1415557aaa7fSAlan Cox static int read_latency_timer(struct usb_serial_port *port)
1416557aaa7fSAlan Cox {
1417557aaa7fSAlan Cox 	struct ftdi_private *priv = usb_get_serial_port_data(port);
1418557aaa7fSAlan Cox 	struct usb_device *udev = port->serial->dev;
141954f328d0SJohan Hovold 	unsigned char *buf;
1420c1284d77SJohan Hovold 	int rv;
1421557aaa7fSAlan Cox 
142254f328d0SJohan Hovold 	buf = kmalloc(1, GFP_KERNEL);
142354f328d0SJohan Hovold 	if (!buf)
142454f328d0SJohan Hovold 		return -ENOMEM;
142554f328d0SJohan Hovold 
1426557aaa7fSAlan Cox 	rv = usb_control_msg(udev,
1427557aaa7fSAlan Cox 			     usb_rcvctrlpipe(udev, 0),
1428557aaa7fSAlan Cox 			     FTDI_SIO_GET_LATENCY_TIMER_REQUEST,
1429557aaa7fSAlan Cox 			     FTDI_SIO_GET_LATENCY_TIMER_REQUEST_TYPE,
1430557aaa7fSAlan Cox 			     0, priv->interface,
143154f328d0SJohan Hovold 			     buf, 1, WDR_TIMEOUT);
14324357369dSJohan Hovold 	if (rv < 0)
1433557aaa7fSAlan Cox 		dev_err(&port->dev, "Unable to read latency timer: %i\n", rv);
14344357369dSJohan Hovold 	else
143554f328d0SJohan Hovold 		priv->latency = buf[0];
143654f328d0SJohan Hovold 
143754f328d0SJohan Hovold 	kfree(buf);
143854f328d0SJohan Hovold 
14398c4f99cdSJohan Hovold 	return rv;
1440557aaa7fSAlan Cox }
14411da177e4SLinus Torvalds 
1442464cbb24SAlan Cox static int get_serial_info(struct usb_serial_port *port,
1443464cbb24SAlan Cox 				struct serial_struct __user *retinfo)
14441da177e4SLinus Torvalds {
14451da177e4SLinus Torvalds 	struct ftdi_private *priv = usb_get_serial_port_data(port);
14461da177e4SLinus Torvalds 	struct serial_struct tmp;
14471da177e4SLinus Torvalds 
14481da177e4SLinus Torvalds 	if (!retinfo)
14491da177e4SLinus Torvalds 		return -EFAULT;
14501da177e4SLinus Torvalds 	memset(&tmp, 0, sizeof(tmp));
14511da177e4SLinus Torvalds 	tmp.flags = priv->flags;
14521da177e4SLinus Torvalds 	tmp.baud_base = priv->baud_base;
14531da177e4SLinus Torvalds 	tmp.custom_divisor = priv->custom_divisor;
14541da177e4SLinus Torvalds 	if (copy_to_user(retinfo, &tmp, sizeof(*retinfo)))
14551da177e4SLinus Torvalds 		return -EFAULT;
14561da177e4SLinus Torvalds 	return 0;
1457e49bbce1SJohan Hovold }
14581da177e4SLinus Torvalds 
145995da310eSAlan Cox static int set_serial_info(struct tty_struct *tty,
146095da310eSAlan Cox 	struct usb_serial_port *port, struct serial_struct __user *newinfo)
1461e49bbce1SJohan Hovold {
14621da177e4SLinus Torvalds 	struct ftdi_private *priv = usb_get_serial_port_data(port);
14631da177e4SLinus Torvalds 	struct serial_struct new_serial;
14641da177e4SLinus Torvalds 	struct ftdi_private old_priv;
14651da177e4SLinus Torvalds 
14661da177e4SLinus Torvalds 	if (copy_from_user(&new_serial, newinfo, sizeof(new_serial)))
14671da177e4SLinus Torvalds 		return -EFAULT;
14686b447f04SAlan Cox 
1469bd09a9f5SAlessio Igor Bogani 	mutex_lock(&priv->cfg_lock);
14701da177e4SLinus Torvalds 	old_priv = *priv;
14711da177e4SLinus Torvalds 
14721da177e4SLinus Torvalds 	/* Do error checking and permission checking */
14731da177e4SLinus Torvalds 
14741da177e4SLinus Torvalds 	if (!capable(CAP_SYS_ADMIN)) {
14751da177e4SLinus Torvalds 		if (((new_serial.flags & ~ASYNC_USR_MASK) !=
147664905b48SDan Carpenter 		     (priv->flags & ~ASYNC_USR_MASK))) {
1477bd09a9f5SAlessio Igor Bogani 			mutex_unlock(&priv->cfg_lock);
14781da177e4SLinus Torvalds 			return -EPERM;
147964905b48SDan Carpenter 		}
14801da177e4SLinus Torvalds 		priv->flags = ((priv->flags & ~ASYNC_USR_MASK) |
14811da177e4SLinus Torvalds 			       (new_serial.flags & ASYNC_USR_MASK));
14821da177e4SLinus Torvalds 		priv->custom_divisor = new_serial.custom_divisor;
14831da177e4SLinus Torvalds 		goto check_and_exit;
14841da177e4SLinus Torvalds 	}
14851da177e4SLinus Torvalds 
1486eb833a9eSJohan Hovold 	if (new_serial.baud_base != priv->baud_base) {
1487bd09a9f5SAlessio Igor Bogani 		mutex_unlock(&priv->cfg_lock);
14881da177e4SLinus Torvalds 		return -EINVAL;
14896b447f04SAlan Cox 	}
14901da177e4SLinus Torvalds 
14911da177e4SLinus Torvalds 	/* Make the changes - these are privileged changes! */
14921da177e4SLinus Torvalds 
14931da177e4SLinus Torvalds 	priv->flags = ((priv->flags & ~ASYNC_FLAGS) |
14941da177e4SLinus Torvalds 					(new_serial.flags & ASYNC_FLAGS));
14951da177e4SLinus Torvalds 	priv->custom_divisor = new_serial.custom_divisor;
14961da177e4SLinus Torvalds 
1497557aaa7fSAlan Cox 	write_latency_timer(port);
14981da177e4SLinus Torvalds 
14991da177e4SLinus Torvalds check_and_exit:
15001da177e4SLinus Torvalds 	if ((old_priv.flags & ASYNC_SPD_MASK) !=
15011da177e4SLinus Torvalds 	     (priv->flags & ASYNC_SPD_MASK)) {
15021da177e4SLinus Torvalds 		if ((priv->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
150395da310eSAlan Cox 			tty->alt_speed = 57600;
15041da177e4SLinus Torvalds 		else if ((priv->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
150595da310eSAlan Cox 			tty->alt_speed = 115200;
15061da177e4SLinus Torvalds 		else if ((priv->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
150795da310eSAlan Cox 			tty->alt_speed = 230400;
15081da177e4SLinus Torvalds 		else if ((priv->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
150995da310eSAlan Cox 			tty->alt_speed = 460800;
15101da177e4SLinus Torvalds 		else
151195da310eSAlan Cox 			tty->alt_speed = 0;
15121da177e4SLinus Torvalds 	}
15131da177e4SLinus Torvalds 	if (((old_priv.flags & ASYNC_SPD_MASK) !=
15141da177e4SLinus Torvalds 	     (priv->flags & ASYNC_SPD_MASK)) ||
15151da177e4SLinus Torvalds 	    (((priv->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) &&
15161da177e4SLinus Torvalds 	     (old_priv.custom_divisor != priv->custom_divisor))) {
151795da310eSAlan Cox 		change_speed(tty, port);
15189c67d28eSAlessio Igor Bogani 		mutex_unlock(&priv->cfg_lock);
15191da177e4SLinus Torvalds 	}
15206b447f04SAlan Cox 	else
1521bd09a9f5SAlessio Igor Bogani 		mutex_unlock(&priv->cfg_lock);
152295da310eSAlan Cox 	return 0;
1523e49bbce1SJohan Hovold }
15241da177e4SLinus Torvalds 
1525c466cd2bSGreg Kroah-Hartman static int get_lsr_info(struct usb_serial_port *port,
1526c466cd2bSGreg Kroah-Hartman 			struct serial_struct __user *retinfo)
1527c466cd2bSGreg Kroah-Hartman {
1528c466cd2bSGreg Kroah-Hartman 	struct ftdi_private *priv = usb_get_serial_port_data(port);
1529c466cd2bSGreg Kroah-Hartman 	unsigned int result = 0;
1530c466cd2bSGreg Kroah-Hartman 
1531c466cd2bSGreg Kroah-Hartman 	if (!retinfo)
1532c466cd2bSGreg Kroah-Hartman 		return -EFAULT;
1533c466cd2bSGreg Kroah-Hartman 
1534c466cd2bSGreg Kroah-Hartman 	if (priv->transmit_empty)
1535c466cd2bSGreg Kroah-Hartman 		result = TIOCSER_TEMT;
1536c466cd2bSGreg Kroah-Hartman 
1537c466cd2bSGreg Kroah-Hartman 	if (copy_to_user(retinfo, &result, sizeof(unsigned int)))
1538c466cd2bSGreg Kroah-Hartman 		return -EFAULT;
1539c466cd2bSGreg Kroah-Hartman 	return 0;
1540c466cd2bSGreg Kroah-Hartman }
1541c466cd2bSGreg Kroah-Hartman 
15421da177e4SLinus Torvalds 
15438f977e42SIan Abbott /* Determine type of FTDI chip based on USB config and descriptor. */
15448f977e42SIan Abbott static void ftdi_determine_type(struct usb_serial_port *port)
15458f977e42SIan Abbott {
15468f977e42SIan Abbott 	struct ftdi_private *priv = usb_get_serial_port_data(port);
15478f977e42SIan Abbott 	struct usb_serial *serial = port->serial;
15488f977e42SIan Abbott 	struct usb_device *udev = serial->dev;
15498f977e42SIan Abbott 	unsigned version;
15508f977e42SIan Abbott 	unsigned interfaces;
15518f977e42SIan Abbott 
15528f977e42SIan Abbott 	/* Assume it is not the original SIO device for now. */
1553f5e09b7cSIan Abbott 	priv->baud_base = 48000000 / 2;
15548f977e42SIan Abbott 
15558f977e42SIan Abbott 	version = le16_to_cpu(udev->descriptor.bcdDevice);
15568f977e42SIan Abbott 	interfaces = udev->actconfig->desc.bNumInterfaces;
1557bfc51614SGreg Kroah-Hartman 	dev_dbg(&port->dev, "%s: bcdDevice = 0x%x, bNumInterfaces = %u\n", __func__,
15588f977e42SIan Abbott 		version, interfaces);
15598f977e42SIan Abbott 	if (interfaces > 1) {
15608f977e42SIan Abbott 		int inter;
15618f977e42SIan Abbott 
1562094c2e6dSMark Adamson 		/* Multiple interfaces.*/
1563094c2e6dSMark Adamson 		if (version == 0x0800) {
1564094c2e6dSMark Adamson 			priv->chip_type = FT4232H;
1565094c2e6dSMark Adamson 			/* Hi-speed - baud clock runs at 120MHz */
1566094c2e6dSMark Adamson 			priv->baud_base = 120000000 / 2;
1567094c2e6dSMark Adamson 		} else if (version == 0x0700) {
1568094c2e6dSMark Adamson 			priv->chip_type = FT2232H;
1569094c2e6dSMark Adamson 			/* Hi-speed - baud clock runs at 120MHz */
1570094c2e6dSMark Adamson 			priv->baud_base = 120000000 / 2;
1571094c2e6dSMark Adamson 		} else
15728f977e42SIan Abbott 			priv->chip_type = FT2232C;
1573094c2e6dSMark Adamson 
15748f977e42SIan Abbott 		/* Determine interface code. */
15758f977e42SIan Abbott 		inter = serial->interface->altsetting->desc.bInterfaceNumber;
1576094c2e6dSMark Adamson 		if (inter == 0) {
1577094c2e6dSMark Adamson 			priv->interface = INTERFACE_A;
1578094c2e6dSMark Adamson 		} else  if (inter == 1) {
1579094c2e6dSMark Adamson 			priv->interface = INTERFACE_B;
1580094c2e6dSMark Adamson 		} else  if (inter == 2) {
1581094c2e6dSMark Adamson 			priv->interface = INTERFACE_C;
1582094c2e6dSMark Adamson 		} else  if (inter == 3) {
1583094c2e6dSMark Adamson 			priv->interface = INTERFACE_D;
1584094c2e6dSMark Adamson 		}
15858f977e42SIan Abbott 		/* BM-type devices have a bug where bcdDevice gets set
15868f977e42SIan Abbott 		 * to 0x200 when iSerialNumber is 0.  */
15878f977e42SIan Abbott 		if (version < 0x500) {
1588bfc51614SGreg Kroah-Hartman 			dev_dbg(&port->dev,
1589bfc51614SGreg Kroah-Hartman 				"%s: something fishy - bcdDevice too low for multi-interface device\n",
1590441b62c1SHarvey Harrison 				__func__);
15918f977e42SIan Abbott 		}
15928f977e42SIan Abbott 	} else if (version < 0x200) {
1593330e3c4cSAndreas Mohr 		/* Old device.  Assume it's the original SIO. */
15948f977e42SIan Abbott 		priv->chip_type = SIO;
15958f977e42SIan Abbott 		priv->baud_base = 12000000 / 16;
15968f977e42SIan Abbott 	} else if (version < 0x400) {
1597330e3c4cSAndreas Mohr 		/* Assume it's an FT8U232AM (or FT8U245AM) */
15988f977e42SIan Abbott 		/* (It might be a BM because of the iSerialNumber bug,
15998f977e42SIan Abbott 		 * but it will still work as an AM device.) */
16008f977e42SIan Abbott 		priv->chip_type = FT8U232AM;
16013b009c63SDavid Brownell 	} else if (version < 0x600) {
1602330e3c4cSAndreas Mohr 		/* Assume it's an FT232BM (or FT245BM) */
16038f977e42SIan Abbott 		priv->chip_type = FT232BM;
1604309427b6SUwe Bonnes 	} else if (version < 0x900) {
1605309427b6SUwe Bonnes 		/* Assume it's an FT232RL */
16063b009c63SDavid Brownell 		priv->chip_type = FT232RL;
1607dc0827c1SJim Paris 	} else if (version < 0x1000) {
1608309427b6SUwe Bonnes 		/* Assume it's an FT232H */
1609309427b6SUwe Bonnes 		priv->chip_type = FT232H;
1610dc0827c1SJim Paris 	} else {
1611dc0827c1SJim Paris 		/* Assume it's an FT-X series device */
1612dc0827c1SJim Paris 		priv->chip_type = FTX;
16138f977e42SIan Abbott 	}
1614dc0827c1SJim Paris 
1615c197a8dbSGreg Kroah-Hartman 	dev_info(&udev->dev, "Detected %s\n", ftdi_chip_name[priv->chip_type]);
16168f977e42SIan Abbott }
16178f977e42SIan Abbott 
16188f977e42SIan Abbott 
161947e57595SJohan Hovold /*
162047e57595SJohan Hovold  * Determine the maximum packet size for the device. This depends on the chip
1621895f28baSMark Adamson  * type and the USB host capabilities. The value should be obtained from the
162247e57595SJohan Hovold  * device descriptor as the chip will use the appropriate values for the host.
162347e57595SJohan Hovold  */
1624895f28baSMark Adamson static void ftdi_set_max_packet_size(struct usb_serial_port *port)
1625895f28baSMark Adamson {
1626895f28baSMark Adamson 	struct ftdi_private *priv = usb_get_serial_port_data(port);
162747e57595SJohan Hovold 	struct usb_interface *interface = port->serial->interface;
1628aea1ae87SJohan Hovold 	struct usb_endpoint_descriptor *ep_desc;
1629895f28baSMark Adamson 	unsigned num_endpoints;
1630aea1ae87SJohan Hovold 	unsigned i;
1631895f28baSMark Adamson 
1632895f28baSMark Adamson 	num_endpoints = interface->cur_altsetting->desc.bNumEndpoints;
1633aea1ae87SJohan Hovold 	if (!num_endpoints)
1634aea1ae87SJohan Hovold 		return;
1635aea1ae87SJohan Hovold 
163647e57595SJohan Hovold 	/*
163747e57595SJohan Hovold 	 * NOTE: Some customers have programmed FT232R/FT245R devices
1638895f28baSMark Adamson 	 * with an endpoint size of 0 - not good. In this case, we
1639895f28baSMark Adamson 	 * want to override the endpoint descriptor setting and use a
164047e57595SJohan Hovold 	 * value of 64 for wMaxPacketSize.
164147e57595SJohan Hovold 	 */
1642895f28baSMark Adamson 	for (i = 0; i < num_endpoints; i++) {
1643895f28baSMark Adamson 		ep_desc = &interface->cur_altsetting->endpoint[i].desc;
164447e57595SJohan Hovold 		if (!ep_desc->wMaxPacketSize) {
1645895f28baSMark Adamson 			ep_desc->wMaxPacketSize = cpu_to_le16(0x40);
1646a90d84adSJohan Hovold 			dev_warn(&port->dev, "Overriding wMaxPacketSize on endpoint %d\n",
1647a90d84adSJohan Hovold 					usb_endpoint_num(ep_desc));
1648895f28baSMark Adamson 		}
1649895f28baSMark Adamson 	}
1650895f28baSMark Adamson 
165147e57595SJohan Hovold 	/* Set max packet size based on last descriptor. */
165229cc8897SKuninori Morimoto 	priv->max_packet_size = usb_endpoint_maxp(ep_desc);
1653895f28baSMark Adamson }
1654895f28baSMark Adamson 
1655895f28baSMark Adamson 
16561da177e4SLinus Torvalds /*
16571da177e4SLinus Torvalds  * ***************************************************************************
16581da177e4SLinus Torvalds  * Sysfs Attribute
16591da177e4SLinus Torvalds  * ***************************************************************************
16601da177e4SLinus Torvalds  */
16611da177e4SLinus Torvalds 
1662154547c4SGreg Kroah-Hartman static ssize_t latency_timer_show(struct device *dev,
1663464cbb24SAlan Cox 				  struct device_attribute *attr, char *buf)
16641da177e4SLinus Torvalds {
16651da177e4SLinus Torvalds 	struct usb_serial_port *port = to_usb_serial_port(dev);
16661da177e4SLinus Torvalds 	struct ftdi_private *priv = usb_get_serial_port_data(port);
1667557aaa7fSAlan Cox 	if (priv->flags & ASYNC_LOW_LATENCY)
1668557aaa7fSAlan Cox 		return sprintf(buf, "1\n");
1669557aaa7fSAlan Cox 	else
1670557aaa7fSAlan Cox 		return sprintf(buf, "%i\n", priv->latency);
16711da177e4SLinus Torvalds }
1672557aaa7fSAlan Cox 
16731da177e4SLinus Torvalds /* Write a new value of the latency timer, in units of milliseconds. */
1674154547c4SGreg Kroah-Hartman static ssize_t latency_timer_store(struct device *dev,
1675154547c4SGreg Kroah-Hartman 				   struct device_attribute *attr,
1676154547c4SGreg Kroah-Hartman 				   const char *valbuf, size_t count)
16771da177e4SLinus Torvalds {
16781da177e4SLinus Torvalds 	struct usb_serial_port *port = to_usb_serial_port(dev);
16791da177e4SLinus Torvalds 	struct ftdi_private *priv = usb_get_serial_port_data(port);
16801da177e4SLinus Torvalds 	int v = simple_strtoul(valbuf, NULL, 10);
1681c1284d77SJohan Hovold 	int rv;
16821da177e4SLinus Torvalds 
1683557aaa7fSAlan Cox 	priv->latency = v;
1684557aaa7fSAlan Cox 	rv = write_latency_timer(port);
1685557aaa7fSAlan Cox 	if (rv < 0)
16861da177e4SLinus Torvalds 		return -EIO;
16871da177e4SLinus Torvalds 	return count;
16881da177e4SLinus Torvalds }
1689154547c4SGreg Kroah-Hartman static DEVICE_ATTR_RW(latency_timer);
16901da177e4SLinus Torvalds 
16911da177e4SLinus Torvalds /* Write an event character directly to the FTDI register.  The ASCII
16921da177e4SLinus Torvalds    value is in the low 8 bits, with the enable bit in the 9th bit. */
1693464cbb24SAlan Cox static ssize_t store_event_char(struct device *dev,
1694464cbb24SAlan Cox 	struct device_attribute *attr, const char *valbuf, size_t count)
16951da177e4SLinus Torvalds {
16961da177e4SLinus Torvalds 	struct usb_serial_port *port = to_usb_serial_port(dev);
16971da177e4SLinus Torvalds 	struct ftdi_private *priv = usb_get_serial_port_data(port);
169812bdbe03SJim Radford 	struct usb_device *udev = port->serial->dev;
16991da177e4SLinus Torvalds 	int v = simple_strtoul(valbuf, NULL, 10);
1700c1284d77SJohan Hovold 	int rv;
17011da177e4SLinus Torvalds 
1702bfc51614SGreg Kroah-Hartman 	dev_dbg(&port->dev, "%s: setting event char = %i\n", __func__, v);
17031da177e4SLinus Torvalds 
17041da177e4SLinus Torvalds 	rv = usb_control_msg(udev,
17051da177e4SLinus Torvalds 			     usb_sndctrlpipe(udev, 0),
17061da177e4SLinus Torvalds 			     FTDI_SIO_SET_EVENT_CHAR_REQUEST,
17071da177e4SLinus Torvalds 			     FTDI_SIO_SET_EVENT_CHAR_REQUEST_TYPE,
17081da177e4SLinus Torvalds 			     v, priv->interface,
170966e47e60SJohan Hovold 			     NULL, 0, WDR_TIMEOUT);
17101da177e4SLinus Torvalds 	if (rv < 0) {
1711bfc51614SGreg Kroah-Hartman 		dev_dbg(&port->dev, "Unable to write event character: %i\n", rv);
17121da177e4SLinus Torvalds 		return -EIO;
17131da177e4SLinus Torvalds 	}
17141da177e4SLinus Torvalds 
17151da177e4SLinus Torvalds 	return count;
17161da177e4SLinus Torvalds }
17171da177e4SLinus Torvalds static DEVICE_ATTR(event_char, S_IWUSR, NULL, store_event_char);
17181da177e4SLinus Torvalds 
171912bdbe03SJim Radford static int create_sysfs_attrs(struct usb_serial_port *port)
17201da177e4SLinus Torvalds {
172112bdbe03SJim Radford 	struct ftdi_private *priv = usb_get_serial_port_data(port);
172213f4db9eSGreg Kroah-Hartman 	int retval = 0;
17231da177e4SLinus Torvalds 
17241da177e4SLinus Torvalds 	/* XXX I've no idea if the original SIO supports the event_char
17251da177e4SLinus Torvalds 	 * sysfs parameter, so I'm playing it safe.  */
17261da177e4SLinus Torvalds 	if (priv->chip_type != SIO) {
1727bfc51614SGreg Kroah-Hartman 		dev_dbg(&port->dev, "sysfs attributes for %s\n", ftdi_chip_name[priv->chip_type]);
172812bdbe03SJim Radford 		retval = device_create_file(&port->dev, &dev_attr_event_char);
172913f4db9eSGreg Kroah-Hartman 		if ((!retval) &&
173097cd49ebSStepan Moskovchenko 		    (priv->chip_type == FT232BM ||
173197cd49ebSStepan Moskovchenko 		     priv->chip_type == FT2232C ||
1732094c2e6dSMark Adamson 		     priv->chip_type == FT232RL ||
1733094c2e6dSMark Adamson 		     priv->chip_type == FT2232H ||
1734309427b6SUwe Bonnes 		     priv->chip_type == FT4232H ||
1735dc0827c1SJim Paris 		     priv->chip_type == FT232H ||
1736dc0827c1SJim Paris 		     priv->chip_type == FTX)) {
173712bdbe03SJim Radford 			retval = device_create_file(&port->dev,
173813f4db9eSGreg Kroah-Hartman 						    &dev_attr_latency_timer);
17391da177e4SLinus Torvalds 		}
17401da177e4SLinus Torvalds 	}
174113f4db9eSGreg Kroah-Hartman 	return retval;
17421da177e4SLinus Torvalds }
17431da177e4SLinus Torvalds 
174412bdbe03SJim Radford static void remove_sysfs_attrs(struct usb_serial_port *port)
17451da177e4SLinus Torvalds {
174612bdbe03SJim Radford 	struct ftdi_private *priv = usb_get_serial_port_data(port);
17471da177e4SLinus Torvalds 
17481da177e4SLinus Torvalds 	/* XXX see create_sysfs_attrs */
17491da177e4SLinus Torvalds 	if (priv->chip_type != SIO) {
175012bdbe03SJim Radford 		device_remove_file(&port->dev, &dev_attr_event_char);
1751ed6e5282SAndrew M. Bishop 		if (priv->chip_type == FT232BM ||
1752ed6e5282SAndrew M. Bishop 		    priv->chip_type == FT2232C ||
1753094c2e6dSMark Adamson 		    priv->chip_type == FT232RL ||
1754094c2e6dSMark Adamson 		    priv->chip_type == FT2232H ||
1755309427b6SUwe Bonnes 		    priv->chip_type == FT4232H ||
1756dc0827c1SJim Paris 		    priv->chip_type == FT232H ||
1757dc0827c1SJim Paris 		    priv->chip_type == FTX) {
175812bdbe03SJim Radford 			device_remove_file(&port->dev, &dev_attr_latency_timer);
17591da177e4SLinus Torvalds 		}
17601da177e4SLinus Torvalds 	}
17611da177e4SLinus Torvalds 
17621da177e4SLinus Torvalds }
17631da177e4SLinus Torvalds 
17641da177e4SLinus Torvalds /*
17651da177e4SLinus Torvalds  * ***************************************************************************
17661da177e4SLinus Torvalds  * FTDI driver specific functions
17671da177e4SLinus Torvalds  * ***************************************************************************
17681da177e4SLinus Torvalds  */
17691da177e4SLinus Torvalds 
17708f977e42SIan Abbott /* Probe function to check for special devices */
1771464cbb24SAlan Cox static int ftdi_sio_probe(struct usb_serial *serial,
1772464cbb24SAlan Cox 					const struct usb_device_id *id)
17738f977e42SIan Abbott {
1774464cbb24SAlan Cox 	struct ftdi_sio_quirk *quirk =
1775464cbb24SAlan Cox 				(struct ftdi_sio_quirk *)id->driver_info;
1776fa91d43bSTony Lindgren 
1777fa91d43bSTony Lindgren 	if (quirk && quirk->probe) {
1778fa91d43bSTony Lindgren 		int ret = quirk->probe(serial);
1779fa91d43bSTony Lindgren 		if (ret != 0)
1780fa91d43bSTony Lindgren 			return ret;
1781fa91d43bSTony Lindgren 	}
1782fa91d43bSTony Lindgren 
17838f977e42SIan Abbott 	usb_set_serial_data(serial, (void *)id->driver_info);
17848f977e42SIan Abbott 
1785fa91d43bSTony Lindgren 	return 0;
17868f977e42SIan Abbott }
17878f977e42SIan Abbott 
178812bdbe03SJim Radford static int ftdi_sio_port_probe(struct usb_serial_port *port)
17891da177e4SLinus Torvalds {
17901da177e4SLinus Torvalds 	struct ftdi_private *priv;
17910ffbbe25SOliver Neukum 	struct ftdi_sio_quirk *quirk = usb_get_serial_data(port->serial);
17920ffbbe25SOliver Neukum 
17931da177e4SLinus Torvalds 
179480b6ca48SEric Sesterhenn 	priv = kzalloc(sizeof(struct ftdi_private), GFP_KERNEL);
179510c642d0SJohan Hovold 	if (!priv)
17961da177e4SLinus Torvalds 		return -ENOMEM;
17971da177e4SLinus Torvalds 
1798bd09a9f5SAlessio Igor Bogani 	mutex_init(&priv->cfg_lock);
17990076b4beSJohan Hovold 
18001da177e4SLinus Torvalds 	priv->flags = ASYNC_LOW_LATENCY;
18011da177e4SLinus Torvalds 
18020ffbbe25SOliver Neukum 	if (quirk && quirk->port_probe)
18030ffbbe25SOliver Neukum 		quirk->port_probe(priv);
18040ffbbe25SOliver Neukum 
180512bdbe03SJim Radford 	usb_set_serial_port_data(port, priv);
18061da177e4SLinus Torvalds 
180712bdbe03SJim Radford 	ftdi_determine_type(port);
1808895f28baSMark Adamson 	ftdi_set_max_packet_size(port);
18098c4f99cdSJohan Hovold 	if (read_latency_timer(port) < 0)
18108c4f99cdSJohan Hovold 		priv->latency = 16;
1811c19db4c9SJohan Hovold 	write_latency_timer(port);
181212bdbe03SJim Radford 	create_sysfs_attrs(port);
181312bdbe03SJim Radford 	return 0;
18141da177e4SLinus Torvalds }
18151da177e4SLinus Torvalds 
18168f977e42SIan Abbott /* Setup for the USB-UIRT device, which requires hardwired
18178f977e42SIan Abbott  * baudrate (38400 gets mapped to 312500) */
18181da177e4SLinus Torvalds /* Called from usbserial:serial_probe */
18190ffbbe25SOliver Neukum static void ftdi_USB_UIRT_setup(struct ftdi_private *priv)
18201da177e4SLinus Torvalds {
18211da177e4SLinus Torvalds 	priv->flags |= ASYNC_SPD_CUST;
18221da177e4SLinus Torvalds 	priv->custom_divisor = 77;
1823669a6db1SAlan Cox 	priv->force_baud = 38400;
1824e49bbce1SJohan Hovold }
18251da177e4SLinus Torvalds 
18268f977e42SIan Abbott /* Setup for the HE-TIRA1 device, which requires hardwired
18278f977e42SIan Abbott  * baudrate (38400 gets mapped to 100000) and RTS-CTS enabled.  */
1828464cbb24SAlan Cox 
18290ffbbe25SOliver Neukum static void ftdi_HE_TIRA1_setup(struct ftdi_private *priv)
18308f977e42SIan Abbott {
18311da177e4SLinus Torvalds 	priv->flags |= ASYNC_SPD_CUST;
18321da177e4SLinus Torvalds 	priv->custom_divisor = 240;
1833669a6db1SAlan Cox 	priv->force_baud = 38400;
18341da177e4SLinus Torvalds 	priv->force_rtscts = 1;
1835e49bbce1SJohan Hovold }
18361da177e4SLinus Torvalds 
1837fa91d43bSTony Lindgren /*
1838b760dac2SMartin Geleynse  * Module parameter to control latency timer for NDI FTDI-based USB devices.
1839970e2486SLucas De Marchi  * If this value is not set in /etc/modprobe.d/ its value will be set
1840970e2486SLucas De Marchi  * to 1ms.
1841b760dac2SMartin Geleynse  */
1842b760dac2SMartin Geleynse static int ndi_latency_timer = 1;
1843b760dac2SMartin Geleynse 
1844b760dac2SMartin Geleynse /* Setup for the NDI FTDI-based USB devices, which requires hardwired
1845b760dac2SMartin Geleynse  * baudrate (19200 gets mapped to 1200000).
1846b760dac2SMartin Geleynse  *
1847b760dac2SMartin Geleynse  * Called from usbserial:serial_probe.
1848b760dac2SMartin Geleynse  */
1849b760dac2SMartin Geleynse static int ftdi_NDI_device_setup(struct usb_serial *serial)
1850b760dac2SMartin Geleynse {
1851b760dac2SMartin Geleynse 	struct usb_device *udev = serial->dev;
1852b760dac2SMartin Geleynse 	int latency = ndi_latency_timer;
1853b760dac2SMartin Geleynse 
1854b760dac2SMartin Geleynse 	if (latency == 0)
1855b760dac2SMartin Geleynse 		latency = 1;
1856b760dac2SMartin Geleynse 	if (latency > 99)
1857b760dac2SMartin Geleynse 		latency = 99;
1858b760dac2SMartin Geleynse 
1859bfc51614SGreg Kroah-Hartman 	dev_dbg(&udev->dev, "%s setting NDI device latency to %d\n", __func__, latency);
1860bfc51614SGreg Kroah-Hartman 	dev_info(&udev->dev, "NDI device with a latency value of %d\n", latency);
1861b760dac2SMartin Geleynse 
1862c1284d77SJohan Hovold 	/* FIXME: errors are not returned */
1863c1284d77SJohan Hovold 	usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
1864b760dac2SMartin Geleynse 				FTDI_SIO_SET_LATENCY_TIMER_REQUEST,
1865b760dac2SMartin Geleynse 				FTDI_SIO_SET_LATENCY_TIMER_REQUEST_TYPE,
186666e47e60SJohan Hovold 				latency, 0, NULL, 0, WDR_TIMEOUT);
1867b760dac2SMartin Geleynse 	return 0;
1868b760dac2SMartin Geleynse }
1869b760dac2SMartin Geleynse 
1870b760dac2SMartin Geleynse /*
187120734345SHarald Welte  * First port on JTAG adaptors such as Olimex arm-usb-ocd or the FIC/OpenMoko
187220734345SHarald Welte  * Neo1973 Debug Board is reserved for JTAG interface and can be accessed from
187320734345SHarald Welte  * userspace using openocd.
1874fa91d43bSTony Lindgren  */
187520734345SHarald Welte static int ftdi_jtag_probe(struct usb_serial *serial)
1876fa91d43bSTony Lindgren {
1877fa91d43bSTony Lindgren 	struct usb_device *udev = serial->dev;
1878fa91d43bSTony Lindgren 	struct usb_interface *interface = serial->interface;
1879fa91d43bSTony Lindgren 
1880fa91d43bSTony Lindgren 	if (interface == udev->actconfig->interface[0]) {
1881c197a8dbSGreg Kroah-Hartman 		dev_info(&udev->dev,
1882c197a8dbSGreg Kroah-Hartman 			 "Ignoring serial port reserved for JTAG\n");
1883fa91d43bSTony Lindgren 		return -ENODEV;
1884fa91d43bSTony Lindgren 	}
1885fa91d43bSTony Lindgren 
1886fa91d43bSTony Lindgren 	return 0;
1887fa91d43bSTony Lindgren }
18881da177e4SLinus Torvalds 
1889c96fbdd0SJean-Christophe PLAGNIOL-VILLARD static int ftdi_8u2232c_probe(struct usb_serial *serial)
1890c96fbdd0SJean-Christophe PLAGNIOL-VILLARD {
1891c96fbdd0SJean-Christophe PLAGNIOL-VILLARD 	struct usb_device *udev = serial->dev;
1892c96fbdd0SJean-Christophe PLAGNIOL-VILLARD 
1893b229a0f8SDoug Goldstein 	if (udev->manufacturer && !strcmp(udev->manufacturer, "CALAO Systems"))
1894b229a0f8SDoug Goldstein 		return ftdi_jtag_probe(serial);
1895b229a0f8SDoug Goldstein 
1896b229a0f8SDoug Goldstein 	if (udev->product &&
1897b229a0f8SDoug Goldstein 		(!strcmp(udev->product, "BeagleBone/XDS100V2") ||
1898b229a0f8SDoug Goldstein 		 !strcmp(udev->product, "SNAP Connect E10")))
1899c96fbdd0SJean-Christophe PLAGNIOL-VILLARD 		return ftdi_jtag_probe(serial);
1900c96fbdd0SJean-Christophe PLAGNIOL-VILLARD 
1901c96fbdd0SJean-Christophe PLAGNIOL-VILLARD 	return 0;
1902c96fbdd0SJean-Christophe PLAGNIOL-VILLARD }
1903c96fbdd0SJean-Christophe PLAGNIOL-VILLARD 
1904546d7eecSKevin Vance /*
190571d9a2b9SAdrian Thomasset  * First two ports on JTAG adaptors using an FT4232 such as STMicroelectronics's
190671d9a2b9SAdrian Thomasset  * ST Micro Connect Lite are reserved for JTAG or other non-UART interfaces and
190771d9a2b9SAdrian Thomasset  * can be accessed from userspace.
190871d9a2b9SAdrian Thomasset  * The next two ports are enabled as UARTs by default, where port 2 is
190971d9a2b9SAdrian Thomasset  * a conventional RS-232 UART.
19106ec2f46cSJean-Christophe PLAGNIOL-VILLARD  */
19116ec2f46cSJean-Christophe PLAGNIOL-VILLARD static int ftdi_stmclite_probe(struct usb_serial *serial)
19126ec2f46cSJean-Christophe PLAGNIOL-VILLARD {
19136ec2f46cSJean-Christophe PLAGNIOL-VILLARD 	struct usb_device *udev = serial->dev;
19146ec2f46cSJean-Christophe PLAGNIOL-VILLARD 	struct usb_interface *interface = serial->interface;
19156ec2f46cSJean-Christophe PLAGNIOL-VILLARD 
191671d9a2b9SAdrian Thomasset 	if (interface == udev->actconfig->interface[0] ||
191771d9a2b9SAdrian Thomasset 	    interface == udev->actconfig->interface[1]) {
19186ec2f46cSJean-Christophe PLAGNIOL-VILLARD 		dev_info(&udev->dev, "Ignoring serial port reserved for JTAG\n");
19196ec2f46cSJean-Christophe PLAGNIOL-VILLARD 		return -ENODEV;
19206ec2f46cSJean-Christophe PLAGNIOL-VILLARD 	}
19216ec2f46cSJean-Christophe PLAGNIOL-VILLARD 
192271d9a2b9SAdrian Thomasset 	return 0;
192371d9a2b9SAdrian Thomasset }
192471d9a2b9SAdrian Thomasset 
192512bdbe03SJim Radford static int ftdi_sio_port_remove(struct usb_serial_port *port)
192612bdbe03SJim Radford {
19271da177e4SLinus Torvalds 	struct ftdi_private *priv = usb_get_serial_port_data(port);
19281da177e4SLinus Torvalds 
192912bdbe03SJim Radford 	remove_sysfs_attrs(port);
19301da177e4SLinus Torvalds 
19314cba98ffSJohan Hovold 	kfree(priv);
19321da177e4SLinus Torvalds 
193312bdbe03SJim Radford 	return 0;
193412bdbe03SJim Radford }
19351da177e4SLinus Torvalds 
1936a509a7e4SAlan Cox static int ftdi_open(struct tty_struct *tty, struct usb_serial_port *port)
1937e49bbce1SJohan Hovold {
19381da177e4SLinus Torvalds 	struct usb_device *dev = port->serial->dev;
19391da177e4SLinus Torvalds 	struct ftdi_private *priv = usb_get_serial_port_data(port);
19401da177e4SLinus Torvalds 
19411da177e4SLinus Torvalds 	/* No error checking for this (will get errors later anyway) */
19421da177e4SLinus Torvalds 	/* See ftdi_sio.h for description of what is reset */
19431da177e4SLinus Torvalds 	usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
19441da177e4SLinus Torvalds 			FTDI_SIO_RESET_REQUEST, FTDI_SIO_RESET_REQUEST_TYPE,
19451da177e4SLinus Torvalds 			FTDI_SIO_RESET_SIO,
194666e47e60SJohan Hovold 			priv->interface, NULL, 0, WDR_TIMEOUT);
19471da177e4SLinus Torvalds 
19481da177e4SLinus Torvalds 	/* Termios defaults are set by usb_serial_init. We don't change
1949c4f01240SNick Andrew 	   port->tty->termios - this would lose speed settings, etc.
19501da177e4SLinus Torvalds 	   This is same behaviour as serial.c/rs_open() - Kuba */
19511da177e4SLinus Torvalds 
19521da177e4SLinus Torvalds 	/* ftdi_set_termios  will send usb control messages */
1953be0278ccSJohan Hovold 	if (tty)
1954be0278ccSJohan Hovold 		ftdi_set_termios(tty, port, NULL);
19551da177e4SLinus Torvalds 
19564cba98ffSJohan Hovold 	return usb_serial_generic_open(tty, port);
1957e49bbce1SJohan Hovold }
19581da177e4SLinus Torvalds 
1959335f8514SAlan Cox static void ftdi_dtr_rts(struct usb_serial_port *port, int on)
1960335f8514SAlan Cox {
1961335f8514SAlan Cox 	struct ftdi_private *priv = usb_get_serial_port_data(port);
1962335f8514SAlan Cox 
1963335f8514SAlan Cox 	/* Disable flow control */
1964b2ca6990SJohan Hovold 	if (!on) {
1965b2ca6990SJohan Hovold 		if (usb_control_msg(port->serial->dev,
1966335f8514SAlan Cox 			    usb_sndctrlpipe(port->serial->dev, 0),
1967335f8514SAlan Cox 			    FTDI_SIO_SET_FLOW_CTRL_REQUEST,
1968335f8514SAlan Cox 			    FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,
196966e47e60SJohan Hovold 			    0, priv->interface, NULL, 0,
1970335f8514SAlan Cox 			    WDR_TIMEOUT) < 0) {
1971335f8514SAlan Cox 			dev_err(&port->dev, "error from flowcontrol urb\n");
1972335f8514SAlan Cox 		}
1973b2ca6990SJohan Hovold 	}
1974335f8514SAlan Cox 	/* drop RTS and DTR */
1975335f8514SAlan Cox 	if (on)
1976335f8514SAlan Cox 		set_mctrl(port, TIOCM_DTR | TIOCM_RTS);
1977335f8514SAlan Cox 	else
1978335f8514SAlan Cox 		clear_mctrl(port, TIOCM_DTR | TIOCM_RTS);
1979335f8514SAlan Cox }
19801da177e4SLinus Torvalds 
19811da177e4SLinus Torvalds /* The SIO requires the first byte to have:
19821da177e4SLinus Torvalds  *  B0 1
19831da177e4SLinus Torvalds  *  B1 0
19841da177e4SLinus Torvalds  *  B2..7 length of message excluding byte 0
19851da177e4SLinus Torvalds  *
19861da177e4SLinus Torvalds  * The new devices do not require this byte
19871da177e4SLinus Torvalds  */
1988d3901a06SJohan Hovold static int ftdi_prepare_write_buffer(struct usb_serial_port *port,
1989c23e5fc1SJohan Hovold 						void *dest, size_t size)
1990e49bbce1SJohan Hovold {
1991d3901a06SJohan Hovold 	struct ftdi_private *priv;
1992c23e5fc1SJohan Hovold 	int count;
1993c23e5fc1SJohan Hovold 	unsigned long flags;
19941da177e4SLinus Torvalds 
1995d3901a06SJohan Hovold 	priv = usb_get_serial_port_data(port);
19961da177e4SLinus Torvalds 
1997e8770484SJohan Hovold 	if (priv->chip_type == SIO) {
1998c23e5fc1SJohan Hovold 		unsigned char *buffer = dest;
1999c23e5fc1SJohan Hovold 		int i, len, c;
20001da177e4SLinus Torvalds 
2001c23e5fc1SJohan Hovold 		count = 0;
2002c23e5fc1SJohan Hovold 		spin_lock_irqsave(&port->lock, flags);
2003c23e5fc1SJohan Hovold 		for (i = 0; i < size - 1; i += priv->max_packet_size) {
2004c23e5fc1SJohan Hovold 			len = min_t(int, size - i, priv->max_packet_size) - 1;
2005c23e5fc1SJohan Hovold 			c = kfifo_out(&port->write_fifo, &buffer[i + 1], len);
2006c23e5fc1SJohan Hovold 			if (!c)
2007c23e5fc1SJohan Hovold 				break;
2008cb1676a6SJohan Hovold 			port->icount.tx += c;
2009c1aa075aSJohan Hovold 			buffer[i] = (c << 2) + 1;
2010c23e5fc1SJohan Hovold 			count += c + 1;
20111da177e4SLinus Torvalds 		}
2012c23e5fc1SJohan Hovold 		spin_unlock_irqrestore(&port->lock, flags);
20131da177e4SLinus Torvalds 	} else {
2014c23e5fc1SJohan Hovold 		count = kfifo_out_locked(&port->write_fifo, dest, size,
2015c23e5fc1SJohan Hovold 								&port->lock);
2016cb1676a6SJohan Hovold 		port->icount.tx += count;
20171da177e4SLinus Torvalds 	}
20181da177e4SLinus Torvalds 
20191da177e4SLinus Torvalds 	return count;
202095da310eSAlan Cox }
20211da177e4SLinus Torvalds 
2022166ceb69SJohan Hovold #define FTDI_RS_ERR_MASK (FTDI_RS_BI | FTDI_RS_PE | FTDI_RS_FE | FTDI_RS_OE)
2023166ceb69SJohan Hovold 
202492a19f9cSJiri Slaby static int ftdi_process_packet(struct usb_serial_port *port,
202592a19f9cSJiri Slaby 		struct ftdi_private *priv, char *packet, int len)
202695da310eSAlan Cox {
20271da177e4SLinus Torvalds 	int i;
2028cc01f17dSJohan Hovold 	char status;
2029cc01f17dSJohan Hovold 	char flag;
2030cc01f17dSJohan Hovold 	char *ch;
20311da177e4SLinus Torvalds 
2032cc01f17dSJohan Hovold 	if (len < 2) {
2033bfc51614SGreg Kroah-Hartman 		dev_dbg(&port->dev, "malformed packet\n");
2034cc01f17dSJohan Hovold 		return 0;
20351da177e4SLinus Torvalds 	}
20361da177e4SLinus Torvalds 
2037464cbb24SAlan Cox 	/* Compare new line status to the old one, signal if different/
2038464cbb24SAlan Cox 	   N.B. packet may be processed more than once, but differences
2039464cbb24SAlan Cox 	   are only processed once.  */
2040cc01f17dSJohan Hovold 	status = packet[0] & FTDI_STATUS_B0_MASK;
2041cc01f17dSJohan Hovold 	if (status != priv->prev_status) {
2042fca5430dSSimon Arlott 		char diff_status = status ^ priv->prev_status;
2043fca5430dSSimon Arlott 
2044fca5430dSSimon Arlott 		if (diff_status & FTDI_RS0_CTS)
2045cb1676a6SJohan Hovold 			port->icount.cts++;
2046fca5430dSSimon Arlott 		if (diff_status & FTDI_RS0_DSR)
2047cb1676a6SJohan Hovold 			port->icount.dsr++;
2048fca5430dSSimon Arlott 		if (diff_status & FTDI_RS0_RI)
2049cb1676a6SJohan Hovold 			port->icount.rng++;
2050d14654dfSPaul Chavent 		if (diff_status & FTDI_RS0_RLSD) {
2051d14654dfSPaul Chavent 			struct tty_struct *tty;
2052d14654dfSPaul Chavent 
2053cb1676a6SJohan Hovold 			port->icount.dcd++;
2054d14654dfSPaul Chavent 			tty = tty_port_tty_get(&port->port);
2055d14654dfSPaul Chavent 			if (tty)
2056d14654dfSPaul Chavent 				usb_serial_handle_dcd_change(port, tty,
2057d14654dfSPaul Chavent 						status & FTDI_RS0_RLSD);
2058d14654dfSPaul Chavent 			tty_kref_put(tty);
2059d14654dfSPaul Chavent 		}
2060fca5430dSSimon Arlott 
2061f307e5cdSJohan Hovold 		wake_up_interruptible(&port->port.delta_msr_wait);
2062cc01f17dSJohan Hovold 		priv->prev_status = status;
20631da177e4SLinus Torvalds 	}
20641da177e4SLinus Torvalds 
2065cc01f17dSJohan Hovold 	flag = TTY_NORMAL;
2066166ceb69SJohan Hovold 	if (packet[1] & FTDI_RS_ERR_MASK) {
2067166ceb69SJohan Hovold 		/* Break takes precedence over parity, which takes precedence
2068166ceb69SJohan Hovold 		 * over framing errors */
2069cc01f17dSJohan Hovold 		if (packet[1] & FTDI_RS_BI) {
2070cc01f17dSJohan Hovold 			flag = TTY_BREAK;
2071cb1676a6SJohan Hovold 			port->icount.brk++;
207272fda3caSJason Wessel 			usb_serial_handle_break(port);
2073166ceb69SJohan Hovold 		} else if (packet[1] & FTDI_RS_PE) {
2074cc01f17dSJohan Hovold 			flag = TTY_PARITY;
2075cb1676a6SJohan Hovold 			port->icount.parity++;
2076166ceb69SJohan Hovold 		} else if (packet[1] & FTDI_RS_FE) {
2077cc01f17dSJohan Hovold 			flag = TTY_FRAME;
2078cb1676a6SJohan Hovold 			port->icount.frame++;
2079166ceb69SJohan Hovold 		}
2080166ceb69SJohan Hovold 		/* Overrun is special, not associated with a char */
2081005b3cdeSUwe Bonnes 		if (packet[1] & FTDI_RS_OE) {
2082cb1676a6SJohan Hovold 			port->icount.overrun++;
208392a19f9cSJiri Slaby 			tty_insert_flip_char(&port->port, 0, TTY_OVERRUN);
20841da177e4SLinus Torvalds 		}
2085005b3cdeSUwe Bonnes 	}
20861da177e4SLinus Torvalds 
2087c466cd2bSGreg Kroah-Hartman 	/* save if the transmitter is empty or not */
2088c466cd2bSGreg Kroah-Hartman 	if (packet[1] & FTDI_RS_TEMT)
2089c466cd2bSGreg Kroah-Hartman 		priv->transmit_empty = 1;
2090c466cd2bSGreg Kroah-Hartman 	else
2091c466cd2bSGreg Kroah-Hartman 		priv->transmit_empty = 0;
2092c466cd2bSGreg Kroah-Hartman 
2093cc01f17dSJohan Hovold 	len -= 2;
2094cc01f17dSJohan Hovold 	if (!len)
2095cc01f17dSJohan Hovold 		return 0;	/* status only */
2096cb1676a6SJohan Hovold 	port->icount.rx += len;
2097cc01f17dSJohan Hovold 	ch = packet + 2;
2098cc01f17dSJohan Hovold 
209949b2597aSJohan Hovold 	if (port->port.console && port->sysrq) {
2100cc01f17dSJohan Hovold 		for (i = 0; i < len; i++, ch++) {
21016ee9f4b4SDmitry Torokhov 			if (!usb_serial_handle_sysrq_char(port, *ch))
210292a19f9cSJiri Slaby 				tty_insert_flip_char(&port->port, *ch, flag);
2103cc01f17dSJohan Hovold 		}
210449b2597aSJohan Hovold 	} else {
21052f693357SJiri Slaby 		tty_insert_flip_string_fixed_flag(&port->port, ch, flag, len);
2106cc01f17dSJohan Hovold 	}
210749b2597aSJohan Hovold 
2108cc01f17dSJohan Hovold 	return len;
2109cc01f17dSJohan Hovold }
2110cc01f17dSJohan Hovold 
21111b551015SJohan Hovold static void ftdi_process_read_urb(struct urb *urb)
2112cc01f17dSJohan Hovold {
21131b551015SJohan Hovold 	struct usb_serial_port *port = urb->context;
2114cc01f17dSJohan Hovold 	struct ftdi_private *priv = usb_get_serial_port_data(port);
2115cc01f17dSJohan Hovold 	char *data = (char *)urb->transfer_buffer;
2116cc01f17dSJohan Hovold 	int i;
2117cc01f17dSJohan Hovold 	int len;
2118cc01f17dSJohan Hovold 	int count = 0;
2119cc01f17dSJohan Hovold 
2120cc01f17dSJohan Hovold 	for (i = 0; i < urb->actual_length; i += priv->max_packet_size) {
2121cc01f17dSJohan Hovold 		len = min_t(int, urb->actual_length - i, priv->max_packet_size);
212292a19f9cSJiri Slaby 		count += ftdi_process_packet(port, priv, &data[i], len);
2123cc01f17dSJohan Hovold 	}
2124cc01f17dSJohan Hovold 
2125cc01f17dSJohan Hovold 	if (count)
21262e124b4aSJiri Slaby 		tty_flip_buffer_push(&port->port);
2127cc01f17dSJohan Hovold }
21281da177e4SLinus Torvalds 
212995da310eSAlan Cox static void ftdi_break_ctl(struct tty_struct *tty, int break_state)
21301da177e4SLinus Torvalds {
213195da310eSAlan Cox 	struct usb_serial_port *port = tty->driver_data;
21321da177e4SLinus Torvalds 	struct ftdi_private *priv = usb_get_serial_port_data(port);
2133c1284d77SJohan Hovold 	__u16 urb_value;
21341da177e4SLinus Torvalds 
21351da177e4SLinus Torvalds 	/* break_state = -1 to turn on break, and 0 to turn off break */
21361da177e4SLinus Torvalds 	/* see drivers/char/tty_io.c to see it used */
21371da177e4SLinus Torvalds 	/* last_set_data_urb_value NEVER has the break bit set in it */
21381da177e4SLinus Torvalds 
2139464cbb24SAlan Cox 	if (break_state)
21401da177e4SLinus Torvalds 		urb_value = priv->last_set_data_urb_value | FTDI_SIO_SET_BREAK;
2141464cbb24SAlan Cox 	else
21421da177e4SLinus Torvalds 		urb_value = priv->last_set_data_urb_value;
21431da177e4SLinus Torvalds 
2144464cbb24SAlan Cox 	if (usb_control_msg(port->serial->dev,
2145464cbb24SAlan Cox 			usb_sndctrlpipe(port->serial->dev, 0),
21461da177e4SLinus Torvalds 			FTDI_SIO_SET_DATA_REQUEST,
21471da177e4SLinus Torvalds 			FTDI_SIO_SET_DATA_REQUEST_TYPE,
21481da177e4SLinus Torvalds 			urb_value , priv->interface,
214966e47e60SJohan Hovold 			NULL, 0, WDR_TIMEOUT) < 0) {
2150bfc51614SGreg Kroah-Hartman 		dev_err(&port->dev, "%s FAILED to enable/disable break state (state was %d)\n",
2151bfc51614SGreg Kroah-Hartman 			__func__, break_state);
21521da177e4SLinus Torvalds 	}
21531da177e4SLinus Torvalds 
2154bfc51614SGreg Kroah-Hartman 	dev_dbg(&port->dev, "%s break state is %d - urb is %d\n", __func__,
2155464cbb24SAlan Cox 		break_state, urb_value);
21561da177e4SLinus Torvalds 
21571da177e4SLinus Torvalds }
21581da177e4SLinus Torvalds 
2159a37025b5SJohan Hovold static bool ftdi_tx_empty(struct usb_serial_port *port)
21606f602912SJarkko Huijts {
21615fb0432eSJohan Hovold 	unsigned char buf[2];
21626f602912SJarkko Huijts 	int ret;
21636f602912SJarkko Huijts 
2164c4133648SJohan Hovold 	ret = ftdi_get_modem_status(port, buf);
21655fb0432eSJohan Hovold 	if (ret == 2) {
21666f602912SJarkko Huijts 		if (!(buf[1] & FTDI_RS_TEMT))
2167a37025b5SJohan Hovold 			return false;
21685fb0432eSJohan Hovold 	}
21696f602912SJarkko Huijts 
2170a37025b5SJohan Hovold 	return true;
21716f602912SJarkko Huijts }
21726f602912SJarkko Huijts 
21731da177e4SLinus Torvalds /* old_termios contains the original termios settings and tty->termios contains
21741da177e4SLinus Torvalds  * the new setting to be used
21751da177e4SLinus Torvalds  * WARNING: set_termios calls this with old_termios in kernel space
21761da177e4SLinus Torvalds  */
217795da310eSAlan Cox static void ftdi_set_termios(struct tty_struct *tty,
217895da310eSAlan Cox 		struct usb_serial_port *port, struct ktermios *old_termios)
2179e49bbce1SJohan Hovold {
21801da177e4SLinus Torvalds 	struct usb_device *dev = port->serial->dev;
2181bfc51614SGreg Kroah-Hartman 	struct device *ddev = &port->dev;
21821da177e4SLinus Torvalds 	struct ftdi_private *priv = usb_get_serial_port_data(port);
2183adc8d746SAlan Cox 	struct ktermios *termios = &tty->termios;
2184669a6db1SAlan Cox 	unsigned int cflag = termios->c_cflag;
21851da177e4SLinus Torvalds 	__u16 urb_value; /* will hold the new flags */
21861da177e4SLinus Torvalds 
2187464cbb24SAlan Cox 	/* Added for xon/xoff support */
2188669a6db1SAlan Cox 	unsigned int iflag = termios->c_iflag;
21891da177e4SLinus Torvalds 	unsigned char vstop;
21901da177e4SLinus Torvalds 	unsigned char vstart;
21911da177e4SLinus Torvalds 
2192464cbb24SAlan Cox 	/* Force baud rate if this device requires it, unless it is set to
2193464cbb24SAlan Cox 	   B0. */
2194669a6db1SAlan Cox 	if (priv->force_baud && ((termios->c_cflag & CBAUD) != B0)) {
2195bfc51614SGreg Kroah-Hartman 		dev_dbg(ddev, "%s: forcing baud rate for this device\n", __func__);
219695da310eSAlan Cox 		tty_encode_baud_rate(tty, priv->force_baud,
2197bd5e47ccSAndrew Morton 					priv->force_baud);
21981da177e4SLinus Torvalds 	}
21991da177e4SLinus Torvalds 
22001da177e4SLinus Torvalds 	/* Force RTS-CTS if this device requires it. */
22011da177e4SLinus Torvalds 	if (priv->force_rtscts) {
2202bfc51614SGreg Kroah-Hartman 		dev_dbg(ddev, "%s: forcing rtscts for this device\n", __func__);
2203669a6db1SAlan Cox 		termios->c_cflag |= CRTSCTS;
22041da177e4SLinus Torvalds 	}
22051da177e4SLinus Torvalds 
22068704211fSColin Leitner 	/*
2207c1f15196SColin Leitner 	 * All FTDI UART chips are limited to CS7/8. We shouldn't pretend to
22088704211fSColin Leitner 	 * support CS5/6 and revert the CSIZE setting instead.
2209c1f15196SColin Leitner 	 *
2210c1f15196SColin Leitner 	 * CS5 however is used to control some smartcard readers which abuse
2211c1f15196SColin Leitner 	 * this limitation to switch modes. Original FTDI chips fall back to
2212c1f15196SColin Leitner 	 * eight data bits.
2213c1f15196SColin Leitner 	 *
2214c1f15196SColin Leitner 	 * TODO: Implement a quirk to only allow this with mentioned
2215c1f15196SColin Leitner 	 *       readers. One I know of (Argolis Smartreader V1)
2216c1f15196SColin Leitner 	 *       returns "USB smartcard server" as iInterface string.
2217c1f15196SColin Leitner 	 *       The vendor didn't bother with a custom VID/PID of
2218c1f15196SColin Leitner 	 *       course.
22198704211fSColin Leitner 	 */
2220c1f15196SColin Leitner 	if (C_CSIZE(tty) == CS6) {
22218704211fSColin Leitner 		dev_warn(ddev, "requested CSIZE setting not supported\n");
22228704211fSColin Leitner 
22238704211fSColin Leitner 		termios->c_cflag &= ~CSIZE;
22248704211fSColin Leitner 		if (old_termios)
22258704211fSColin Leitner 			termios->c_cflag |= old_termios->c_cflag & CSIZE;
22268704211fSColin Leitner 		else
22278704211fSColin Leitner 			termios->c_cflag |= CS8;
22288704211fSColin Leitner 	}
22298704211fSColin Leitner 
2230669a6db1SAlan Cox 	cflag = termios->c_cflag;
22311da177e4SLinus Torvalds 
2232a816e311SYing Xue 	if (!old_termios)
2233c515598eSAndrew Worsley 		goto no_skip;
2234c515598eSAndrew Worsley 
2235b1ffb4c8SAndrew Worsley 	if (old_termios->c_cflag == termios->c_cflag
2236b1ffb4c8SAndrew Worsley 	    && old_termios->c_ispeed == termios->c_ispeed
2237b1ffb4c8SAndrew Worsley 	    && old_termios->c_ospeed == termios->c_ospeed)
2238b1ffb4c8SAndrew Worsley 		goto no_c_cflag_changes;
2239b1ffb4c8SAndrew Worsley 
22401da177e4SLinus Torvalds 	/* NOTE These routines can get interrupted by
2241464cbb24SAlan Cox 	   ftdi_sio_read_bulk_callback  - need to examine what this means -
2242464cbb24SAlan Cox 	   don't see any problems yet */
22431da177e4SLinus Torvalds 
2244b1ffb4c8SAndrew Worsley 	if ((old_termios->c_cflag & (CSIZE|PARODD|PARENB|CMSPAR|CSTOPB)) ==
2245b1ffb4c8SAndrew Worsley 	    (termios->c_cflag & (CSIZE|PARODD|PARENB|CMSPAR|CSTOPB)))
2246b1ffb4c8SAndrew Worsley 		goto no_data_parity_stop_changes;
2247b1ffb4c8SAndrew Worsley 
2248c515598eSAndrew Worsley no_skip:
22491da177e4SLinus Torvalds 	/* Set number of data bits, parity, stop bits */
22501da177e4SLinus Torvalds 
22511da177e4SLinus Torvalds 	urb_value = 0;
22521da177e4SLinus Torvalds 	urb_value |= (cflag & CSTOPB ? FTDI_SIO_SET_DATA_STOP_BITS_2 :
22531da177e4SLinus Torvalds 		      FTDI_SIO_SET_DATA_STOP_BITS_1);
225438fcb830SRoland Koebler 	if (cflag & PARENB) {
225538fcb830SRoland Koebler 		if (cflag & CMSPAR)
225638fcb830SRoland Koebler 			urb_value |= cflag & PARODD ?
225738fcb830SRoland Koebler 				     FTDI_SIO_SET_DATA_PARITY_MARK :
225838fcb830SRoland Koebler 				     FTDI_SIO_SET_DATA_PARITY_SPACE;
225938fcb830SRoland Koebler 		else
226038fcb830SRoland Koebler 			urb_value |= cflag & PARODD ?
226138fcb830SRoland Koebler 				     FTDI_SIO_SET_DATA_PARITY_ODD :
226238fcb830SRoland Koebler 				     FTDI_SIO_SET_DATA_PARITY_EVEN;
226338fcb830SRoland Koebler 	} else {
226438fcb830SRoland Koebler 		urb_value |= FTDI_SIO_SET_DATA_PARITY_NONE;
226538fcb830SRoland Koebler 	}
22661da177e4SLinus Torvalds 	switch (cflag & CSIZE) {
2267c1f15196SColin Leitner 	case CS5:
2268c1f15196SColin Leitner 		dev_dbg(ddev, "Setting CS5 quirk\n");
2269c1f15196SColin Leitner 		break;
2270bfc51614SGreg Kroah-Hartman 	case CS7:
2271bfc51614SGreg Kroah-Hartman 		urb_value |= 7;
2272bfc51614SGreg Kroah-Hartman 		dev_dbg(ddev, "Setting CS7\n");
2273bfc51614SGreg Kroah-Hartman 		break;
22748704211fSColin Leitner 	default:
2275bfc51614SGreg Kroah-Hartman 	case CS8:
2276bfc51614SGreg Kroah-Hartman 		urb_value |= 8;
2277bfc51614SGreg Kroah-Hartman 		dev_dbg(ddev, "Setting CS8\n");
2278bfc51614SGreg Kroah-Hartman 		break;
22791da177e4SLinus Torvalds 	}
22801da177e4SLinus Torvalds 
2281464cbb24SAlan Cox 	/* This is needed by the break command since it uses the same command
2282464cbb24SAlan Cox 	   - but is or'ed with this value  */
22831da177e4SLinus Torvalds 	priv->last_set_data_urb_value = urb_value;
22841da177e4SLinus Torvalds 
22851da177e4SLinus Torvalds 	if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
22861da177e4SLinus Torvalds 			    FTDI_SIO_SET_DATA_REQUEST,
22871da177e4SLinus Torvalds 			    FTDI_SIO_SET_DATA_REQUEST_TYPE,
22881da177e4SLinus Torvalds 			    urb_value , priv->interface,
228966e47e60SJohan Hovold 			    NULL, 0, WDR_SHORT_TIMEOUT) < 0) {
2290bfc51614SGreg Kroah-Hartman 		dev_err(ddev, "%s FAILED to set databits/stopbits/parity\n",
2291bfc51614SGreg Kroah-Hartman 			__func__);
22921da177e4SLinus Torvalds 	}
22931da177e4SLinus Torvalds 
22941da177e4SLinus Torvalds 	/* Now do the baudrate */
2295b1ffb4c8SAndrew Worsley no_data_parity_stop_changes:
22961da177e4SLinus Torvalds 	if ((cflag & CBAUD) == B0) {
22971da177e4SLinus Torvalds 		/* Disable flow control */
22981da177e4SLinus Torvalds 		if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
22991da177e4SLinus Torvalds 				    FTDI_SIO_SET_FLOW_CTRL_REQUEST,
23001da177e4SLinus Torvalds 				    FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,
23011da177e4SLinus Torvalds 				    0, priv->interface,
230266e47e60SJohan Hovold 				    NULL, 0, WDR_TIMEOUT) < 0) {
2303bfc51614SGreg Kroah-Hartman 			dev_err(ddev, "%s error from disable flowcontrol urb\n",
2304194343d9SGreg Kroah-Hartman 				__func__);
23051da177e4SLinus Torvalds 		}
23061da177e4SLinus Torvalds 		/* Drop RTS and DTR */
230774ede0ffSIan Abbott 		clear_mctrl(port, TIOCM_DTR | TIOCM_RTS);
23081da177e4SLinus Torvalds 	} else {
23091da177e4SLinus Torvalds 		/* set the baudrate determined before */
23109c67d28eSAlessio Igor Bogani 		mutex_lock(&priv->cfg_lock);
2311464cbb24SAlan Cox 		if (change_speed(tty, port))
2312bfc51614SGreg Kroah-Hartman 			dev_err(ddev, "%s urb failed to set baudrate\n", __func__);
23139c67d28eSAlessio Igor Bogani 		mutex_unlock(&priv->cfg_lock);
231472a755fcSPeter Favrholdt 		/* Ensure RTS and DTR are raised when baudrate changed from 0 */
23153177130fSJohan Hovold 		if (old_termios && (old_termios->c_cflag & CBAUD) == B0)
231674ede0ffSIan Abbott 			set_mctrl(port, TIOCM_DTR | TIOCM_RTS);
23171da177e4SLinus Torvalds 	}
23181da177e4SLinus Torvalds 
23191da177e4SLinus Torvalds 	/* Set flow control */
23201da177e4SLinus Torvalds 	/* Note device also supports DTR/CD (ugh) and Xon/Xoff in hardware */
2321b1ffb4c8SAndrew Worsley no_c_cflag_changes:
23221da177e4SLinus Torvalds 	if (cflag & CRTSCTS) {
2323bfc51614SGreg Kroah-Hartman 		dev_dbg(ddev, "%s Setting to CRTSCTS flow control\n", __func__);
23241da177e4SLinus Torvalds 		if (usb_control_msg(dev,
23251da177e4SLinus Torvalds 				    usb_sndctrlpipe(dev, 0),
23261da177e4SLinus Torvalds 				    FTDI_SIO_SET_FLOW_CTRL_REQUEST,
23271da177e4SLinus Torvalds 				    FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,
23281da177e4SLinus Torvalds 				    0 , (FTDI_SIO_RTS_CTS_HS | priv->interface),
232966e47e60SJohan Hovold 				    NULL, 0, WDR_TIMEOUT) < 0) {
2330bfc51614SGreg Kroah-Hartman 			dev_err(ddev, "urb failed to set to rts/cts flow control\n");
23311da177e4SLinus Torvalds 		}
23321da177e4SLinus Torvalds 	} else {
23331da177e4SLinus Torvalds 		/*
23341da177e4SLinus Torvalds 		 * Xon/Xoff code
23351da177e4SLinus Torvalds 		 *
2336464cbb24SAlan Cox 		 * Check the IXOFF status in the iflag component of the
2337464cbb24SAlan Cox 		 * termios structure. If IXOFF is not set, the pre-xon/xoff
2338464cbb24SAlan Cox 		 * code is executed.
23391da177e4SLinus Torvalds 		 */
23401da177e4SLinus Torvalds 		if (iflag & IXOFF) {
2341bfc51614SGreg Kroah-Hartman 			dev_dbg(ddev, "%s  request to enable xonxoff iflag=%04x\n",
2342464cbb24SAlan Cox 				__func__, iflag);
2343464cbb24SAlan Cox 			/* Try to enable the XON/XOFF on the ftdi_sio
2344464cbb24SAlan Cox 			 * Set the vstart and vstop -- could have been done up
2345464cbb24SAlan Cox 			 * above where a lot of other dereferencing is done but
2346464cbb24SAlan Cox 			 * that would be very inefficient as vstart and vstop
2347464cbb24SAlan Cox 			 * are not always needed.
2348464cbb24SAlan Cox 			 */
2349669a6db1SAlan Cox 			vstart = termios->c_cc[VSTART];
2350669a6db1SAlan Cox 			vstop = termios->c_cc[VSTOP];
23511da177e4SLinus Torvalds 			urb_value = (vstop << 8) | (vstart);
23521da177e4SLinus Torvalds 
23531da177e4SLinus Torvalds 			if (usb_control_msg(dev,
23541da177e4SLinus Torvalds 					    usb_sndctrlpipe(dev, 0),
23551da177e4SLinus Torvalds 					    FTDI_SIO_SET_FLOW_CTRL_REQUEST,
23561da177e4SLinus Torvalds 					    FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,
23571da177e4SLinus Torvalds 					    urb_value , (FTDI_SIO_XON_XOFF_HS
23581da177e4SLinus Torvalds 							 | priv->interface),
235966e47e60SJohan Hovold 					    NULL, 0, WDR_TIMEOUT) < 0) {
2360194343d9SGreg Kroah-Hartman 				dev_err(&port->dev, "urb failed to set to "
2361194343d9SGreg Kroah-Hartman 					"xon/xoff flow control\n");
23621da177e4SLinus Torvalds 			}
23631da177e4SLinus Torvalds 		} else {
2364464cbb24SAlan Cox 			/* else clause to only run if cflag ! CRTSCTS and iflag
2365464cbb24SAlan Cox 			 * ! XOFF. CHECKME Assuming XON/XOFF handled by tty
2366464cbb24SAlan Cox 			 * stack - not by device */
2367bfc51614SGreg Kroah-Hartman 			dev_dbg(ddev, "%s Turning off hardware flow control\n", __func__);
23681da177e4SLinus Torvalds 			if (usb_control_msg(dev,
23691da177e4SLinus Torvalds 					    usb_sndctrlpipe(dev, 0),
23701da177e4SLinus Torvalds 					    FTDI_SIO_SET_FLOW_CTRL_REQUEST,
23711da177e4SLinus Torvalds 					    FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,
23721da177e4SLinus Torvalds 					    0, priv->interface,
237366e47e60SJohan Hovold 					    NULL, 0, WDR_TIMEOUT) < 0) {
2374bfc51614SGreg Kroah-Hartman 				dev_err(ddev, "urb failed to clear flow control\n");
23751da177e4SLinus Torvalds 			}
23761da177e4SLinus Torvalds 		}
23771da177e4SLinus Torvalds 	}
237895da310eSAlan Cox }
23791da177e4SLinus Torvalds 
2380a4afff6bSJohan Hovold /*
2381a4afff6bSJohan Hovold  * Get modem-control status.
2382a4afff6bSJohan Hovold  *
2383a4afff6bSJohan Hovold  * Returns the number of status bytes retrieved (device dependant), or
2384a4afff6bSJohan Hovold  * negative error code.
2385a4afff6bSJohan Hovold  */
2386c4133648SJohan Hovold static int ftdi_get_modem_status(struct usb_serial_port *port,
2387a4afff6bSJohan Hovold 						unsigned char status[2])
23881da177e4SLinus Torvalds {
23891da177e4SLinus Torvalds 	struct ftdi_private *priv = usb_get_serial_port_data(port);
239066e47e60SJohan Hovold 	unsigned char *buf;
2391a3f8168bSJohan Hovold 	int len;
23921da177e4SLinus Torvalds 	int ret;
23931da177e4SLinus Torvalds 
239466e47e60SJohan Hovold 	buf = kmalloc(2, GFP_KERNEL);
239566e47e60SJohan Hovold 	if (!buf)
239666e47e60SJohan Hovold 		return -ENOMEM;
2397a3f8168bSJohan Hovold 	/*
2398a3f8168bSJohan Hovold 	 * The 8U232AM returns a two byte value (the SIO a 1 byte value) in
2399a3f8168bSJohan Hovold 	 * the same format as the data returned from the in point.
2400a3f8168bSJohan Hovold 	 */
24011da177e4SLinus Torvalds 	switch (priv->chip_type) {
24021da177e4SLinus Torvalds 	case SIO:
2403a3f8168bSJohan Hovold 		len = 1;
24041da177e4SLinus Torvalds 		break;
24051da177e4SLinus Torvalds 	case FT8U232AM:
24061da177e4SLinus Torvalds 	case FT232BM:
24071da177e4SLinus Torvalds 	case FT2232C:
2408ed6e5282SAndrew M. Bishop 	case FT232RL:
2409094c2e6dSMark Adamson 	case FT2232H:
2410094c2e6dSMark Adamson 	case FT4232H:
2411309427b6SUwe Bonnes 	case FT232H:
2412dc0827c1SJim Paris 	case FTX:
2413a3f8168bSJohan Hovold 		len = 2;
24141da177e4SLinus Torvalds 		break;
24151da177e4SLinus Torvalds 	default:
241666e47e60SJohan Hovold 		ret = -EFAULT;
241766e47e60SJohan Hovold 		goto out;
24181da177e4SLinus Torvalds 	}
24191da177e4SLinus Torvalds 
2420a3f8168bSJohan Hovold 	ret = usb_control_msg(port->serial->dev,
2421a3f8168bSJohan Hovold 			usb_rcvctrlpipe(port->serial->dev, 0),
2422a3f8168bSJohan Hovold 			FTDI_SIO_GET_MODEM_STATUS_REQUEST,
2423a3f8168bSJohan Hovold 			FTDI_SIO_GET_MODEM_STATUS_REQUEST_TYPE,
2424a3f8168bSJohan Hovold 			0, priv->interface,
2425a3f8168bSJohan Hovold 			buf, len, WDR_TIMEOUT);
24262c2ee545SJohan Hovold 	if (ret < 0) {
2427a4afff6bSJohan Hovold 		dev_err(&port->dev, "failed to get modem status: %d\n", ret);
24282c2ee545SJohan Hovold 		ret = usb_translate_errors(ret);
2429a3f8168bSJohan Hovold 		goto out;
24302c2ee545SJohan Hovold 	}
2431a3f8168bSJohan Hovold 
2432a4afff6bSJohan Hovold 	status[0] = buf[0];
2433a4afff6bSJohan Hovold 	if (ret > 1)
2434a4afff6bSJohan Hovold 		status[1] = buf[1];
2435a4afff6bSJohan Hovold 	else
2436a4afff6bSJohan Hovold 		status[1] = 0;
2437a4afff6bSJohan Hovold 
2438a4afff6bSJohan Hovold 	dev_dbg(&port->dev, "%s - 0x%02x%02x\n", __func__, status[0],
2439a4afff6bSJohan Hovold 								status[1]);
2440a4afff6bSJohan Hovold out:
2441a4afff6bSJohan Hovold 	kfree(buf);
2442a4afff6bSJohan Hovold 
2443a4afff6bSJohan Hovold 	return ret;
2444a4afff6bSJohan Hovold }
2445a4afff6bSJohan Hovold 
2446a4afff6bSJohan Hovold static int ftdi_tiocmget(struct tty_struct *tty)
2447a4afff6bSJohan Hovold {
2448a4afff6bSJohan Hovold 	struct usb_serial_port *port = tty->driver_data;
2449a4afff6bSJohan Hovold 	struct ftdi_private *priv = usb_get_serial_port_data(port);
2450a4afff6bSJohan Hovold 	unsigned char buf[2];
2451a4afff6bSJohan Hovold 	int ret;
2452a4afff6bSJohan Hovold 
2453c4133648SJohan Hovold 	ret = ftdi_get_modem_status(port, buf);
2454a4afff6bSJohan Hovold 	if (ret < 0)
2455a4afff6bSJohan Hovold 		return ret;
2456a4afff6bSJohan Hovold 
245766e47e60SJohan Hovold 	ret =	(buf[0] & FTDI_SIO_DSR_MASK  ? TIOCM_DSR : 0) |
24581da177e4SLinus Torvalds 		(buf[0] & FTDI_SIO_CTS_MASK  ? TIOCM_CTS : 0) |
24591da177e4SLinus Torvalds 		(buf[0] & FTDI_SIO_RI_MASK   ? TIOCM_RI  : 0) |
24601da177e4SLinus Torvalds 		(buf[0] & FTDI_SIO_RLSD_MASK ? TIOCM_CD  : 0) |
24611da177e4SLinus Torvalds 		priv->last_dtr_rts;
2462a4afff6bSJohan Hovold 
246366e47e60SJohan Hovold 	return ret;
24641da177e4SLinus Torvalds }
24651da177e4SLinus Torvalds 
246620b9d177SAlan Cox static int ftdi_tiocmset(struct tty_struct *tty,
246795da310eSAlan Cox 			unsigned int set, unsigned int clear)
24681da177e4SLinus Torvalds {
246995da310eSAlan Cox 	struct usb_serial_port *port = tty->driver_data;
2470a09aa7ddSGreg Kroah-Hartman 
247174ede0ffSIan Abbott 	return update_mctrl(port, set, clear);
24721da177e4SLinus Torvalds }
24731da177e4SLinus Torvalds 
247400a0d0d6SAlan Cox static int ftdi_ioctl(struct tty_struct *tty,
2475464cbb24SAlan Cox 					unsigned int cmd, unsigned long arg)
24761da177e4SLinus Torvalds {
247795da310eSAlan Cox 	struct usb_serial_port *port = tty->driver_data;
24781da177e4SLinus Torvalds 
24791da177e4SLinus Torvalds 	/* Based on code from acm.c and others */
24801da177e4SLinus Torvalds 	switch (cmd) {
24811da177e4SLinus Torvalds 
24821da177e4SLinus Torvalds 	case TIOCGSERIAL: /* gets serial port data */
2483464cbb24SAlan Cox 		return get_serial_info(port,
2484464cbb24SAlan Cox 					(struct serial_struct __user *) arg);
24851da177e4SLinus Torvalds 
24861da177e4SLinus Torvalds 	case TIOCSSERIAL: /* sets serial port data */
2487464cbb24SAlan Cox 		return set_serial_info(tty, port,
2488464cbb24SAlan Cox 					(struct serial_struct __user *) arg);
2489c466cd2bSGreg Kroah-Hartman 	case TIOCSERGETLSR:
2490c466cd2bSGreg Kroah-Hartman 		return get_lsr_info(port, (struct serial_struct __user *)arg);
2491c466cd2bSGreg Kroah-Hartman 		break;
24921da177e4SLinus Torvalds 	default:
24931da177e4SLinus Torvalds 		break;
24941da177e4SLinus Torvalds 	}
24954d5147ecSJohan Hovold 
249695da310eSAlan Cox 	return -ENOIOCTLCMD;
249795da310eSAlan Cox }
24981da177e4SLinus Torvalds 
2499e17c1aa2SJohan Hovold module_usb_serial_driver(serial_drivers, id_table_combined);
25001da177e4SLinus Torvalds 
25011da177e4SLinus Torvalds MODULE_AUTHOR(DRIVER_AUTHOR);
25021da177e4SLinus Torvalds MODULE_DESCRIPTION(DRIVER_DESC);
25031da177e4SLinus Torvalds MODULE_LICENSE("GPL");
25041da177e4SLinus Torvalds 
2505b760dac2SMartin Geleynse module_param(ndi_latency_timer, int, S_IRUGO | S_IWUSR);
2506b760dac2SMartin Geleynse MODULE_PARM_DESC(ndi_latency_timer, "NDI device latency timer override");
2507