11da177e4SLinus Torvalds /* 21da177e4SLinus Torvalds * USB FTDI SIO driver 31da177e4SLinus Torvalds * 4d3901a06SJohan Hovold * Copyright (C) 2009 - 2010 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/init.h> 371da177e4SLinus Torvalds #include <linux/slab.h> 381da177e4SLinus Torvalds #include <linux/tty.h> 391da177e4SLinus Torvalds #include <linux/tty_driver.h> 401da177e4SLinus Torvalds #include <linux/tty_flip.h> 411da177e4SLinus Torvalds #include <linux/module.h> 421da177e4SLinus Torvalds #include <linux/spinlock.h> 43bd09a9f5SAlessio Igor Bogani #include <linux/mutex.h> 44464cbb24SAlan Cox #include <linux/uaccess.h> 451da177e4SLinus Torvalds #include <linux/usb.h> 461da177e4SLinus Torvalds #include <linux/serial.h> 47a969888cSGreg Kroah-Hartman #include <linux/usb/serial.h> 481da177e4SLinus Torvalds #include "ftdi_sio.h" 4931844d55SAndreas Mohr #include "ftdi_sio_ids.h" 501da177e4SLinus Torvalds 511da177e4SLinus Torvalds /* 521da177e4SLinus Torvalds * Version Information 531da177e4SLinus Torvalds */ 54d3901a06SJohan Hovold #define DRIVER_VERSION "v1.6.0" 55d3901a06SJohan 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>" 561da177e4SLinus Torvalds #define DRIVER_DESC "USB FTDI Serial Converters Driver" 571da177e4SLinus Torvalds 581da177e4SLinus Torvalds static int debug; 59fdcb0a0fSIan Abbott static __u16 vendor = FTDI_VID; 60fdcb0a0fSIan Abbott static __u16 product; 611da177e4SLinus Torvalds 620ffbbe25SOliver Neukum struct ftdi_private { 63c45d6320SAlan Stern struct kref kref; 643bb36aa2SGreg Kroah-Hartman enum ftdi_chip_type chip_type; 65464cbb24SAlan Cox /* type of device, either SIO or FT8U232AM */ 660ffbbe25SOliver Neukum int baud_base; /* baud base clock for divisor setting */ 67464cbb24SAlan Cox int custom_divisor; /* custom_divisor kludge, this is for 68464cbb24SAlan Cox baud_base (different from what goes to the 69464cbb24SAlan Cox chip!) */ 700ffbbe25SOliver Neukum __u16 last_set_data_urb_value ; 71464cbb24SAlan Cox /* the last data state set - needed for doing 72464cbb24SAlan Cox * a break 73464cbb24SAlan Cox */ 740ffbbe25SOliver Neukum int flags; /* some ASYNC_xxxx flags are supported */ 750ffbbe25SOliver Neukum unsigned long last_dtr_rts; /* saved modem control outputs */ 76c75ccd48SUwe Bonnes struct async_icount icount; 770ffbbe25SOliver Neukum wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */ 780ffbbe25SOliver Neukum char prev_status, diff_status; /* Used for TIOCMIWAIT */ 79c466cd2bSGreg Kroah-Hartman char transmit_empty; /* If transmitter is empty or not */ 800ffbbe25SOliver Neukum struct usb_serial_port *port; 81094c2e6dSMark Adamson __u16 interface; /* FT2232C, FT2232H or FT4232H port interface 82094c2e6dSMark Adamson (0 for FT232/245) */ 830ffbbe25SOliver Neukum 84464cbb24SAlan Cox speed_t force_baud; /* if non-zero, force the baud rate to 85464cbb24SAlan Cox this value */ 86464cbb24SAlan Cox int force_rtscts; /* if non-zero, force RTS-CTS to always 87464cbb24SAlan Cox be enabled */ 880ffbbe25SOliver Neukum 89557aaa7fSAlan Cox unsigned int latency; /* latency setting in use */ 90895f28baSMark Adamson unsigned short max_packet_size; 919c67d28eSAlessio Igor Bogani struct mutex cfg_lock; /* Avoid mess by parallel calls of config ioctl() and change_speed() */ 920ffbbe25SOliver Neukum }; 930ffbbe25SOliver Neukum 948f977e42SIan Abbott /* struct ftdi_sio_quirk is used by devices requiring special attention. */ 958f977e42SIan Abbott struct ftdi_sio_quirk { 96fa91d43bSTony Lindgren int (*probe)(struct usb_serial *); 97464cbb24SAlan Cox /* Special settings for probed ports. */ 98464cbb24SAlan Cox void (*port_probe)(struct ftdi_private *); 998f977e42SIan Abbott }; 1008f977e42SIan Abbott 10120734345SHarald Welte static int ftdi_jtag_probe(struct usb_serial *serial); 102546d7eecSKevin Vance static int ftdi_mtxorb_hack_setup(struct usb_serial *serial); 103b760dac2SMartin Geleynse static int ftdi_NDI_device_setup(struct usb_serial *serial); 1046ec2f46cSJean-Christophe PLAGNIOL-VILLARD static int ftdi_stmclite_probe(struct usb_serial *serial); 105c96fbdd0SJean-Christophe PLAGNIOL-VILLARD static int ftdi_8u2232c_probe(struct usb_serial *serial); 1060ffbbe25SOliver Neukum static void ftdi_USB_UIRT_setup(struct ftdi_private *priv); 1070ffbbe25SOliver Neukum static void ftdi_HE_TIRA1_setup(struct ftdi_private *priv); 1088f977e42SIan Abbott 10920734345SHarald Welte static struct ftdi_sio_quirk ftdi_jtag_quirk = { 11020734345SHarald Welte .probe = ftdi_jtag_probe, 111fa91d43bSTony Lindgren }; 112fa91d43bSTony Lindgren 113546d7eecSKevin Vance static struct ftdi_sio_quirk ftdi_mtxorb_hack_quirk = { 114546d7eecSKevin Vance .probe = ftdi_mtxorb_hack_setup, 115546d7eecSKevin Vance }; 116546d7eecSKevin Vance 117b760dac2SMartin Geleynse static struct ftdi_sio_quirk ftdi_NDI_device_quirk = { 118b760dac2SMartin Geleynse .probe = ftdi_NDI_device_setup, 119b760dac2SMartin Geleynse }; 120b760dac2SMartin Geleynse 1218f977e42SIan Abbott static struct ftdi_sio_quirk ftdi_USB_UIRT_quirk = { 1220ffbbe25SOliver Neukum .port_probe = ftdi_USB_UIRT_setup, 1238f977e42SIan Abbott }; 1248f977e42SIan Abbott 1258f977e42SIan Abbott static struct ftdi_sio_quirk ftdi_HE_TIRA1_quirk = { 1260ffbbe25SOliver Neukum .port_probe = ftdi_HE_TIRA1_setup, 1271da177e4SLinus Torvalds }; 1281da177e4SLinus Torvalds 1296ec2f46cSJean-Christophe PLAGNIOL-VILLARD static struct ftdi_sio_quirk ftdi_stmclite_quirk = { 1306ec2f46cSJean-Christophe PLAGNIOL-VILLARD .probe = ftdi_stmclite_probe, 1316ec2f46cSJean-Christophe PLAGNIOL-VILLARD }; 1326ec2f46cSJean-Christophe PLAGNIOL-VILLARD 133c96fbdd0SJean-Christophe PLAGNIOL-VILLARD static struct ftdi_sio_quirk ftdi_8u2232c_quirk = { 134c96fbdd0SJean-Christophe PLAGNIOL-VILLARD .probe = ftdi_8u2232c_probe, 135c96fbdd0SJean-Christophe PLAGNIOL-VILLARD }; 136c96fbdd0SJean-Christophe PLAGNIOL-VILLARD 1371da177e4SLinus Torvalds /* 1381da177e4SLinus Torvalds * The 8U232AM has the same API as the sio except for: 1391da177e4SLinus Torvalds * - it can support MUCH higher baudrates; up to: 1401da177e4SLinus Torvalds * o 921600 for RS232 and 2000000 for RS422/485 at 48MHz 1411da177e4SLinus Torvalds * o 230400 at 12MHz 1421da177e4SLinus Torvalds * so .. 8U232AM's baudrate setting codes are different 1431da177e4SLinus Torvalds * - it has a two byte status code. 1441da177e4SLinus Torvalds * - it returns characters every 16ms (the FTDI does it every 40ms) 1451da177e4SLinus Torvalds * 1461da177e4SLinus Torvalds * the bcdDevice value is used to differentiate FT232BM and FT245BM from 1471da177e4SLinus Torvalds * the earlier FT8U232AM and FT8U232BM. For now, include all known VID/PID 1481da177e4SLinus Torvalds * combinations in both tables. 1498f977e42SIan Abbott * FIXME: perhaps bcdDevice can also identify 12MHz FT8U232AM devices, 1508f977e42SIan Abbott * but I don't know if those ever went into mass production. [Ian Abbott] 1511da177e4SLinus Torvalds */ 1521da177e4SLinus Torvalds 1531da177e4SLinus Torvalds 1541da177e4SLinus Torvalds 15565e1ec67SAndreas Mohr /* 15665e1ec67SAndreas Mohr * Device ID not listed? Test via module params product/vendor or 15765e1ec67SAndreas Mohr * /sys/bus/usb/ftdi_sio/new_id, then send patch/report! 15865e1ec67SAndreas Mohr */ 1591da177e4SLinus Torvalds static struct usb_device_id id_table_combined [] = { 160ce7e9065SArtur Zimmer { USB_DEVICE(FTDI_VID, FTDI_ZEITCONTROL_TAGTRACE_MIFARE_PID) }, 1615a9443f0SChristian Simon { USB_DEVICE(FTDI_VID, FTDI_CTI_MINI_PID) }, 1625a9443f0SChristian Simon { USB_DEVICE(FTDI_VID, FTDI_CTI_NANO_PID) }, 1632011e924SJonathan Davies { USB_DEVICE(FTDI_VID, FTDI_AMC232_PID) }, 1642011e924SJonathan Davies { USB_DEVICE(FTDI_VID, FTDI_CANUSB_PID) }, 16501ba0856SAndrew Ewert { USB_DEVICE(FTDI_VID, FTDI_CANDAPTER_PID) }, 16665e1ec67SAndreas Mohr { USB_DEVICE(FTDI_VID, FTDI_NXTCAM_PID) }, 1676e1ab3edSPeter Mack { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_0_PID) }, 1686e1ab3edSPeter Mack { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_1_PID) }, 1696e1ab3edSPeter Mack { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_2_PID) }, 1706e1ab3edSPeter Mack { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_3_PID) }, 1716e1ab3edSPeter Mack { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_4_PID) }, 1726e1ab3edSPeter Mack { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_5_PID) }, 1736e1ab3edSPeter Mack { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_6_PID) }, 1746e1ab3edSPeter Mack { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_7_PID) }, 175b6180ef7Sdranch@trinnet.net { USB_DEVICE(FTDI_VID, FTDI_USINT_CAT_PID) }, 176b6180ef7Sdranch@trinnet.net { USB_DEVICE(FTDI_VID, FTDI_USINT_WKEY_PID) }, 177b6180ef7Sdranch@trinnet.net { USB_DEVICE(FTDI_VID, FTDI_USINT_RS232_PID) }, 17872a9f958SRazvan Gavril { USB_DEVICE(FTDI_VID, FTDI_ACTZWAVE_PID) }, 1791da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, FTDI_IRTRANS_PID) }, 18069737dfaSLuiz Fernando N. Capitulino { USB_DEVICE(FTDI_VID, FTDI_IPLUS_PID) }, 181d099321bSLuiz Fernando N. Capitulino { USB_DEVICE(FTDI_VID, FTDI_IPLUS2_PID) }, 182fad14a0dSFrank Sievertsen { USB_DEVICE(FTDI_VID, FTDI_DMX4ALL) }, 1831da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, FTDI_SIO_PID) }, 1841da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, FTDI_8U232AM_PID) }, 1851da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, FTDI_8U232AM_ALT_PID) }, 186d8b21606SGard Spreemann { USB_DEVICE(FTDI_VID, FTDI_232RL_PID) }, 187c96fbdd0SJean-Christophe PLAGNIOL-VILLARD { USB_DEVICE(FTDI_VID, FTDI_8U2232C_PID) , 188c96fbdd0SJean-Christophe PLAGNIOL-VILLARD .driver_info = (kernel_ulong_t)&ftdi_8u2232c_quirk }, 189094c2e6dSMark Adamson { USB_DEVICE(FTDI_VID, FTDI_4232H_PID) }, 190309427b6SUwe Bonnes { USB_DEVICE(FTDI_VID, FTDI_232H_PID) }, 191c0f8d561SChristophe Mariac { USB_DEVICE(FTDI_VID, FTDI_MICRO_CHAMELEON_PID) }, 1921da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, FTDI_RELAIS_PID) }, 1932adb80e9SGuido Scholz { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_PID) }, 194ec3815c3Smail@rainerkeller.de { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_SNIFFER_PID) }, 195ec3815c3Smail@rainerkeller.de { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_THROTTLE_PID) }, 196ec3815c3Smail@rainerkeller.de { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GATEWAY_PID) }, 19799c1e4f8SRainer Keller { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GBM_PID) }, 1981da177e4SLinus Torvalds { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) }, 1991da177e4SLinus Torvalds { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) }, 200f2ee6955SAlan Cox { USB_DEVICE(FTDI_VID, FTDI_SPROG_II) }, 201ea233f80SGalen Seitz { USB_DEVICE(FTDI_VID, FTDI_LENZ_LIUSB_PID) }, 2021da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, FTDI_XF_632_PID) }, 2031da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, FTDI_XF_634_PID) }, 2041da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, FTDI_XF_547_PID) }, 2051da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, FTDI_XF_633_PID) }, 2061da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, FTDI_XF_631_PID) }, 2071da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, FTDI_XF_635_PID) }, 2081da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, FTDI_XF_640_PID) }, 2091da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, FTDI_XF_642_PID) }, 2101da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, FTDI_DSS20_PID) }, 21174bdf22bSHakan Kvist { USB_DEVICE(FTDI_VID, FTDI_URBAN_0_PID) }, 21274bdf22bSHakan Kvist { USB_DEVICE(FTDI_VID, FTDI_URBAN_1_PID) }, 2131da177e4SLinus Torvalds { USB_DEVICE(FTDI_NF_RIC_VID, FTDI_NF_RIC_PID) }, 2141da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, FTDI_VNHCPCUSB_D_PID) }, 2158f977e42SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_MTXORB_0_PID) }, 2168f977e42SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_MTXORB_1_PID) }, 2178f977e42SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_MTXORB_2_PID) }, 2188f977e42SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_MTXORB_3_PID) }, 2198f977e42SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_MTXORB_4_PID) }, 2208f977e42SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_MTXORB_5_PID) }, 2218f977e42SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) }, 222b34efeeaSFolkert van Heusden { USB_DEVICE(FTDI_VID, FTDI_R2000KU_TRUE_RNG) }, 2236fdbad80SJacques Viviers { USB_DEVICE(FTDI_VID, FTDI_VARDAAN_PID) }, 224ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0100_PID) }, 225ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0101_PID) }, 226ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0102_PID) }, 227ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0103_PID) }, 228ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0104_PID) }, 229ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0105_PID) }, 230ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0106_PID) }, 231ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0107_PID) }, 232ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0108_PID) }, 233ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0109_PID) }, 234ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_010A_PID) }, 235ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_010B_PID) }, 236ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_010C_PID) }, 237ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_010D_PID) }, 238ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_010E_PID) }, 239ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_010F_PID) }, 240ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0110_PID) }, 241ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0111_PID) }, 242ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0112_PID) }, 243ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0113_PID) }, 244ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0114_PID) }, 245ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0115_PID) }, 246ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0116_PID) }, 247ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0117_PID) }, 248ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0118_PID) }, 249ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0119_PID) }, 250ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_011A_PID) }, 251ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_011B_PID) }, 252ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_011C_PID) }, 253ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_011D_PID) }, 254ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_011E_PID) }, 255ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_011F_PID) }, 256ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0120_PID) }, 257ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0121_PID) }, 258ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0122_PID) }, 259ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0123_PID) }, 260ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0124_PID) }, 261ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0125_PID) }, 262ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0126_PID) }, 263ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0127_PID), 264546d7eecSKevin Vance .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, 265ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0128_PID) }, 266ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0129_PID) }, 267ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012A_PID) }, 268ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012B_PID) }, 269ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012C_PID), 270ebb3770cSRay Molenkamp .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, 271ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012D_PID) }, 272ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012E_PID) }, 273ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012F_PID) }, 274ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0130_PID) }, 275ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0131_PID) }, 276ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0132_PID) }, 277ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0133_PID) }, 278ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0134_PID) }, 279ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0135_PID) }, 280ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0136_PID) }, 281ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0137_PID) }, 282ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0138_PID) }, 283ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0139_PID) }, 284ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_013A_PID) }, 285ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_013B_PID) }, 286ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_013C_PID) }, 287ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_013D_PID) }, 288ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_013E_PID) }, 289ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_013F_PID) }, 290ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0140_PID) }, 291ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0141_PID) }, 292ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0142_PID) }, 293ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0143_PID) }, 294ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0144_PID) }, 295ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0145_PID) }, 296ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0146_PID) }, 297ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0147_PID) }, 298ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0148_PID) }, 299ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0149_PID) }, 300ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_014A_PID) }, 301ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_014B_PID) }, 302ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_014C_PID) }, 303ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_014D_PID) }, 304ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_014E_PID) }, 305ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_014F_PID) }, 306ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0150_PID) }, 307ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0151_PID) }, 308ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0152_PID) }, 309ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0153_PID), 310ebb3770cSRay Molenkamp .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, 311ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0154_PID), 312ebb3770cSRay Molenkamp .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, 313ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0155_PID), 314ebb3770cSRay Molenkamp .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, 315ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0156_PID), 316ebb3770cSRay Molenkamp .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, 317ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0157_PID), 318ebb3770cSRay Molenkamp .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, 319ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0158_PID), 320ebb3770cSRay Molenkamp .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, 321ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0159_PID) }, 322ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_015A_PID) }, 323ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_015B_PID) }, 324ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_015C_PID) }, 325ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_015D_PID) }, 326ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_015E_PID) }, 327ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_015F_PID) }, 328ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0160_PID) }, 329ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0161_PID) }, 330ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0162_PID) }, 331ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0163_PID) }, 332ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0164_PID) }, 333ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0165_PID) }, 334ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0166_PID) }, 335ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0167_PID) }, 336ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0168_PID) }, 337ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0169_PID) }, 338ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_016A_PID) }, 339ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_016B_PID) }, 340ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_016C_PID) }, 341ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_016D_PID) }, 342ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_016E_PID) }, 343ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_016F_PID) }, 344ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0170_PID) }, 345ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0171_PID) }, 346ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0172_PID) }, 347ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0173_PID) }, 348ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0174_PID) }, 349ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0175_PID) }, 350ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0176_PID) }, 351ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0177_PID) }, 352ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0178_PID) }, 353ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0179_PID) }, 354ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_017A_PID) }, 355ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_017B_PID) }, 356ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_017C_PID) }, 357ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_017D_PID) }, 358ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_017E_PID) }, 359ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_017F_PID) }, 360ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0180_PID) }, 361ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0181_PID) }, 362ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0182_PID) }, 363ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0183_PID) }, 364ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0184_PID) }, 365ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0185_PID) }, 366ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0186_PID) }, 367ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0187_PID) }, 368ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0188_PID) }, 369ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0189_PID) }, 370ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_018A_PID) }, 371ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_018B_PID) }, 372ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_018C_PID) }, 373ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_018D_PID) }, 374ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_018E_PID) }, 375ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_018F_PID) }, 376ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0190_PID) }, 377ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0191_PID) }, 378ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0192_PID) }, 379ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0193_PID) }, 380ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0194_PID) }, 381ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0195_PID) }, 382ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0196_PID) }, 383ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0197_PID) }, 384ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0198_PID) }, 385ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0199_PID) }, 386ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_019A_PID) }, 387ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_019B_PID) }, 388ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_019C_PID) }, 389ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_019D_PID) }, 390ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_019E_PID) }, 391ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_019F_PID) }, 392ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A0_PID) }, 393ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A1_PID) }, 394ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A2_PID) }, 395ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A3_PID) }, 396ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A4_PID) }, 397ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A5_PID) }, 398ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A6_PID) }, 399ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A7_PID) }, 400ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A8_PID) }, 401ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A9_PID) }, 402ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01AA_PID) }, 403ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01AB_PID) }, 404ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01AC_PID) }, 405ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01AD_PID) }, 406ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01AE_PID) }, 407ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01AF_PID) }, 408ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B0_PID) }, 409ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B1_PID) }, 410ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B2_PID) }, 411ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B3_PID) }, 412ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B4_PID) }, 413ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B5_PID) }, 414ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B6_PID) }, 415ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B7_PID) }, 416ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B8_PID) }, 417ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B9_PID) }, 418ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01BA_PID) }, 419ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01BB_PID) }, 420ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01BC_PID) }, 421ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01BD_PID) }, 422ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01BE_PID) }, 423ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01BF_PID) }, 424ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C0_PID) }, 425ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C1_PID) }, 426ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C2_PID) }, 427ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C3_PID) }, 428ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C4_PID) }, 429ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C5_PID) }, 430ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C6_PID) }, 431ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C7_PID) }, 432ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C8_PID) }, 433ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C9_PID) }, 434ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01CA_PID) }, 435ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01CB_PID) }, 436ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01CC_PID) }, 437ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01CD_PID) }, 438ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01CE_PID) }, 439ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01CF_PID) }, 440ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D0_PID) }, 441ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D1_PID) }, 442ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D2_PID) }, 443ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D3_PID) }, 444ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D4_PID) }, 445ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D5_PID) }, 446ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D6_PID) }, 447ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D7_PID) }, 448ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D8_PID) }, 449ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D9_PID) }, 450ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01DA_PID) }, 451ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01DB_PID) }, 452ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01DC_PID) }, 453ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01DD_PID) }, 454ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01DE_PID) }, 455ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01DF_PID) }, 456ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E0_PID) }, 457ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E1_PID) }, 458ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E2_PID) }, 459ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E3_PID) }, 460ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E4_PID) }, 461ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E5_PID) }, 462ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E6_PID) }, 463ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E7_PID) }, 464ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E8_PID) }, 465ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E9_PID) }, 466ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01EA_PID) }, 467ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01EB_PID) }, 468ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01EC_PID) }, 469ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01ED_PID) }, 470ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01EE_PID) }, 471ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01EF_PID) }, 472ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F0_PID) }, 473ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F1_PID) }, 474ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F2_PID) }, 475ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F3_PID) }, 476ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F4_PID) }, 477ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F5_PID) }, 478ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F6_PID) }, 479ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F7_PID) }, 480ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F8_PID) }, 481ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F9_PID) }, 482ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FA_PID) }, 483ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FB_PID) }, 484ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FC_PID) }, 485ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FD_PID) }, 486ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FE_PID) }, 487ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FF_PID) }, 4888f977e42SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) }, 4891da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) }, 490274a4bbcSDave Platt { USB_DEVICE(FTDI_VID, FTDI_TNC_X_PID) }, 491868e440dSJelle Foks { USB_DEVICE(FTDI_VID, FTDI_USBX_707_PID) }, 4921da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2101_PID) }, 4931da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2102_PID) }, 4941da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2103_PID) }, 4951da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2104_PID) }, 496a1484827SJustin Carlson { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2106_PID) }, 4971da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2201_1_PID) }, 4981da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2201_2_PID) }, 4991da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2202_1_PID) }, 5001da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2202_2_PID) }, 5011da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2203_1_PID) }, 5021da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2203_2_PID) }, 5031da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2401_1_PID) }, 5041da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2401_2_PID) }, 5051da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2401_3_PID) }, 5061da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2401_4_PID) }, 5071da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2402_1_PID) }, 5081da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2402_2_PID) }, 5091da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2402_3_PID) }, 5101da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2402_4_PID) }, 5111da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2403_1_PID) }, 5121da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2403_2_PID) }, 5131da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2403_3_PID) }, 5141da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2403_4_PID) }, 5151da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2801_1_PID) }, 5161da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2801_2_PID) }, 5171da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2801_3_PID) }, 5181da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2801_4_PID) }, 5191da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2801_5_PID) }, 5201da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2801_6_PID) }, 5211da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2801_7_PID) }, 5221da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2801_8_PID) }, 5231da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2802_1_PID) }, 5241da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2802_2_PID) }, 5251da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2802_3_PID) }, 5261da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2802_4_PID) }, 5271da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2802_5_PID) }, 5281da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2802_6_PID) }, 5291da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2802_7_PID) }, 5301da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2802_8_PID) }, 5311da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_1_PID) }, 5321da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_2_PID) }, 5331da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_3_PID) }, 5341da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_4_PID) }, 5351da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_5_PID) }, 5361da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_6_PID) }, 5371da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_7_PID) }, 5381da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_8_PID) }, 5391da177e4SLinus Torvalds { USB_DEVICE(IDTECH_VID, IDTECH_IDT1221U_PID) }, 5401da177e4SLinus Torvalds { USB_DEVICE(OCT_VID, OCT_US101_PID) }, 54111a31d84SJohan Hovold { USB_DEVICE(OCT_VID, OCT_DK201_PID) }, 5428f977e42SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_HE_TIRA1_PID), 5438f977e42SIan Abbott .driver_info = (kernel_ulong_t)&ftdi_HE_TIRA1_quirk }, 5448f977e42SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_USB_UIRT_PID), 5458f977e42SIan Abbott .driver_info = (kernel_ulong_t)&ftdi_USB_UIRT_quirk }, 5461da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, PROTEGO_SPECIAL_1) }, 5471da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, PROTEGO_R2X0) }, 5481da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, PROTEGO_SPECIAL_3) }, 5491da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, PROTEGO_SPECIAL_4) }, 5508f977e42SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E808_PID) }, 5518f977e42SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E809_PID) }, 5528f977e42SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E80A_PID) }, 5538f977e42SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E80B_PID) }, 5548f977e42SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E80C_PID) }, 5558f977e42SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E80D_PID) }, 5568f977e42SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E80E_PID) }, 5578f977e42SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E80F_PID) }, 5588f977e42SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E888_PID) }, 5598f977e42SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E889_PID) }, 5608f977e42SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E88A_PID) }, 5618f977e42SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E88B_PID) }, 5628f977e42SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E88C_PID) }, 5638f977e42SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E88D_PID) }, 5648f977e42SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E88E_PID) }, 5658f977e42SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E88F_PID) }, 5661da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, FTDI_ELV_UO100_PID) }, 56747900743SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_ELV_UM100_PID) }, 568e6ac4a40SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_ELV_UR100_PID) }, 569e6ac4a40SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_ELV_ALC8500_PID) }, 570207c47e1SThomas Riewe { USB_DEVICE(FTDI_VID, FTDI_PYRAMID_PID) }, 571bde62185SMartin Hagelin { USB_DEVICE(FTDI_VID, FTDI_ELV_FHZ1000PC_PID) }, 5724eaf60e0SThomas Schleusener { USB_DEVICE(FTDI_VID, FTDI_IBS_US485_PID) }, 5734eaf60e0SThomas Schleusener { USB_DEVICE(FTDI_VID, FTDI_IBS_PICPRO_PID) }, 5744eaf60e0SThomas Schleusener { USB_DEVICE(FTDI_VID, FTDI_IBS_PCMCIA_PID) }, 5754eaf60e0SThomas Schleusener { USB_DEVICE(FTDI_VID, FTDI_IBS_PK1_PID) }, 5764eaf60e0SThomas Schleusener { USB_DEVICE(FTDI_VID, FTDI_IBS_RS232MON_PID) }, 5774eaf60e0SThomas Schleusener { USB_DEVICE(FTDI_VID, FTDI_IBS_APP70_PID) }, 5784eaf60e0SThomas Schleusener { USB_DEVICE(FTDI_VID, FTDI_IBS_PEDO_PID) }, 5794eaf60e0SThomas Schleusener { USB_DEVICE(FTDI_VID, FTDI_IBS_PROD_PID) }, 58037909fe5SBenedek László { USB_DEVICE(FTDI_VID, FTDI_TAVIR_STK500_PID) }, 581e6ac4a40SIan Abbott /* 58265e1ec67SAndreas Mohr * ELV devices: 583e6ac4a40SIan Abbott */ 58465e1ec67SAndreas Mohr { USB_DEVICE(FTDI_VID, FTDI_ELV_USR_PID) }, 58565e1ec67SAndreas Mohr { USB_DEVICE(FTDI_VID, FTDI_ELV_MSM1_PID) }, 58665e1ec67SAndreas Mohr { USB_DEVICE(FTDI_VID, FTDI_ELV_KL100_PID) }, 58765e1ec67SAndreas Mohr { USB_DEVICE(FTDI_VID, FTDI_ELV_WS550_PID) }, 58865e1ec67SAndreas Mohr { USB_DEVICE(FTDI_VID, FTDI_ELV_EC3000_PID) }, 58965e1ec67SAndreas Mohr { USB_DEVICE(FTDI_VID, FTDI_ELV_WS888_PID) }, 59065e1ec67SAndreas Mohr { USB_DEVICE(FTDI_VID, FTDI_ELV_TWS550_PID) }, 59165e1ec67SAndreas Mohr { USB_DEVICE(FTDI_VID, FTDI_ELV_FEM_PID) }, 59242f8aa94SPeter Stark { USB_DEVICE(FTDI_VID, FTDI_ELV_CLI7000_PID) }, 59342f8aa94SPeter Stark { USB_DEVICE(FTDI_VID, FTDI_ELV_PPS7330_PID) }, 59442f8aa94SPeter Stark { USB_DEVICE(FTDI_VID, FTDI_ELV_TFM100_PID) }, 59542f8aa94SPeter Stark { USB_DEVICE(FTDI_VID, FTDI_ELV_UDF77_PID) }, 59642f8aa94SPeter Stark { USB_DEVICE(FTDI_VID, FTDI_ELV_UIO88_PID) }, 59742f8aa94SPeter Stark { USB_DEVICE(FTDI_VID, FTDI_ELV_UAD8_PID) }, 59842f8aa94SPeter Stark { USB_DEVICE(FTDI_VID, FTDI_ELV_UDA7_PID) }, 59942f8aa94SPeter Stark { USB_DEVICE(FTDI_VID, FTDI_ELV_USI2_PID) }, 60042f8aa94SPeter Stark { USB_DEVICE(FTDI_VID, FTDI_ELV_T1100_PID) }, 60142f8aa94SPeter Stark { USB_DEVICE(FTDI_VID, FTDI_ELV_PCD200_PID) }, 60242f8aa94SPeter Stark { USB_DEVICE(FTDI_VID, FTDI_ELV_ULA200_PID) }, 60342f8aa94SPeter Stark { USB_DEVICE(FTDI_VID, FTDI_ELV_CSI8_PID) }, 60442f8aa94SPeter Stark { USB_DEVICE(FTDI_VID, FTDI_ELV_EM1000DL_PID) }, 60542f8aa94SPeter Stark { USB_DEVICE(FTDI_VID, FTDI_ELV_PCK100_PID) }, 60642f8aa94SPeter Stark { USB_DEVICE(FTDI_VID, FTDI_ELV_RFP500_PID) }, 60742f8aa94SPeter Stark { USB_DEVICE(FTDI_VID, FTDI_ELV_FS20SIG_PID) }, 60865e1ec67SAndreas Mohr { USB_DEVICE(FTDI_VID, FTDI_ELV_UTP8_PID) }, 60942f8aa94SPeter Stark { USB_DEVICE(FTDI_VID, FTDI_ELV_WS300PC_PID) }, 61065e1ec67SAndreas Mohr { USB_DEVICE(FTDI_VID, FTDI_ELV_WS444PC_PID) }, 61142f8aa94SPeter Stark { USB_DEVICE(FTDI_VID, FTDI_ELV_FHZ1300PC_PID) }, 6124ae897dfSSven Andersen { USB_DEVICE(FTDI_VID, FTDI_ELV_EM1010PC_PID) }, 61342f8aa94SPeter Stark { USB_DEVICE(FTDI_VID, FTDI_ELV_WS500_PID) }, 614b5894a50SAndré Schenk { USB_DEVICE(FTDI_VID, FTDI_ELV_HS485_PID) }, 61565e1ec67SAndreas Mohr { USB_DEVICE(FTDI_VID, FTDI_ELV_UMS100_PID) }, 61665e1ec67SAndreas Mohr { USB_DEVICE(FTDI_VID, FTDI_ELV_TFD128_PID) }, 61765e1ec67SAndreas Mohr { USB_DEVICE(FTDI_VID, FTDI_ELV_FM3RX_PID) }, 61865e1ec67SAndreas Mohr { USB_DEVICE(FTDI_VID, FTDI_ELV_WS777_PID) }, 6198f977e42SIan Abbott { USB_DEVICE(FTDI_VID, LINX_SDMUSBQSS_PID) }, 6208f977e42SIan Abbott { USB_DEVICE(FTDI_VID, LINX_MASTERDEVEL2_PID) }, 6218f977e42SIan Abbott { USB_DEVICE(FTDI_VID, LINX_FUTURE_0_PID) }, 6228f977e42SIan Abbott { USB_DEVICE(FTDI_VID, LINX_FUTURE_1_PID) }, 6238f977e42SIan Abbott { USB_DEVICE(FTDI_VID, LINX_FUTURE_2_PID) }, 6241da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, FTDI_CCSICDU20_0_PID) }, 6251da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, FTDI_CCSICDU40_1_PID) }, 626ec434e9bSJan Capek { USB_DEVICE(FTDI_VID, FTDI_CCSMACHX_2_PID) }, 6279d37ff64SJan Capek { USB_DEVICE(FTDI_VID, FTDI_CCSLOAD_N_GO_3_PID) }, 6289d37ff64SJan Capek { USB_DEVICE(FTDI_VID, FTDI_CCSICDU64_4_PID) }, 6299d37ff64SJan Capek { USB_DEVICE(FTDI_VID, FTDI_CCSPRIME8_5_PID) }, 6301da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, INSIDE_ACCESSO) }, 6311da177e4SLinus Torvalds { USB_DEVICE(INTREPID_VID, INTREPID_VALUECAN_PID) }, 6321da177e4SLinus Torvalds { USB_DEVICE(INTREPID_VID, INTREPID_NEOVI_PID) }, 6331da177e4SLinus Torvalds { USB_DEVICE(FALCOM_VID, FALCOM_TWIST_PID) }, 634e6ac4a40SIan Abbott { USB_DEVICE(FALCOM_VID, FALCOM_SAMBA_PID) }, 6351da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, FTDI_SUUNTO_SPORTS_PID) }, 636c3d36c45SVladimir Vukicevic { USB_DEVICE(FTDI_VID, FTDI_OCEANIC_PID) }, 637ef31fec0SMichael Olberg { USB_DEVICE(TTI_VID, TTI_QL355P_PID) }, 6386f92872cSIan Abbott { USB_DEVICE(FTDI_VID, FTDI_RM_CANVIEW_PID) }, 63928fe2eb0SMichael Williamson { USB_DEVICE(ACTON_VID, ACTON_SPECTRAPRO_PID) }, 64046b72d78SDaniel Sangorrin { USB_DEVICE(CONTEC_VID, CONTEC_COM1USBH_PID) }, 6411da177e4SLinus Torvalds { USB_DEVICE(BANDB_VID, BANDB_USOTL4_PID) }, 6421da177e4SLinus Torvalds { USB_DEVICE(BANDB_VID, BANDB_USTL4_PID) }, 6431da177e4SLinus Torvalds { USB_DEVICE(BANDB_VID, BANDB_USO9ML2_PID) }, 644a8cbd90aSCliff Brake { USB_DEVICE(BANDB_VID, BANDB_USOPTL4_PID) }, 645a8cbd90aSCliff Brake { USB_DEVICE(BANDB_VID, BANDB_USPTL4_PID) }, 646a8cbd90aSCliff Brake { USB_DEVICE(BANDB_VID, BANDB_USO9ML2DR_2_PID) }, 647a8cbd90aSCliff Brake { USB_DEVICE(BANDB_VID, BANDB_USO9ML2DR_PID) }, 648a8cbd90aSCliff Brake { USB_DEVICE(BANDB_VID, BANDB_USOPTL4DR2_PID) }, 649a8cbd90aSCliff Brake { USB_DEVICE(BANDB_VID, BANDB_USOPTL4DR_PID) }, 650a8cbd90aSCliff Brake { USB_DEVICE(BANDB_VID, BANDB_485USB9F_2W_PID) }, 651a8cbd90aSCliff Brake { USB_DEVICE(BANDB_VID, BANDB_485USB9F_4W_PID) }, 652a8cbd90aSCliff Brake { USB_DEVICE(BANDB_VID, BANDB_232USB9M_PID) }, 653a8cbd90aSCliff Brake { USB_DEVICE(BANDB_VID, BANDB_485USBTB_2W_PID) }, 654a8cbd90aSCliff Brake { USB_DEVICE(BANDB_VID, BANDB_485USBTB_4W_PID) }, 655a8cbd90aSCliff Brake { USB_DEVICE(BANDB_VID, BANDB_TTL5USB9M_PID) }, 656a8cbd90aSCliff Brake { USB_DEVICE(BANDB_VID, BANDB_TTL3USB9M_PID) }, 657a8cbd90aSCliff Brake { USB_DEVICE(BANDB_VID, BANDB_ZZ_PROG1_USB_PID) }, 6581da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, EVER_ECO_PRO_CDS) }, 6596f92872cSIan Abbott { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_1_PID) }, 6606f92872cSIan Abbott { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_2_PID) }, 661a26d31ceSSteffen Sledz { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_3_PID) }, 662e6ac4a40SIan Abbott { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_0_PID) }, 663e6ac4a40SIan Abbott { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_1_PID) }, 664e6ac4a40SIan Abbott { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_2_PID) }, 665e6ac4a40SIan Abbott { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_3_PID) }, 666e6ac4a40SIan Abbott { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_4_PID) }, 667e6ac4a40SIan Abbott { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_5_PID) }, 668e6ac4a40SIan Abbott { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_6_PID) }, 669e6ac4a40SIan Abbott { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_7_PID) }, 6706f92872cSIan Abbott { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) }, 6718f977e42SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_ACTIVE_ROBOTS_PID) }, 67234d1a8aaSIan Abbott { USB_DEVICE(FTDI_VID, FTDI_MHAM_KW_PID) }, 67334d1a8aaSIan Abbott { USB_DEVICE(FTDI_VID, FTDI_MHAM_YS_PID) }, 6749b1513d9SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_MHAM_Y6_PID) }, 6759b1513d9SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_MHAM_Y8_PID) }, 67634d1a8aaSIan Abbott { USB_DEVICE(FTDI_VID, FTDI_MHAM_IC_PID) }, 67734d1a8aaSIan Abbott { USB_DEVICE(FTDI_VID, FTDI_MHAM_DB9_PID) }, 67834d1a8aaSIan Abbott { USB_DEVICE(FTDI_VID, FTDI_MHAM_RS232_PID) }, 67934d1a8aaSIan Abbott { USB_DEVICE(FTDI_VID, FTDI_MHAM_Y9_PID) }, 680740a4282SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_TERATRONIK_VCP_PID) }, 681740a4282SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_TERATRONIK_D2XX_PID) }, 6829b1513d9SIan Abbott { USB_DEVICE(EVOLUTION_VID, EVOLUTION_ER1_PID) }, 683c1f8ea7dSSøren Hauberg { USB_DEVICE(EVOLUTION_VID, EVO_HYBRID_PID) }, 684c1f8ea7dSSøren Hauberg { USB_DEVICE(EVOLUTION_VID, EVO_RCM4_PID) }, 685c9c7746dSRui Santos { USB_DEVICE(FTDI_VID, FTDI_ARTEMIS_PID) }, 686c9c7746dSRui Santos { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16_PID) }, 68709c280a2SRui Santos { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16C_PID) }, 688c9c7746dSRui Santos { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16HR_PID) }, 68909c280a2SRui Santos { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16HRC_PID) }, 69034910434SFranco Lanza { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16IC_PID) }, 691b4723ae3SIan Abbott { USB_DEVICE(KOBIL_VID, KOBIL_CONV_B1_PID) }, 692b4723ae3SIan Abbott { USB_DEVICE(KOBIL_VID, KOBIL_CONV_KAAN_PID) }, 693effac8beSPavel Fedin { USB_DEVICE(POSIFLEX_VID, POSIFLEX_PP7000_PID) }, 694641adaaeSLouis Nyffenegger { USB_DEVICE(FTDI_VID, FTDI_TTUSB_PID) }, 6957e1c0b86SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_ECLO_COM_1WIRE_PID) }, 696a94b52acSIan Abbott { USB_DEVICE(FTDI_VID, FTDI_WESTREX_MODEL_777_PID) }, 697a94b52acSIan Abbott { USB_DEVICE(FTDI_VID, FTDI_WESTREX_MODEL_8900F_PID) }, 698ce40d290SWouter Paesen { USB_DEVICE(FTDI_VID, FTDI_PCDJ_DAC2_PID) }, 699cdd3b156SNathan Bronson { USB_DEVICE(FTDI_VID, FTDI_RRCIRKITS_LOCOBUFFER_PID) }, 7007e0258fdSIan Abbott { USB_DEVICE(FTDI_VID, FTDI_ASK_RDR400_PID) }, 701a9d61bc4SPieter Maes { USB_DEVICE(ICOM_VID, ICOM_ID_1_PID) }, 702a9d61bc4SPieter Maes { USB_DEVICE(ICOM_VID, ICOM_OPC_U_UC_PID) }, 703a9d61bc4SPieter Maes { USB_DEVICE(ICOM_VID, ICOM_ID_RP2C1_PID) }, 704a9d61bc4SPieter Maes { USB_DEVICE(ICOM_VID, ICOM_ID_RP2C2_PID) }, 705a9d61bc4SPieter Maes { USB_DEVICE(ICOM_VID, ICOM_ID_RP2D_PID) }, 706a9d61bc4SPieter Maes { USB_DEVICE(ICOM_VID, ICOM_ID_RP2VT_PID) }, 707a9d61bc4SPieter Maes { USB_DEVICE(ICOM_VID, ICOM_ID_RP2VR_PID) }, 708a9d61bc4SPieter Maes { USB_DEVICE(ICOM_VID, ICOM_ID_RP4KVT_PID) }, 709a9d61bc4SPieter Maes { USB_DEVICE(ICOM_VID, ICOM_ID_RP4KVR_PID) }, 710a9d61bc4SPieter Maes { USB_DEVICE(ICOM_VID, ICOM_ID_RP2KVT_PID) }, 711a9d61bc4SPieter Maes { USB_DEVICE(ICOM_VID, ICOM_ID_RP2KVR_PID) }, 71220a0f47eSIan Abbott { USB_DEVICE(FTDI_VID, FTDI_ACG_HFDUAL_PID) }, 713eb79b4fdSIan Abbott { USB_DEVICE(FTDI_VID, FTDI_YEI_SERVOCENTER31_PID) }, 71448437486SD. Peter Siddons { USB_DEVICE(FTDI_VID, FTDI_THORLABS_PID) }, 715e1979fefSColin Leroy { USB_DEVICE(TESTO_VID, TESTO_USB_INTERFACE_PID) }, 716eaede2cbSRalf Schlatterbeck { USB_DEVICE(FTDI_VID, FTDI_GAMMA_SCOUT_PID) }, 7179978f9e1SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_TACTRIX_OPENPORT_13M_PID) }, 7189978f9e1SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_TACTRIX_OPENPORT_13S_PID) }, 7199978f9e1SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_TACTRIX_OPENPORT_13U_PID) }, 72040c36092SKjell Myksvoll { USB_DEVICE(ELEKTOR_VID, ELEKTOR_FT323R_PID) }, 721b760dac2SMartin Geleynse { USB_DEVICE(FTDI_VID, FTDI_NDI_HUC_PID), 722b760dac2SMartin Geleynse .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, 723b760dac2SMartin Geleynse { USB_DEVICE(FTDI_VID, FTDI_NDI_SPECTRA_SCU_PID), 724b760dac2SMartin Geleynse .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, 725b760dac2SMartin Geleynse { USB_DEVICE(FTDI_VID, FTDI_NDI_FUTURE_2_PID), 726b760dac2SMartin Geleynse .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, 727b760dac2SMartin Geleynse { USB_DEVICE(FTDI_VID, FTDI_NDI_FUTURE_3_PID), 728b760dac2SMartin Geleynse .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, 729b760dac2SMartin Geleynse { USB_DEVICE(FTDI_VID, FTDI_NDI_AURORA_SCU_PID), 730b760dac2SMartin Geleynse .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, 731822c7ef4SMicke Prag { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, 732fcc6cb78SCorey Minyard { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_SERIAL_VX7_PID) }, 73328942bb6SMichael Stuermer { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_CT29B_PID) }, 734762e92faSNeil \"Superna\" ARMSTRONG { USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) }, 735a5f62399SLex Ross { USB_DEVICE(FTDI_VID, FTDI_PHI_FISCO_PID) }, 736d7fde2d6SPierre Castella { USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) }, 7374bb0ef19SEd Beroset { USB_DEVICE(FTDI_VID, FTDI_ELSTER_UNICOM_PID) }, 73811171d1bSMirko Bordignon { USB_DEVICE(FTDI_VID, FTDI_PROPOX_JTAGCABLEII_PID) }, 739fa91d43bSTony Lindgren { USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_PID), 74020734345SHarald Welte .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 741b88ccf6fSJF Argentino { USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_H_PID), 742b88ccf6fSJF Argentino .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 74320734345SHarald Welte { USB_DEVICE(FIC_VID, FIC_NEO1973_DEBUG_PID), 74420734345SHarald Welte .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 74520734345SHarald Welte { USB_DEVICE(FTDI_VID, FTDI_OOCDLINK_PID), 74620734345SHarald Welte .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 747a00c3cadSFrederik Kriewitz { USB_DEVICE(FTDI_VID, LMI_LM3S_DEVEL_BOARD_PID), 748a00c3cadSFrederik Kriewitz .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 749a00c3cadSFrederik Kriewitz { USB_DEVICE(FTDI_VID, LMI_LM3S_EVAL_BOARD_PID), 750a00c3cadSFrederik Kriewitz .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 7513687f641SPeter Stuge { USB_DEVICE(FTDI_VID, LMI_LM3S_ICDI_BOARD_PID), 7523687f641SPeter Stuge .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 75314511412SKrzysztof Halasa { USB_DEVICE(FTDI_VID, FTDI_TURTELIZER_PID), 75414511412SKrzysztof Halasa .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 75526ab7053SAtsushi Nemoto { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) }, 7562542335cSJon K Hellan { USB_DEVICE(FTDI_VID, FTDI_REU_TINY_PID) }, 75759c6ccd9SDaniel Suchy 75859c6ccd9SDaniel Suchy /* Papouch devices based on FTDI chip */ 75959c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB485_PID) }, 76059c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_AP485_PID) }, 76159c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB422_PID) }, 76259c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB485_2_PID) }, 76359c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_AP485_2_PID) }, 76459c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB422_2_PID) }, 76559c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB485S_PID) }, 76659c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB485C_PID) }, 76759c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_LEC_PID) }, 76859c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB232_PID) }, 76959c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_TMU_PID) }, 77059c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_IRAMP_PID) }, 77159c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_DRAK5_PID) }, 77259c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO8x8_PID) }, 773a18f80b4SJaroslav Kysela { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO4x4_PID) }, 77459c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO2x2_PID) }, 77559c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO10x1_PID) }, 77659c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO30x3_PID) }, 77759c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO60x3_PID) }, 77859c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO2x16_PID) }, 77959c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO3x32_PID) }, 78059c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_DRAK6_PID) }, 78159c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_UPSUSB_PID) }, 78259c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_MU_PID) }, 78359c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SIMUKEY_PID) }, 784a7787e50SRadek Liboska { USB_DEVICE(PAPOUCH_VID, PAPOUCH_AD4USB_PID) }, 78559c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_GMUX_PID) }, 78659c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_GMSR_PID) }, 78759c6ccd9SDaniel Suchy 78896285cb8SGaetan Carlier { USB_DEVICE(FTDI_VID, FTDI_DOMINTELL_DGQG_PID) }, 78996285cb8SGaetan Carlier { USB_DEVICE(FTDI_VID, FTDI_DOMINTELL_DUSB_PID) }, 79045eeff84SRobie Basak { USB_DEVICE(ALTI2_VID, ALTI2_N3_PID) }, 791ca80801bSMhayk Whandson { USB_DEVICE(FTDI_VID, DIEBOLD_BCS_SE923_PID) }, 7927f82b6ddSAxel Wachtler { USB_DEVICE(ATMEL_VID, STK541_PID) }, 7937f82b6ddSAxel Wachtler { USB_DEVICE(DE_VID, STB_PID) }, 7947f82b6ddSAxel Wachtler { USB_DEVICE(DE_VID, WHT_PID) }, 795b0d65900SMichael Hennerich { USB_DEVICE(ADI_VID, ADI_GNICE_PID), 796b0d65900SMichael Hennerich .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 79711eaf170SMichael Hennerich { USB_DEVICE(ADI_VID, ADI_GNICEPLUS_PID), 79811eaf170SMichael Hennerich .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 799ae27d843SPeter Korsgaard { USB_DEVICE(JETI_VID, JETI_SPC1201_PID) }, 8001002bb77SNicolas Pitre { USB_DEVICE(MARVELL_VID, MARVELL_SHEEVAPLUG_PID), 8011002bb77SNicolas Pitre .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 802d46130abSDaniel Suchy { USB_DEVICE(LARSENBRUSGAARD_VID, LB_ALTITRACK_PID) }, 803fca4404cSVille Sundberg { USB_DEVICE(GN_OTOMETRICS_VID, AURICAL_USB_PID) }, 804c47aacc6SMarko Hänninen { USB_DEVICE(BAYER_VID, BAYER_CONTOUR_CABLE_PID) }, 80550d0678eSDhaval Vasa { USB_DEVICE(FTDI_VID, MARVELL_OPENRD_PID), 80650d0678eSDhaval Vasa .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 807e7d7fcc0SPawel Ludwikow { USB_DEVICE(FTDI_VID, HAMEG_HO820_PID) }, 808c53c2fabSPaul Friedrich { USB_DEVICE(FTDI_VID, HAMEG_HO720_PID) }, 809c53c2fabSPaul Friedrich { USB_DEVICE(FTDI_VID, HAMEG_HO730_PID) }, 810e7d7fcc0SPawel Ludwikow { USB_DEVICE(FTDI_VID, HAMEG_HO870_PID) }, 8119714080dSMitchell Solomon { USB_DEVICE(FTDI_VID, MJSG_GENERIC_PID) }, 8129714080dSMitchell Solomon { USB_DEVICE(FTDI_VID, MJSG_SR_RADIO_PID) }, 8139714080dSMitchell Solomon { USB_DEVICE(FTDI_VID, MJSG_HD_RADIO_PID) }, 8149714080dSMitchell Solomon { USB_DEVICE(FTDI_VID, MJSG_XM_RADIO_PID) }, 81577dbd74eSColin Leitner { USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_ST_PID), 81677dbd74eSColin Leitner .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 81777dbd74eSColin Leitner { USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_SLITE_PID), 81877dbd74eSColin Leitner .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 81977dbd74eSColin Leitner { USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_SH2_PID), 82077dbd74eSColin Leitner .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 82177dbd74eSColin Leitner { USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_SH4_PID), 82277dbd74eSColin Leitner .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 823afad1964SJohn G. Rogers { USB_DEVICE(FTDI_VID, SEGWAY_RMP200_PID) }, 8243126d823SRich Mattes { USB_DEVICE(FTDI_VID, ACCESIO_COM4SM_PID) }, 825666cc076SMartin Michlmayr { USB_DEVICE(IONICS_VID, IONICS_PLUGCOMPUTER_PID), 826666cc076SMartin Michlmayr .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 82765737388SLuke Lowrey { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_24_MASTER_WING_PID) }, 82865737388SLuke Lowrey { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_PC_WING_PID) }, 82965737388SLuke Lowrey { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_USB_DMX_PID) }, 83065737388SLuke Lowrey { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_MIDI_TIMECODE_PID) }, 83165737388SLuke Lowrey { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_MINI_WING_PID) }, 83265737388SLuke Lowrey { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_MAXI_WING_PID) }, 83365737388SLuke Lowrey { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_MEDIA_WING_PID) }, 83465737388SLuke Lowrey { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_WING_PID) }, 8350f266abdSGreg Kroah-Hartman { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LOGBOOKML_PID) }, 8360f266abdSGreg Kroah-Hartman { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LS_LOGBOOK_PID) }, 8370f266abdSGreg Kroah-Hartman { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_HS_LOGBOOK_PID) }, 8385363cdc3SFlorian Faber { USB_DEVICE(FTDI_VID, FTDI_DOTEC_PID) }, 8397fea0f71SSebastien Bourdeauducq { USB_DEVICE(QIHARDWARE_VID, MILKYMISTONE_JTAGSERIAL_PID), 8407fea0f71SSebastien Bourdeauducq .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 8416ec2f46cSJean-Christophe PLAGNIOL-VILLARD { USB_DEVICE(ST_VID, ST_STMCLT1030_PID), 8426ec2f46cSJean-Christophe PLAGNIOL-VILLARD .driver_info = (kernel_ulong_t)&ftdi_stmclite_quirk }, 843fdcb0a0fSIan Abbott { }, /* Optional parameter entry */ 8441da177e4SLinus Torvalds { } /* Terminating entry */ 8451da177e4SLinus Torvalds }; 8461da177e4SLinus Torvalds 8471da177e4SLinus Torvalds MODULE_DEVICE_TABLE(usb, id_table_combined); 8481da177e4SLinus Torvalds 8491da177e4SLinus Torvalds static struct usb_driver ftdi_driver = { 8501da177e4SLinus Torvalds .name = "ftdi_sio", 8511da177e4SLinus Torvalds .probe = usb_serial_probe, 8521da177e4SLinus Torvalds .disconnect = usb_serial_disconnect, 8531da177e4SLinus Torvalds .id_table = id_table_combined, 854ba9dc657SGreg Kroah-Hartman .no_dynamic_id = 1, 8551da177e4SLinus Torvalds }; 8561da177e4SLinus Torvalds 8574c4c9432SArjan van de Ven static const char *ftdi_chip_name[] = { 8581da177e4SLinus Torvalds [SIO] = "SIO", /* the serial part of FT8U100AX */ 8591da177e4SLinus Torvalds [FT8U232AM] = "FT8U232AM", 8601da177e4SLinus Torvalds [FT232BM] = "FT232BM", 8611da177e4SLinus Torvalds [FT2232C] = "FT2232C", 862d8b21606SGard Spreemann [FT232RL] = "FT232RL", 863094c2e6dSMark Adamson [FT2232H] = "FT2232H", 864309427b6SUwe Bonnes [FT4232H] = "FT4232H", 865309427b6SUwe Bonnes [FT232H] = "FT232H" 8661da177e4SLinus Torvalds }; 8671da177e4SLinus Torvalds 8681da177e4SLinus Torvalds 8691da177e4SLinus Torvalds /* Used for TIOCMIWAIT */ 8701da177e4SLinus Torvalds #define FTDI_STATUS_B0_MASK (FTDI_RS0_CTS | FTDI_RS0_DSR | FTDI_RS0_RI | FTDI_RS0_RLSD) 8711da177e4SLinus Torvalds #define FTDI_STATUS_B1_MASK (FTDI_RS_BI) 8721da177e4SLinus Torvalds /* End TIOCMIWAIT */ 8731da177e4SLinus Torvalds 8741da177e4SLinus Torvalds #define FTDI_IMPL_ASYNC_FLAGS = (ASYNC_SPD_HI | ASYNC_SPD_VHI \ 875bbc5d276SRoel Kluin | ASYNC_SPD_CUST | ASYNC_SPD_SHI | ASYNC_SPD_WARP) 8761da177e4SLinus Torvalds 8771da177e4SLinus Torvalds /* function prototypes for a FTDI serial converter */ 878464cbb24SAlan Cox static int ftdi_sio_probe(struct usb_serial *serial, 879464cbb24SAlan Cox const struct usb_device_id *id); 88012bdbe03SJim Radford static int ftdi_sio_port_probe(struct usb_serial_port *port); 88112bdbe03SJim Radford static int ftdi_sio_port_remove(struct usb_serial_port *port); 882a509a7e4SAlan Cox static int ftdi_open(struct tty_struct *tty, struct usb_serial_port *port); 883335f8514SAlan Cox static void ftdi_close(struct usb_serial_port *port); 884335f8514SAlan Cox static void ftdi_dtr_rts(struct usb_serial_port *port, int on); 8851b551015SJohan Hovold static void ftdi_process_read_urb(struct urb *urb); 886d3901a06SJohan Hovold static int ftdi_prepare_write_buffer(struct usb_serial_port *port, 887c23e5fc1SJohan Hovold void *dest, size_t size); 888464cbb24SAlan Cox static void ftdi_set_termios(struct tty_struct *tty, 889464cbb24SAlan Cox struct usb_serial_port *port, struct ktermios *old); 89060b33c13SAlan Cox static int ftdi_tiocmget(struct tty_struct *tty); 89120b9d177SAlan Cox static int ftdi_tiocmset(struct tty_struct *tty, 892464cbb24SAlan Cox unsigned int set, unsigned int clear); 893c75ccd48SUwe Bonnes static int ftdi_get_icount(struct tty_struct *tty, 894c75ccd48SUwe Bonnes struct serial_icounter_struct *icount); 89500a0d0d6SAlan Cox static int ftdi_ioctl(struct tty_struct *tty, 896464cbb24SAlan Cox unsigned int cmd, unsigned long arg); 89795da310eSAlan Cox static void ftdi_break_ctl(struct tty_struct *tty, int break_state); 8981da177e4SLinus Torvalds 8991da177e4SLinus Torvalds static unsigned short int ftdi_232am_baud_base_to_divisor(int baud, int base); 9001da177e4SLinus Torvalds static unsigned short int ftdi_232am_baud_to_divisor(int baud); 9011da177e4SLinus Torvalds static __u32 ftdi_232bm_baud_base_to_divisor(int baud, int base); 9021da177e4SLinus Torvalds static __u32 ftdi_232bm_baud_to_divisor(int baud); 903094c2e6dSMark Adamson static __u32 ftdi_2232h_baud_base_to_divisor(int baud, int base); 904094c2e6dSMark Adamson static __u32 ftdi_2232h_baud_to_divisor(int baud); 9051da177e4SLinus Torvalds 906ea65370dSGreg Kroah-Hartman static struct usb_serial_driver ftdi_sio_device = { 90718fcac35SGreg Kroah-Hartman .driver = { 9081da177e4SLinus Torvalds .owner = THIS_MODULE, 909269bda1cSGreg Kroah-Hartman .name = "ftdi_sio", 91018fcac35SGreg Kroah-Hartman }, 911269bda1cSGreg Kroah-Hartman .description = "FTDI USB Serial Device", 912d9b1b787SJohannes Hölzl .usb_driver = &ftdi_driver, 9138f977e42SIan Abbott .id_table = id_table_combined, 9141da177e4SLinus Torvalds .num_ports = 1, 915bbcb2b90SJohan Hovold .bulk_in_size = 512, 916c23e5fc1SJohan Hovold .bulk_out_size = 256, 9178f977e42SIan Abbott .probe = ftdi_sio_probe, 91812bdbe03SJim Radford .port_probe = ftdi_sio_port_probe, 91912bdbe03SJim Radford .port_remove = ftdi_sio_port_remove, 9201da177e4SLinus Torvalds .open = ftdi_open, 9211da177e4SLinus Torvalds .close = ftdi_close, 922335f8514SAlan Cox .dtr_rts = ftdi_dtr_rts, 9231b551015SJohan Hovold .throttle = usb_serial_generic_throttle, 9241b551015SJohan Hovold .unthrottle = usb_serial_generic_unthrottle, 9251b551015SJohan Hovold .process_read_urb = ftdi_process_read_urb, 926d3901a06SJohan Hovold .prepare_write_buffer = ftdi_prepare_write_buffer, 9271da177e4SLinus Torvalds .tiocmget = ftdi_tiocmget, 9281da177e4SLinus Torvalds .tiocmset = ftdi_tiocmset, 929c75ccd48SUwe Bonnes .get_icount = ftdi_get_icount, 9301da177e4SLinus Torvalds .ioctl = ftdi_ioctl, 9311da177e4SLinus Torvalds .set_termios = ftdi_set_termios, 9321da177e4SLinus Torvalds .break_ctl = ftdi_break_ctl, 9331da177e4SLinus Torvalds }; 9341da177e4SLinus Torvalds 9351da177e4SLinus Torvalds 9361da177e4SLinus Torvalds #define WDR_TIMEOUT 5000 /* default urb timeout */ 937279e1545SIan Abbott #define WDR_SHORT_TIMEOUT 1000 /* shorter urb timeout */ 9381da177e4SLinus Torvalds 9391da177e4SLinus Torvalds /* High and low are for DTR, RTS etc etc */ 9401da177e4SLinus Torvalds #define HIGH 1 9411da177e4SLinus Torvalds #define LOW 0 9421da177e4SLinus Torvalds 9431da177e4SLinus Torvalds /* 9441da177e4SLinus Torvalds * *************************************************************************** 945fa91d43bSTony Lindgren * Utility functions 9461da177e4SLinus Torvalds * *************************************************************************** 9471da177e4SLinus Torvalds */ 9481da177e4SLinus Torvalds 9491da177e4SLinus Torvalds static unsigned short int ftdi_232am_baud_base_to_divisor(int baud, int base) 9501da177e4SLinus Torvalds { 9511da177e4SLinus Torvalds unsigned short int divisor; 952464cbb24SAlan Cox /* divisor shifted 3 bits to the left */ 953464cbb24SAlan Cox int divisor3 = base / 2 / baud; 954464cbb24SAlan Cox if ((divisor3 & 0x7) == 7) 955464cbb24SAlan Cox divisor3++; /* round x.7/8 up to x+1 */ 9561da177e4SLinus Torvalds divisor = divisor3 >> 3; 9571da177e4SLinus Torvalds divisor3 &= 0x7; 958464cbb24SAlan Cox if (divisor3 == 1) 959464cbb24SAlan Cox divisor |= 0xc000; 960464cbb24SAlan Cox else if (divisor3 >= 4) 961464cbb24SAlan Cox divisor |= 0x4000; 962464cbb24SAlan Cox else if (divisor3 != 0) 963464cbb24SAlan Cox divisor |= 0x8000; 964464cbb24SAlan Cox else if (divisor == 1) 965464cbb24SAlan Cox divisor = 0; /* special case for maximum baud rate */ 9661da177e4SLinus Torvalds return divisor; 9671da177e4SLinus Torvalds } 9681da177e4SLinus Torvalds 9691da177e4SLinus Torvalds static unsigned short int ftdi_232am_baud_to_divisor(int baud) 9701da177e4SLinus Torvalds { 971464cbb24SAlan Cox return ftdi_232am_baud_base_to_divisor(baud, 48000000); 9721da177e4SLinus Torvalds } 9731da177e4SLinus Torvalds 9741da177e4SLinus Torvalds static __u32 ftdi_232bm_baud_base_to_divisor(int baud, int base) 9751da177e4SLinus Torvalds { 9761da177e4SLinus Torvalds static const unsigned char divfrac[8] = { 0, 3, 2, 4, 1, 5, 6, 7 }; 9771da177e4SLinus Torvalds __u32 divisor; 978464cbb24SAlan Cox /* divisor shifted 3 bits to the left */ 979464cbb24SAlan Cox int divisor3 = base / 2 / baud; 9801da177e4SLinus Torvalds divisor = divisor3 >> 3; 9811da177e4SLinus Torvalds divisor |= (__u32)divfrac[divisor3 & 0x7] << 14; 9821da177e4SLinus Torvalds /* Deal with special cases for highest baud rates. */ 983464cbb24SAlan Cox if (divisor == 1) 984464cbb24SAlan Cox divisor = 0; 985464cbb24SAlan Cox else if (divisor == 0x4001) 986464cbb24SAlan Cox divisor = 1; 9871da177e4SLinus Torvalds return divisor; 9881da177e4SLinus Torvalds } 9891da177e4SLinus Torvalds 9901da177e4SLinus Torvalds static __u32 ftdi_232bm_baud_to_divisor(int baud) 9911da177e4SLinus Torvalds { 992464cbb24SAlan Cox return ftdi_232bm_baud_base_to_divisor(baud, 48000000); 9931da177e4SLinus Torvalds } 9941da177e4SLinus Torvalds 995094c2e6dSMark Adamson static __u32 ftdi_2232h_baud_base_to_divisor(int baud, int base) 996094c2e6dSMark Adamson { 997094c2e6dSMark Adamson static const unsigned char divfrac[8] = { 0, 3, 2, 4, 1, 5, 6, 7 }; 998094c2e6dSMark Adamson __u32 divisor; 999094c2e6dSMark Adamson int divisor3; 1000094c2e6dSMark Adamson 1001094c2e6dSMark Adamson /* hi-speed baud rate is 10-bit sampling instead of 16-bit */ 1002f6c259a3SDaniel Glöckner divisor3 = base * 8 / (baud * 10); 1003094c2e6dSMark Adamson 1004094c2e6dSMark Adamson divisor = divisor3 >> 3; 1005094c2e6dSMark Adamson divisor |= (__u32)divfrac[divisor3 & 0x7] << 14; 1006094c2e6dSMark Adamson /* Deal with special cases for highest baud rates. */ 1007094c2e6dSMark Adamson if (divisor == 1) 1008094c2e6dSMark Adamson divisor = 0; 1009094c2e6dSMark Adamson else if (divisor == 0x4001) 1010094c2e6dSMark Adamson divisor = 1; 1011094c2e6dSMark Adamson /* 1012094c2e6dSMark Adamson * Set this bit to turn off a divide by 2.5 on baud rate generator 1013094c2e6dSMark Adamson * This enables baud rates up to 12Mbaud but cannot reach below 1200 1014094c2e6dSMark Adamson * baud with this bit set 1015094c2e6dSMark Adamson */ 1016094c2e6dSMark Adamson divisor |= 0x00020000; 1017094c2e6dSMark Adamson return divisor; 1018094c2e6dSMark Adamson } 1019094c2e6dSMark Adamson 1020094c2e6dSMark Adamson static __u32 ftdi_2232h_baud_to_divisor(int baud) 1021094c2e6dSMark Adamson { 1022094c2e6dSMark Adamson return ftdi_2232h_baud_base_to_divisor(baud, 120000000); 1023094c2e6dSMark Adamson } 1024094c2e6dSMark Adamson 102574ede0ffSIan Abbott #define set_mctrl(port, set) update_mctrl((port), (set), 0) 102674ede0ffSIan Abbott #define clear_mctrl(port, clear) update_mctrl((port), 0, (clear)) 102774ede0ffSIan Abbott 1028464cbb24SAlan Cox static int update_mctrl(struct usb_serial_port *port, unsigned int set, 1029464cbb24SAlan Cox unsigned int clear) 10301da177e4SLinus Torvalds { 10311da177e4SLinus Torvalds struct ftdi_private *priv = usb_get_serial_port_data(port); 103274ede0ffSIan Abbott unsigned urb_value; 10331da177e4SLinus Torvalds int rv; 10341da177e4SLinus Torvalds 103574ede0ffSIan Abbott if (((set | clear) & (TIOCM_DTR | TIOCM_RTS)) == 0) { 1036441b62c1SHarvey Harrison dbg("%s - DTR|RTS not being set|cleared", __func__); 103774ede0ffSIan Abbott return 0; /* no change */ 10381da177e4SLinus Torvalds } 103974ede0ffSIan Abbott 104074ede0ffSIan Abbott clear &= ~set; /* 'set' takes precedence over 'clear' */ 104174ede0ffSIan Abbott urb_value = 0; 104274ede0ffSIan Abbott if (clear & TIOCM_DTR) 104374ede0ffSIan Abbott urb_value |= FTDI_SIO_SET_DTR_LOW; 104474ede0ffSIan Abbott if (clear & TIOCM_RTS) 104574ede0ffSIan Abbott urb_value |= FTDI_SIO_SET_RTS_LOW; 104674ede0ffSIan Abbott if (set & TIOCM_DTR) 104774ede0ffSIan Abbott urb_value |= FTDI_SIO_SET_DTR_HIGH; 104874ede0ffSIan Abbott if (set & TIOCM_RTS) 104974ede0ffSIan Abbott urb_value |= FTDI_SIO_SET_RTS_HIGH; 10501da177e4SLinus Torvalds rv = usb_control_msg(port->serial->dev, 10511da177e4SLinus Torvalds usb_sndctrlpipe(port->serial->dev, 0), 10521da177e4SLinus Torvalds FTDI_SIO_SET_MODEM_CTRL_REQUEST, 10531da177e4SLinus Torvalds FTDI_SIO_SET_MODEM_CTRL_REQUEST_TYPE, 105474ede0ffSIan Abbott urb_value, priv->interface, 105566e47e60SJohan Hovold NULL, 0, WDR_TIMEOUT); 105674ede0ffSIan Abbott if (rv < 0) { 105743b11d33SAlan Cox dbg("%s Error from MODEM_CTRL urb: DTR %s, RTS %s", 1058441b62c1SHarvey Harrison __func__, 105974ede0ffSIan Abbott (set & TIOCM_DTR) ? "HIGH" : 106074ede0ffSIan Abbott (clear & TIOCM_DTR) ? "LOW" : "unchanged", 106174ede0ffSIan Abbott (set & TIOCM_RTS) ? "HIGH" : 106274ede0ffSIan Abbott (clear & TIOCM_RTS) ? "LOW" : "unchanged"); 10631da177e4SLinus Torvalds } else { 1064441b62c1SHarvey Harrison dbg("%s - DTR %s, RTS %s", __func__, 106574ede0ffSIan Abbott (set & TIOCM_DTR) ? "HIGH" : 106674ede0ffSIan Abbott (clear & TIOCM_DTR) ? "LOW" : "unchanged", 106774ede0ffSIan Abbott (set & TIOCM_RTS) ? "HIGH" : 106874ede0ffSIan Abbott (clear & TIOCM_RTS) ? "LOW" : "unchanged"); 10699b0f2582SAlan Cox /* FIXME: locking on last_dtr_rts */ 107074ede0ffSIan Abbott priv->last_dtr_rts = (priv->last_dtr_rts & ~clear) | set; 10711da177e4SLinus Torvalds } 10721da177e4SLinus Torvalds return rv; 10731da177e4SLinus Torvalds } 10741da177e4SLinus Torvalds 10751da177e4SLinus Torvalds 1076464cbb24SAlan Cox static __u32 get_ftdi_divisor(struct tty_struct *tty, 1077464cbb24SAlan Cox struct usb_serial_port *port) 1078e49bbce1SJohan Hovold { 10791da177e4SLinus Torvalds struct ftdi_private *priv = usb_get_serial_port_data(port); 10801da177e4SLinus Torvalds __u32 div_value = 0; 10811da177e4SLinus Torvalds int div_okay = 1; 10821da177e4SLinus Torvalds int baud; 10831da177e4SLinus Torvalds 10841da177e4SLinus Torvalds /* 1085464cbb24SAlan Cox * The logic involved in setting the baudrate can be cleanly split into 1086464cbb24SAlan Cox * 3 steps. 10871da177e4SLinus Torvalds * 1. Standard baud rates are set in tty->termios->c_cflag 1088464cbb24SAlan Cox * 2. If these are not enough, you can set any speed using alt_speed as 1089464cbb24SAlan Cox * follows: 10901da177e4SLinus Torvalds * - set tty->termios->c_cflag speed to B38400 10911da177e4SLinus Torvalds * - set your real speed in tty->alt_speed; it gets ignored when 10921da177e4SLinus Torvalds * alt_speed==0, (or) 1093464cbb24SAlan Cox * - call TIOCSSERIAL ioctl with (struct serial_struct) set as 1094464cbb24SAlan Cox * follows: 1095464cbb24SAlan Cox * flags & ASYNC_SPD_MASK == ASYNC_SPD_[HI, VHI, SHI, WARP], 1096464cbb24SAlan Cox * this just sets alt_speed to (HI: 57600, VHI: 115200, 1097464cbb24SAlan Cox * SHI: 230400, WARP: 460800) 10981da177e4SLinus Torvalds * ** Steps 1, 2 are done courtesy of tty_get_baud_rate 10991da177e4SLinus Torvalds * 3. You can also set baud rate by setting custom divisor as follows 11001da177e4SLinus Torvalds * - set tty->termios->c_cflag speed to B38400 1101464cbb24SAlan Cox * - call TIOCSSERIAL ioctl with (struct serial_struct) set as 1102464cbb24SAlan Cox * follows: 11031da177e4SLinus Torvalds * o flags & ASYNC_SPD_MASK == ASYNC_SPD_CUST 11041da177e4SLinus Torvalds * o custom_divisor set to baud_base / your_new_baudrate 1105464cbb24SAlan Cox * ** Step 3 is done courtesy of code borrowed from serial.c 1106464cbb24SAlan Cox * I should really spend some time and separate + move this common 1107464cbb24SAlan Cox * code to serial.c, it is replicated in nearly every serial driver 1108464cbb24SAlan Cox * you see. 11091da177e4SLinus Torvalds */ 11101da177e4SLinus Torvalds 1111464cbb24SAlan Cox /* 1. Get the baud rate from the tty settings, this observes 1112464cbb24SAlan Cox alt_speed hack */ 11131da177e4SLinus Torvalds 111495da310eSAlan Cox baud = tty_get_baud_rate(tty); 1115441b62c1SHarvey Harrison dbg("%s - tty_get_baud_rate reports speed %d", __func__, baud); 11161da177e4SLinus Torvalds 1117464cbb24SAlan Cox /* 2. Observe async-compatible custom_divisor hack, update baudrate 1118464cbb24SAlan Cox if needed */ 11191da177e4SLinus Torvalds 11201da177e4SLinus Torvalds if (baud == 38400 && 11211da177e4SLinus Torvalds ((priv->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) && 11221da177e4SLinus Torvalds (priv->custom_divisor)) { 11231da177e4SLinus Torvalds baud = priv->baud_base / priv->custom_divisor; 1124464cbb24SAlan Cox dbg("%s - custom divisor %d sets baud rate to %d", 1125464cbb24SAlan Cox __func__, priv->custom_divisor, baud); 11261da177e4SLinus Torvalds } 11271da177e4SLinus Torvalds 11281da177e4SLinus Torvalds /* 3. Convert baudrate to device-specific divisor */ 11291da177e4SLinus Torvalds 1130464cbb24SAlan Cox if (!baud) 1131464cbb24SAlan Cox baud = 9600; 11321da177e4SLinus Torvalds switch (priv->chip_type) { 11331da177e4SLinus Torvalds case SIO: /* SIO chip */ 11341da177e4SLinus Torvalds switch (baud) { 11351da177e4SLinus Torvalds case 300: div_value = ftdi_sio_b300; break; 11361da177e4SLinus Torvalds case 600: div_value = ftdi_sio_b600; break; 11371da177e4SLinus Torvalds case 1200: div_value = ftdi_sio_b1200; break; 11381da177e4SLinus Torvalds case 2400: div_value = ftdi_sio_b2400; break; 11391da177e4SLinus Torvalds case 4800: div_value = ftdi_sio_b4800; break; 11401da177e4SLinus Torvalds case 9600: div_value = ftdi_sio_b9600; break; 11411da177e4SLinus Torvalds case 19200: div_value = ftdi_sio_b19200; break; 11421da177e4SLinus Torvalds case 38400: div_value = ftdi_sio_b38400; break; 11431da177e4SLinus Torvalds case 57600: div_value = ftdi_sio_b57600; break; 11441da177e4SLinus Torvalds case 115200: div_value = ftdi_sio_b115200; break; 11451da177e4SLinus Torvalds } /* baud */ 11461da177e4SLinus Torvalds if (div_value == 0) { 1147464cbb24SAlan Cox dbg("%s - Baudrate (%d) requested is not supported", 1148464cbb24SAlan Cox __func__, baud); 11491da177e4SLinus Torvalds div_value = ftdi_sio_b9600; 1150669a6db1SAlan Cox baud = 9600; 11511da177e4SLinus Torvalds div_okay = 0; 11521da177e4SLinus Torvalds } 11531da177e4SLinus Torvalds break; 11541da177e4SLinus Torvalds case FT8U232AM: /* 8U232AM chip */ 11551da177e4SLinus Torvalds if (baud <= 3000000) { 11561da177e4SLinus Torvalds div_value = ftdi_232am_baud_to_divisor(baud); 11571da177e4SLinus Torvalds } else { 1158441b62c1SHarvey Harrison dbg("%s - Baud rate too high!", __func__); 1159669a6db1SAlan Cox baud = 9600; 11601da177e4SLinus Torvalds div_value = ftdi_232am_baud_to_divisor(9600); 11611da177e4SLinus Torvalds div_okay = 0; 11621da177e4SLinus Torvalds } 11631da177e4SLinus Torvalds break; 11641da177e4SLinus Torvalds case FT232BM: /* FT232BM chip */ 11651da177e4SLinus Torvalds case FT2232C: /* FT2232C chip */ 11663b009c63SDavid Brownell case FT232RL: 11671da177e4SLinus Torvalds if (baud <= 3000000) { 1168b760dac2SMartin Geleynse __u16 product_id = le16_to_cpu( 1169b760dac2SMartin Geleynse port->serial->dev->descriptor.idProduct); 1170b760dac2SMartin Geleynse if (((FTDI_NDI_HUC_PID == product_id) || 1171b760dac2SMartin Geleynse (FTDI_NDI_SPECTRA_SCU_PID == product_id) || 1172b760dac2SMartin Geleynse (FTDI_NDI_FUTURE_2_PID == product_id) || 1173b760dac2SMartin Geleynse (FTDI_NDI_FUTURE_3_PID == product_id) || 1174b760dac2SMartin Geleynse (FTDI_NDI_AURORA_SCU_PID == product_id)) && 1175b760dac2SMartin Geleynse (baud == 19200)) { 1176b760dac2SMartin Geleynse baud = 1200000; 1177b760dac2SMartin Geleynse } 11781da177e4SLinus Torvalds div_value = ftdi_232bm_baud_to_divisor(baud); 11791da177e4SLinus Torvalds } else { 1180441b62c1SHarvey Harrison dbg("%s - Baud rate too high!", __func__); 11811da177e4SLinus Torvalds div_value = ftdi_232bm_baud_to_divisor(9600); 11821da177e4SLinus Torvalds div_okay = 0; 1183669a6db1SAlan Cox baud = 9600; 11841da177e4SLinus Torvalds } 11851da177e4SLinus Torvalds break; 1186094c2e6dSMark Adamson case FT2232H: /* FT2232H chip */ 1187094c2e6dSMark Adamson case FT4232H: /* FT4232H chip */ 1188309427b6SUwe Bonnes case FT232H: /* FT232H chip */ 11891862cdd5SIonut Nicu if ((baud <= 12000000) && (baud >= 1200)) { 1190094c2e6dSMark Adamson div_value = ftdi_2232h_baud_to_divisor(baud); 1191094c2e6dSMark Adamson } else if (baud < 1200) { 1192094c2e6dSMark Adamson div_value = ftdi_232bm_baud_to_divisor(baud); 1193094c2e6dSMark Adamson } else { 1194094c2e6dSMark Adamson dbg("%s - Baud rate too high!", __func__); 1195094c2e6dSMark Adamson div_value = ftdi_232bm_baud_to_divisor(9600); 1196094c2e6dSMark Adamson div_okay = 0; 1197094c2e6dSMark Adamson baud = 9600; 1198094c2e6dSMark Adamson } 1199094c2e6dSMark Adamson break; 12001da177e4SLinus Torvalds } /* priv->chip_type */ 12011da177e4SLinus Torvalds 12021da177e4SLinus Torvalds if (div_okay) { 12031da177e4SLinus Torvalds dbg("%s - Baud rate set to %d (divisor 0x%lX) on chip %s", 1204441b62c1SHarvey Harrison __func__, baud, (unsigned long)div_value, 12051da177e4SLinus Torvalds ftdi_chip_name[priv->chip_type]); 12061da177e4SLinus Torvalds } 12071da177e4SLinus Torvalds 120895da310eSAlan Cox tty_encode_baud_rate(tty, baud, baud); 1209464cbb24SAlan Cox return div_value; 12101da177e4SLinus Torvalds } 12111da177e4SLinus Torvalds 121295da310eSAlan Cox static int change_speed(struct tty_struct *tty, struct usb_serial_port *port) 121395da310eSAlan Cox { 121495da310eSAlan Cox struct ftdi_private *priv = usb_get_serial_port_data(port); 121595da310eSAlan Cox __u16 urb_value; 121695da310eSAlan Cox __u16 urb_index; 121795da310eSAlan Cox __u32 urb_index_value; 121895da310eSAlan Cox int rv; 121995da310eSAlan Cox 122095da310eSAlan Cox urb_index_value = get_ftdi_divisor(tty, port); 122195da310eSAlan Cox urb_value = (__u16)urb_index_value; 122295da310eSAlan Cox urb_index = (__u16)(urb_index_value >> 16); 12230ee404ccSUwe Bonnes if ((priv->chip_type == FT2232C) || (priv->chip_type == FT2232H) || 12240ee404ccSUwe Bonnes (priv->chip_type == FT4232H) || (priv->chip_type == FT232H)) { 12250ee404ccSUwe Bonnes /* Probably the BM type needs the MSB of the encoded fractional 12260ee404ccSUwe Bonnes * divider also moved like for the chips above. Any infos? */ 122795da310eSAlan Cox urb_index = (__u16)((urb_index << 8) | priv->interface); 122895da310eSAlan Cox } 122995da310eSAlan Cox 123095da310eSAlan Cox rv = usb_control_msg(port->serial->dev, 123195da310eSAlan Cox usb_sndctrlpipe(port->serial->dev, 0), 123295da310eSAlan Cox FTDI_SIO_SET_BAUDRATE_REQUEST, 123395da310eSAlan Cox FTDI_SIO_SET_BAUDRATE_REQUEST_TYPE, 123495da310eSAlan Cox urb_value, urb_index, 123566e47e60SJohan Hovold NULL, 0, WDR_SHORT_TIMEOUT); 123695da310eSAlan Cox return rv; 123795da310eSAlan Cox } 123895da310eSAlan Cox 1239557aaa7fSAlan Cox static int write_latency_timer(struct usb_serial_port *port) 1240557aaa7fSAlan Cox { 1241557aaa7fSAlan Cox struct ftdi_private *priv = usb_get_serial_port_data(port); 1242557aaa7fSAlan Cox struct usb_device *udev = port->serial->dev; 1243c1284d77SJohan Hovold int rv; 1244557aaa7fSAlan Cox int l = priv->latency; 124595da310eSAlan Cox 1246557aaa7fSAlan Cox if (priv->flags & ASYNC_LOW_LATENCY) 1247557aaa7fSAlan Cox l = 1; 1248557aaa7fSAlan Cox 1249557aaa7fSAlan Cox dbg("%s: setting latency timer = %i", __func__, l); 1250557aaa7fSAlan Cox 1251557aaa7fSAlan Cox rv = usb_control_msg(udev, 1252557aaa7fSAlan Cox usb_sndctrlpipe(udev, 0), 1253557aaa7fSAlan Cox FTDI_SIO_SET_LATENCY_TIMER_REQUEST, 1254557aaa7fSAlan Cox FTDI_SIO_SET_LATENCY_TIMER_REQUEST_TYPE, 1255557aaa7fSAlan Cox l, priv->interface, 125666e47e60SJohan Hovold NULL, 0, WDR_TIMEOUT); 1257557aaa7fSAlan Cox if (rv < 0) 1258557aaa7fSAlan Cox dev_err(&port->dev, "Unable to write latency timer: %i\n", rv); 1259557aaa7fSAlan Cox return rv; 1260557aaa7fSAlan Cox } 1261557aaa7fSAlan Cox 1262557aaa7fSAlan Cox static int read_latency_timer(struct usb_serial_port *port) 1263557aaa7fSAlan Cox { 1264557aaa7fSAlan Cox struct ftdi_private *priv = usb_get_serial_port_data(port); 1265557aaa7fSAlan Cox struct usb_device *udev = port->serial->dev; 126654f328d0SJohan Hovold unsigned char *buf; 1267c1284d77SJohan Hovold int rv; 1268557aaa7fSAlan Cox 1269557aaa7fSAlan Cox dbg("%s", __func__); 1270557aaa7fSAlan Cox 127154f328d0SJohan Hovold buf = kmalloc(1, GFP_KERNEL); 127254f328d0SJohan Hovold if (!buf) 127354f328d0SJohan Hovold return -ENOMEM; 127454f328d0SJohan Hovold 1275557aaa7fSAlan Cox rv = usb_control_msg(udev, 1276557aaa7fSAlan Cox usb_rcvctrlpipe(udev, 0), 1277557aaa7fSAlan Cox FTDI_SIO_GET_LATENCY_TIMER_REQUEST, 1278557aaa7fSAlan Cox FTDI_SIO_GET_LATENCY_TIMER_REQUEST_TYPE, 1279557aaa7fSAlan Cox 0, priv->interface, 128054f328d0SJohan Hovold buf, 1, WDR_TIMEOUT); 12814357369dSJohan Hovold if (rv < 0) 1282557aaa7fSAlan Cox dev_err(&port->dev, "Unable to read latency timer: %i\n", rv); 12834357369dSJohan Hovold else 128454f328d0SJohan Hovold priv->latency = buf[0]; 128554f328d0SJohan Hovold 128654f328d0SJohan Hovold kfree(buf); 128754f328d0SJohan Hovold 12888c4f99cdSJohan Hovold return rv; 1289557aaa7fSAlan Cox } 12901da177e4SLinus Torvalds 1291464cbb24SAlan Cox static int get_serial_info(struct usb_serial_port *port, 1292464cbb24SAlan Cox struct serial_struct __user *retinfo) 12931da177e4SLinus Torvalds { 12941da177e4SLinus Torvalds struct ftdi_private *priv = usb_get_serial_port_data(port); 12951da177e4SLinus Torvalds struct serial_struct tmp; 12961da177e4SLinus Torvalds 12971da177e4SLinus Torvalds if (!retinfo) 12981da177e4SLinus Torvalds return -EFAULT; 12991da177e4SLinus Torvalds memset(&tmp, 0, sizeof(tmp)); 13001da177e4SLinus Torvalds tmp.flags = priv->flags; 13011da177e4SLinus Torvalds tmp.baud_base = priv->baud_base; 13021da177e4SLinus Torvalds tmp.custom_divisor = priv->custom_divisor; 13031da177e4SLinus Torvalds if (copy_to_user(retinfo, &tmp, sizeof(*retinfo))) 13041da177e4SLinus Torvalds return -EFAULT; 13051da177e4SLinus Torvalds return 0; 1306e49bbce1SJohan Hovold } 13071da177e4SLinus Torvalds 130895da310eSAlan Cox static int set_serial_info(struct tty_struct *tty, 130995da310eSAlan Cox struct usb_serial_port *port, struct serial_struct __user *newinfo) 1310e49bbce1SJohan Hovold { 13111da177e4SLinus Torvalds struct ftdi_private *priv = usb_get_serial_port_data(port); 13121da177e4SLinus Torvalds struct serial_struct new_serial; 13131da177e4SLinus Torvalds struct ftdi_private old_priv; 13141da177e4SLinus Torvalds 13151da177e4SLinus Torvalds if (copy_from_user(&new_serial, newinfo, sizeof(new_serial))) 13161da177e4SLinus Torvalds return -EFAULT; 13176b447f04SAlan Cox 1318bd09a9f5SAlessio Igor Bogani mutex_lock(&priv->cfg_lock); 13191da177e4SLinus Torvalds old_priv = *priv; 13201da177e4SLinus Torvalds 13211da177e4SLinus Torvalds /* Do error checking and permission checking */ 13221da177e4SLinus Torvalds 13231da177e4SLinus Torvalds if (!capable(CAP_SYS_ADMIN)) { 13241da177e4SLinus Torvalds if (((new_serial.flags & ~ASYNC_USR_MASK) != 132564905b48SDan Carpenter (priv->flags & ~ASYNC_USR_MASK))) { 1326bd09a9f5SAlessio Igor Bogani mutex_unlock(&priv->cfg_lock); 13271da177e4SLinus Torvalds return -EPERM; 132864905b48SDan Carpenter } 13291da177e4SLinus Torvalds priv->flags = ((priv->flags & ~ASYNC_USR_MASK) | 13301da177e4SLinus Torvalds (new_serial.flags & ASYNC_USR_MASK)); 13311da177e4SLinus Torvalds priv->custom_divisor = new_serial.custom_divisor; 13321da177e4SLinus Torvalds goto check_and_exit; 13331da177e4SLinus Torvalds } 13341da177e4SLinus Torvalds 13351da177e4SLinus Torvalds if ((new_serial.baud_base != priv->baud_base) && 13366b447f04SAlan Cox (new_serial.baud_base < 9600)) { 1337bd09a9f5SAlessio Igor Bogani mutex_unlock(&priv->cfg_lock); 13381da177e4SLinus Torvalds return -EINVAL; 13396b447f04SAlan Cox } 13401da177e4SLinus Torvalds 13411da177e4SLinus Torvalds /* Make the changes - these are privileged changes! */ 13421da177e4SLinus Torvalds 13431da177e4SLinus Torvalds priv->flags = ((priv->flags & ~ASYNC_FLAGS) | 13441da177e4SLinus Torvalds (new_serial.flags & ASYNC_FLAGS)); 13451da177e4SLinus Torvalds priv->custom_divisor = new_serial.custom_divisor; 13461da177e4SLinus Torvalds 1347557aaa7fSAlan Cox write_latency_timer(port); 13481da177e4SLinus Torvalds 13491da177e4SLinus Torvalds check_and_exit: 13501da177e4SLinus Torvalds if ((old_priv.flags & ASYNC_SPD_MASK) != 13511da177e4SLinus Torvalds (priv->flags & ASYNC_SPD_MASK)) { 13521da177e4SLinus Torvalds if ((priv->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) 135395da310eSAlan Cox tty->alt_speed = 57600; 13541da177e4SLinus Torvalds else if ((priv->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) 135595da310eSAlan Cox tty->alt_speed = 115200; 13561da177e4SLinus Torvalds else if ((priv->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) 135795da310eSAlan Cox tty->alt_speed = 230400; 13581da177e4SLinus Torvalds else if ((priv->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) 135995da310eSAlan Cox tty->alt_speed = 460800; 13601da177e4SLinus Torvalds else 136195da310eSAlan Cox tty->alt_speed = 0; 13621da177e4SLinus Torvalds } 13631da177e4SLinus Torvalds if (((old_priv.flags & ASYNC_SPD_MASK) != 13641da177e4SLinus Torvalds (priv->flags & ASYNC_SPD_MASK)) || 13651da177e4SLinus Torvalds (((priv->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) && 13661da177e4SLinus Torvalds (old_priv.custom_divisor != priv->custom_divisor))) { 136795da310eSAlan Cox change_speed(tty, port); 13689c67d28eSAlessio Igor Bogani mutex_unlock(&priv->cfg_lock); 13691da177e4SLinus Torvalds } 13706b447f04SAlan Cox else 1371bd09a9f5SAlessio Igor Bogani mutex_unlock(&priv->cfg_lock); 137295da310eSAlan Cox return 0; 1373e49bbce1SJohan Hovold } 13741da177e4SLinus Torvalds 1375c466cd2bSGreg Kroah-Hartman static int get_lsr_info(struct usb_serial_port *port, 1376c466cd2bSGreg Kroah-Hartman struct serial_struct __user *retinfo) 1377c466cd2bSGreg Kroah-Hartman { 1378c466cd2bSGreg Kroah-Hartman struct ftdi_private *priv = usb_get_serial_port_data(port); 1379c466cd2bSGreg Kroah-Hartman unsigned int result = 0; 1380c466cd2bSGreg Kroah-Hartman 1381c466cd2bSGreg Kroah-Hartman if (!retinfo) 1382c466cd2bSGreg Kroah-Hartman return -EFAULT; 1383c466cd2bSGreg Kroah-Hartman 1384c466cd2bSGreg Kroah-Hartman if (priv->transmit_empty) 1385c466cd2bSGreg Kroah-Hartman result = TIOCSER_TEMT; 1386c466cd2bSGreg Kroah-Hartman 1387c466cd2bSGreg Kroah-Hartman if (copy_to_user(retinfo, &result, sizeof(unsigned int))) 1388c466cd2bSGreg Kroah-Hartman return -EFAULT; 1389c466cd2bSGreg Kroah-Hartman return 0; 1390c466cd2bSGreg Kroah-Hartman } 1391c466cd2bSGreg Kroah-Hartman 13921da177e4SLinus Torvalds 13938f977e42SIan Abbott /* Determine type of FTDI chip based on USB config and descriptor. */ 13948f977e42SIan Abbott static void ftdi_determine_type(struct usb_serial_port *port) 13958f977e42SIan Abbott { 13968f977e42SIan Abbott struct ftdi_private *priv = usb_get_serial_port_data(port); 13978f977e42SIan Abbott struct usb_serial *serial = port->serial; 13988f977e42SIan Abbott struct usb_device *udev = serial->dev; 13998f977e42SIan Abbott unsigned version; 14008f977e42SIan Abbott unsigned interfaces; 14018f977e42SIan Abbott 14028f977e42SIan Abbott /* Assume it is not the original SIO device for now. */ 1403f5e09b7cSIan Abbott priv->baud_base = 48000000 / 2; 14048f977e42SIan Abbott 14058f977e42SIan Abbott version = le16_to_cpu(udev->descriptor.bcdDevice); 14068f977e42SIan Abbott interfaces = udev->actconfig->desc.bNumInterfaces; 1407441b62c1SHarvey Harrison dbg("%s: bcdDevice = 0x%x, bNumInterfaces = %u", __func__, 14088f977e42SIan Abbott version, interfaces); 14098f977e42SIan Abbott if (interfaces > 1) { 14108f977e42SIan Abbott int inter; 14118f977e42SIan Abbott 1412094c2e6dSMark Adamson /* Multiple interfaces.*/ 1413094c2e6dSMark Adamson if (version == 0x0800) { 1414094c2e6dSMark Adamson priv->chip_type = FT4232H; 1415094c2e6dSMark Adamson /* Hi-speed - baud clock runs at 120MHz */ 1416094c2e6dSMark Adamson priv->baud_base = 120000000 / 2; 1417094c2e6dSMark Adamson } else if (version == 0x0700) { 1418094c2e6dSMark Adamson priv->chip_type = FT2232H; 1419094c2e6dSMark Adamson /* Hi-speed - baud clock runs at 120MHz */ 1420094c2e6dSMark Adamson priv->baud_base = 120000000 / 2; 1421094c2e6dSMark Adamson } else 14228f977e42SIan Abbott priv->chip_type = FT2232C; 1423094c2e6dSMark Adamson 14248f977e42SIan Abbott /* Determine interface code. */ 14258f977e42SIan Abbott inter = serial->interface->altsetting->desc.bInterfaceNumber; 1426094c2e6dSMark Adamson if (inter == 0) { 1427094c2e6dSMark Adamson priv->interface = INTERFACE_A; 1428094c2e6dSMark Adamson } else if (inter == 1) { 1429094c2e6dSMark Adamson priv->interface = INTERFACE_B; 1430094c2e6dSMark Adamson } else if (inter == 2) { 1431094c2e6dSMark Adamson priv->interface = INTERFACE_C; 1432094c2e6dSMark Adamson } else if (inter == 3) { 1433094c2e6dSMark Adamson priv->interface = INTERFACE_D; 1434094c2e6dSMark Adamson } 14358f977e42SIan Abbott /* BM-type devices have a bug where bcdDevice gets set 14368f977e42SIan Abbott * to 0x200 when iSerialNumber is 0. */ 14378f977e42SIan Abbott if (version < 0x500) { 14388f977e42SIan Abbott dbg("%s: something fishy - bcdDevice too low for multi-interface device", 1439441b62c1SHarvey Harrison __func__); 14408f977e42SIan Abbott } 14418f977e42SIan Abbott } else if (version < 0x200) { 1442330e3c4cSAndreas Mohr /* Old device. Assume it's the original SIO. */ 14438f977e42SIan Abbott priv->chip_type = SIO; 14448f977e42SIan Abbott priv->baud_base = 12000000 / 16; 14458f977e42SIan Abbott } else if (version < 0x400) { 1446330e3c4cSAndreas Mohr /* Assume it's an FT8U232AM (or FT8U245AM) */ 14478f977e42SIan Abbott /* (It might be a BM because of the iSerialNumber bug, 14488f977e42SIan Abbott * but it will still work as an AM device.) */ 14498f977e42SIan Abbott priv->chip_type = FT8U232AM; 14503b009c63SDavid Brownell } else if (version < 0x600) { 1451330e3c4cSAndreas Mohr /* Assume it's an FT232BM (or FT245BM) */ 14528f977e42SIan Abbott priv->chip_type = FT232BM; 1453309427b6SUwe Bonnes } else if (version < 0x900) { 1454309427b6SUwe Bonnes /* Assume it's an FT232RL */ 14553b009c63SDavid Brownell priv->chip_type = FT232RL; 1456309427b6SUwe Bonnes } else { 1457309427b6SUwe Bonnes /* Assume it's an FT232H */ 1458309427b6SUwe Bonnes priv->chip_type = FT232H; 14598f977e42SIan Abbott } 1460c197a8dbSGreg Kroah-Hartman dev_info(&udev->dev, "Detected %s\n", ftdi_chip_name[priv->chip_type]); 14618f977e42SIan Abbott } 14628f977e42SIan Abbott 14638f977e42SIan Abbott 1464895f28baSMark Adamson /* Determine the maximum packet size for the device. This depends on the chip 1465895f28baSMark Adamson * type and the USB host capabilities. The value should be obtained from the 1466895f28baSMark Adamson * device descriptor as the chip will use the appropriate values for the host.*/ 1467895f28baSMark Adamson static void ftdi_set_max_packet_size(struct usb_serial_port *port) 1468895f28baSMark Adamson { 1469895f28baSMark Adamson struct ftdi_private *priv = usb_get_serial_port_data(port); 1470895f28baSMark Adamson struct usb_serial *serial = port->serial; 1471895f28baSMark Adamson struct usb_device *udev = serial->dev; 1472895f28baSMark Adamson 1473895f28baSMark Adamson struct usb_interface *interface = serial->interface; 1474895f28baSMark Adamson struct usb_endpoint_descriptor *ep_desc = &interface->cur_altsetting->endpoint[1].desc; 1475895f28baSMark Adamson 1476895f28baSMark Adamson unsigned num_endpoints; 1477c1284d77SJohan Hovold int i; 1478895f28baSMark Adamson 1479895f28baSMark Adamson num_endpoints = interface->cur_altsetting->desc.bNumEndpoints; 1480895f28baSMark Adamson dev_info(&udev->dev, "Number of endpoints %d\n", num_endpoints); 1481895f28baSMark Adamson 1482895f28baSMark Adamson /* NOTE: some customers have programmed FT232R/FT245R devices 1483895f28baSMark Adamson * with an endpoint size of 0 - not good. In this case, we 1484895f28baSMark Adamson * want to override the endpoint descriptor setting and use a 1485895f28baSMark Adamson * value of 64 for wMaxPacketSize */ 1486895f28baSMark Adamson for (i = 0; i < num_endpoints; i++) { 1487895f28baSMark Adamson dev_info(&udev->dev, "Endpoint %d MaxPacketSize %d\n", i+1, 1488895f28baSMark Adamson interface->cur_altsetting->endpoint[i].desc.wMaxPacketSize); 1489895f28baSMark Adamson ep_desc = &interface->cur_altsetting->endpoint[i].desc; 1490895f28baSMark Adamson if (ep_desc->wMaxPacketSize == 0) { 1491895f28baSMark Adamson ep_desc->wMaxPacketSize = cpu_to_le16(0x40); 1492895f28baSMark Adamson dev_info(&udev->dev, "Overriding wMaxPacketSize on endpoint %d\n", i); 1493895f28baSMark Adamson } 1494895f28baSMark Adamson } 1495895f28baSMark Adamson 1496895f28baSMark Adamson /* set max packet size based on descriptor */ 149729cc8897SKuninori Morimoto priv->max_packet_size = usb_endpoint_maxp(ep_desc); 1498895f28baSMark Adamson 1499895f28baSMark Adamson dev_info(&udev->dev, "Setting MaxPacketSize %d\n", priv->max_packet_size); 1500895f28baSMark Adamson } 1501895f28baSMark Adamson 1502895f28baSMark Adamson 15031da177e4SLinus Torvalds /* 15041da177e4SLinus Torvalds * *************************************************************************** 15051da177e4SLinus Torvalds * Sysfs Attribute 15061da177e4SLinus Torvalds * *************************************************************************** 15071da177e4SLinus Torvalds */ 15081da177e4SLinus Torvalds 1509464cbb24SAlan Cox static ssize_t show_latency_timer(struct device *dev, 1510464cbb24SAlan Cox struct device_attribute *attr, char *buf) 15111da177e4SLinus Torvalds { 15121da177e4SLinus Torvalds struct usb_serial_port *port = to_usb_serial_port(dev); 15131da177e4SLinus Torvalds struct ftdi_private *priv = usb_get_serial_port_data(port); 1514557aaa7fSAlan Cox if (priv->flags & ASYNC_LOW_LATENCY) 1515557aaa7fSAlan Cox return sprintf(buf, "1\n"); 1516557aaa7fSAlan Cox else 1517557aaa7fSAlan Cox return sprintf(buf, "%i\n", priv->latency); 15181da177e4SLinus Torvalds } 1519557aaa7fSAlan Cox 15201da177e4SLinus Torvalds 15211da177e4SLinus Torvalds /* Write a new value of the latency timer, in units of milliseconds. */ 1522464cbb24SAlan Cox static ssize_t store_latency_timer(struct device *dev, 1523464cbb24SAlan Cox struct device_attribute *attr, const char *valbuf, 15241da177e4SLinus Torvalds size_t count) 15251da177e4SLinus Torvalds { 15261da177e4SLinus Torvalds struct usb_serial_port *port = to_usb_serial_port(dev); 15271da177e4SLinus Torvalds struct ftdi_private *priv = usb_get_serial_port_data(port); 15281da177e4SLinus Torvalds int v = simple_strtoul(valbuf, NULL, 10); 1529c1284d77SJohan Hovold int rv; 15301da177e4SLinus Torvalds 1531557aaa7fSAlan Cox priv->latency = v; 1532557aaa7fSAlan Cox rv = write_latency_timer(port); 1533557aaa7fSAlan Cox if (rv < 0) 15341da177e4SLinus Torvalds return -EIO; 15351da177e4SLinus Torvalds return count; 15361da177e4SLinus Torvalds } 15371da177e4SLinus Torvalds 15381da177e4SLinus Torvalds /* Write an event character directly to the FTDI register. The ASCII 15391da177e4SLinus Torvalds value is in the low 8 bits, with the enable bit in the 9th bit. */ 1540464cbb24SAlan Cox static ssize_t store_event_char(struct device *dev, 1541464cbb24SAlan Cox struct device_attribute *attr, const char *valbuf, size_t count) 15421da177e4SLinus Torvalds { 15431da177e4SLinus Torvalds struct usb_serial_port *port = to_usb_serial_port(dev); 15441da177e4SLinus Torvalds struct ftdi_private *priv = usb_get_serial_port_data(port); 154512bdbe03SJim Radford struct usb_device *udev = port->serial->dev; 15461da177e4SLinus Torvalds int v = simple_strtoul(valbuf, NULL, 10); 1547c1284d77SJohan Hovold int rv; 15481da177e4SLinus Torvalds 1549441b62c1SHarvey Harrison dbg("%s: setting event char = %i", __func__, v); 15501da177e4SLinus Torvalds 15511da177e4SLinus Torvalds rv = usb_control_msg(udev, 15521da177e4SLinus Torvalds usb_sndctrlpipe(udev, 0), 15531da177e4SLinus Torvalds FTDI_SIO_SET_EVENT_CHAR_REQUEST, 15541da177e4SLinus Torvalds FTDI_SIO_SET_EVENT_CHAR_REQUEST_TYPE, 15551da177e4SLinus Torvalds v, priv->interface, 155666e47e60SJohan Hovold NULL, 0, WDR_TIMEOUT); 15571da177e4SLinus Torvalds if (rv < 0) { 15581da177e4SLinus Torvalds dbg("Unable to write event character: %i", rv); 15591da177e4SLinus Torvalds return -EIO; 15601da177e4SLinus Torvalds } 15611da177e4SLinus Torvalds 15621da177e4SLinus Torvalds return count; 15631da177e4SLinus Torvalds } 15641da177e4SLinus Torvalds 1565464cbb24SAlan Cox static DEVICE_ATTR(latency_timer, S_IWUSR | S_IRUGO, show_latency_timer, 1566464cbb24SAlan Cox store_latency_timer); 15671da177e4SLinus Torvalds static DEVICE_ATTR(event_char, S_IWUSR, NULL, store_event_char); 15681da177e4SLinus Torvalds 156912bdbe03SJim Radford static int create_sysfs_attrs(struct usb_serial_port *port) 15701da177e4SLinus Torvalds { 157112bdbe03SJim Radford struct ftdi_private *priv = usb_get_serial_port_data(port); 157213f4db9eSGreg Kroah-Hartman int retval = 0; 15731da177e4SLinus Torvalds 1574441b62c1SHarvey Harrison dbg("%s", __func__); 15751da177e4SLinus Torvalds 15761da177e4SLinus Torvalds /* XXX I've no idea if the original SIO supports the event_char 15771da177e4SLinus Torvalds * sysfs parameter, so I'm playing it safe. */ 15781da177e4SLinus Torvalds if (priv->chip_type != SIO) { 15791da177e4SLinus Torvalds dbg("sysfs attributes for %s", ftdi_chip_name[priv->chip_type]); 158012bdbe03SJim Radford retval = device_create_file(&port->dev, &dev_attr_event_char); 158113f4db9eSGreg Kroah-Hartman if ((!retval) && 158297cd49ebSStepan Moskovchenko (priv->chip_type == FT232BM || 158397cd49ebSStepan Moskovchenko priv->chip_type == FT2232C || 1584094c2e6dSMark Adamson priv->chip_type == FT232RL || 1585094c2e6dSMark Adamson priv->chip_type == FT2232H || 1586309427b6SUwe Bonnes priv->chip_type == FT4232H || 1587309427b6SUwe Bonnes priv->chip_type == FT232H)) { 158812bdbe03SJim Radford retval = device_create_file(&port->dev, 158913f4db9eSGreg Kroah-Hartman &dev_attr_latency_timer); 15901da177e4SLinus Torvalds } 15911da177e4SLinus Torvalds } 159213f4db9eSGreg Kroah-Hartman return retval; 15931da177e4SLinus Torvalds } 15941da177e4SLinus Torvalds 159512bdbe03SJim Radford static void remove_sysfs_attrs(struct usb_serial_port *port) 15961da177e4SLinus Torvalds { 159712bdbe03SJim Radford struct ftdi_private *priv = usb_get_serial_port_data(port); 15981da177e4SLinus Torvalds 1599441b62c1SHarvey Harrison dbg("%s", __func__); 16001da177e4SLinus Torvalds 16011da177e4SLinus Torvalds /* XXX see create_sysfs_attrs */ 16021da177e4SLinus Torvalds if (priv->chip_type != SIO) { 160312bdbe03SJim Radford device_remove_file(&port->dev, &dev_attr_event_char); 1604ed6e5282SAndrew M. Bishop if (priv->chip_type == FT232BM || 1605ed6e5282SAndrew M. Bishop priv->chip_type == FT2232C || 1606094c2e6dSMark Adamson priv->chip_type == FT232RL || 1607094c2e6dSMark Adamson priv->chip_type == FT2232H || 1608309427b6SUwe Bonnes priv->chip_type == FT4232H || 1609309427b6SUwe Bonnes priv->chip_type == FT232H) { 161012bdbe03SJim Radford device_remove_file(&port->dev, &dev_attr_latency_timer); 16111da177e4SLinus Torvalds } 16121da177e4SLinus Torvalds } 16131da177e4SLinus Torvalds 16141da177e4SLinus Torvalds } 16151da177e4SLinus Torvalds 16161da177e4SLinus Torvalds /* 16171da177e4SLinus Torvalds * *************************************************************************** 16181da177e4SLinus Torvalds * FTDI driver specific functions 16191da177e4SLinus Torvalds * *************************************************************************** 16201da177e4SLinus Torvalds */ 16211da177e4SLinus Torvalds 16228f977e42SIan Abbott /* Probe function to check for special devices */ 1623464cbb24SAlan Cox static int ftdi_sio_probe(struct usb_serial *serial, 1624464cbb24SAlan Cox const struct usb_device_id *id) 16258f977e42SIan Abbott { 1626464cbb24SAlan Cox struct ftdi_sio_quirk *quirk = 1627464cbb24SAlan Cox (struct ftdi_sio_quirk *)id->driver_info; 1628fa91d43bSTony Lindgren 1629fa91d43bSTony Lindgren if (quirk && quirk->probe) { 1630fa91d43bSTony Lindgren int ret = quirk->probe(serial); 1631fa91d43bSTony Lindgren if (ret != 0) 1632fa91d43bSTony Lindgren return ret; 1633fa91d43bSTony Lindgren } 1634fa91d43bSTony Lindgren 16358f977e42SIan Abbott usb_set_serial_data(serial, (void *)id->driver_info); 16368f977e42SIan Abbott 1637fa91d43bSTony Lindgren return 0; 16388f977e42SIan Abbott } 16398f977e42SIan Abbott 164012bdbe03SJim Radford static int ftdi_sio_port_probe(struct usb_serial_port *port) 16411da177e4SLinus Torvalds { 16421da177e4SLinus Torvalds struct ftdi_private *priv; 16430ffbbe25SOliver Neukum struct ftdi_sio_quirk *quirk = usb_get_serial_data(port->serial); 16440ffbbe25SOliver Neukum 16451da177e4SLinus Torvalds 1646441b62c1SHarvey Harrison dbg("%s", __func__); 16471da177e4SLinus Torvalds 164880b6ca48SEric Sesterhenn priv = kzalloc(sizeof(struct ftdi_private), GFP_KERNEL); 16491da177e4SLinus Torvalds if (!priv) { 1650194343d9SGreg Kroah-Hartman dev_err(&port->dev, "%s- kmalloc(%Zd) failed.\n", __func__, 1651464cbb24SAlan Cox sizeof(struct ftdi_private)); 16521da177e4SLinus Torvalds return -ENOMEM; 16531da177e4SLinus Torvalds } 16541da177e4SLinus Torvalds 1655c45d6320SAlan Stern kref_init(&priv->kref); 1656bd09a9f5SAlessio Igor Bogani mutex_init(&priv->cfg_lock); 1657c75ccd48SUwe Bonnes memset(&priv->icount, 0x00, sizeof(priv->icount)); 16581da177e4SLinus Torvalds init_waitqueue_head(&priv->delta_msr_wait); 16590076b4beSJohan Hovold 16601da177e4SLinus Torvalds priv->flags = ASYNC_LOW_LATENCY; 16611da177e4SLinus Torvalds 16620ffbbe25SOliver Neukum if (quirk && quirk->port_probe) 16630ffbbe25SOliver Neukum quirk->port_probe(priv); 16640ffbbe25SOliver Neukum 1665c4028958SDavid Howells priv->port = port; 166612bdbe03SJim Radford usb_set_serial_port_data(port, priv); 16671da177e4SLinus Torvalds 166812bdbe03SJim Radford ftdi_determine_type(port); 1669895f28baSMark Adamson ftdi_set_max_packet_size(port); 16708c4f99cdSJohan Hovold if (read_latency_timer(port) < 0) 16718c4f99cdSJohan Hovold priv->latency = 16; 1672c19db4c9SJohan Hovold write_latency_timer(port); 167312bdbe03SJim Radford create_sysfs_attrs(port); 167412bdbe03SJim Radford return 0; 16751da177e4SLinus Torvalds } 16761da177e4SLinus Torvalds 16778f977e42SIan Abbott /* Setup for the USB-UIRT device, which requires hardwired 16788f977e42SIan Abbott * baudrate (38400 gets mapped to 312500) */ 16791da177e4SLinus Torvalds /* Called from usbserial:serial_probe */ 16800ffbbe25SOliver Neukum static void ftdi_USB_UIRT_setup(struct ftdi_private *priv) 16811da177e4SLinus Torvalds { 1682441b62c1SHarvey Harrison dbg("%s", __func__); 16831da177e4SLinus Torvalds 16841da177e4SLinus Torvalds priv->flags |= ASYNC_SPD_CUST; 16851da177e4SLinus Torvalds priv->custom_divisor = 77; 1686669a6db1SAlan Cox priv->force_baud = 38400; 1687e49bbce1SJohan Hovold } 16881da177e4SLinus Torvalds 16898f977e42SIan Abbott /* Setup for the HE-TIRA1 device, which requires hardwired 16908f977e42SIan Abbott * baudrate (38400 gets mapped to 100000) and RTS-CTS enabled. */ 1691464cbb24SAlan Cox 16920ffbbe25SOliver Neukum static void ftdi_HE_TIRA1_setup(struct ftdi_private *priv) 16938f977e42SIan Abbott { 1694441b62c1SHarvey Harrison dbg("%s", __func__); 16951da177e4SLinus Torvalds 16961da177e4SLinus Torvalds priv->flags |= ASYNC_SPD_CUST; 16971da177e4SLinus Torvalds priv->custom_divisor = 240; 1698669a6db1SAlan Cox priv->force_baud = 38400; 16991da177e4SLinus Torvalds priv->force_rtscts = 1; 1700e49bbce1SJohan Hovold } 17011da177e4SLinus Torvalds 1702fa91d43bSTony Lindgren /* 1703b760dac2SMartin Geleynse * Module parameter to control latency timer for NDI FTDI-based USB devices. 1704b760dac2SMartin Geleynse * If this value is not set in modprobe.conf.local its value will be set to 1ms. 1705b760dac2SMartin Geleynse */ 1706b760dac2SMartin Geleynse static int ndi_latency_timer = 1; 1707b760dac2SMartin Geleynse 1708b760dac2SMartin Geleynse /* Setup for the NDI FTDI-based USB devices, which requires hardwired 1709b760dac2SMartin Geleynse * baudrate (19200 gets mapped to 1200000). 1710b760dac2SMartin Geleynse * 1711b760dac2SMartin Geleynse * Called from usbserial:serial_probe. 1712b760dac2SMartin Geleynse */ 1713b760dac2SMartin Geleynse static int ftdi_NDI_device_setup(struct usb_serial *serial) 1714b760dac2SMartin Geleynse { 1715b760dac2SMartin Geleynse struct usb_device *udev = serial->dev; 1716b760dac2SMartin Geleynse int latency = ndi_latency_timer; 1717b760dac2SMartin Geleynse 1718b760dac2SMartin Geleynse if (latency == 0) 1719b760dac2SMartin Geleynse latency = 1; 1720b760dac2SMartin Geleynse if (latency > 99) 1721b760dac2SMartin Geleynse latency = 99; 1722b760dac2SMartin Geleynse 1723b760dac2SMartin Geleynse dbg("%s setting NDI device latency to %d", __func__, latency); 1724b760dac2SMartin Geleynse dev_info(&udev->dev, "NDI device with a latency value of %d", latency); 1725b760dac2SMartin Geleynse 1726c1284d77SJohan Hovold /* FIXME: errors are not returned */ 1727c1284d77SJohan Hovold usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 1728b760dac2SMartin Geleynse FTDI_SIO_SET_LATENCY_TIMER_REQUEST, 1729b760dac2SMartin Geleynse FTDI_SIO_SET_LATENCY_TIMER_REQUEST_TYPE, 173066e47e60SJohan Hovold latency, 0, NULL, 0, WDR_TIMEOUT); 1731b760dac2SMartin Geleynse return 0; 1732b760dac2SMartin Geleynse } 1733b760dac2SMartin Geleynse 1734b760dac2SMartin Geleynse /* 173520734345SHarald Welte * First port on JTAG adaptors such as Olimex arm-usb-ocd or the FIC/OpenMoko 173620734345SHarald Welte * Neo1973 Debug Board is reserved for JTAG interface and can be accessed from 173720734345SHarald Welte * userspace using openocd. 1738fa91d43bSTony Lindgren */ 173920734345SHarald Welte static int ftdi_jtag_probe(struct usb_serial *serial) 1740fa91d43bSTony Lindgren { 1741fa91d43bSTony Lindgren struct usb_device *udev = serial->dev; 1742fa91d43bSTony Lindgren struct usb_interface *interface = serial->interface; 1743fa91d43bSTony Lindgren 1744441b62c1SHarvey Harrison dbg("%s", __func__); 1745fa91d43bSTony Lindgren 1746fa91d43bSTony Lindgren if (interface == udev->actconfig->interface[0]) { 1747c197a8dbSGreg Kroah-Hartman dev_info(&udev->dev, 1748c197a8dbSGreg Kroah-Hartman "Ignoring serial port reserved for JTAG\n"); 1749fa91d43bSTony Lindgren return -ENODEV; 1750fa91d43bSTony Lindgren } 1751fa91d43bSTony Lindgren 1752fa91d43bSTony Lindgren return 0; 1753fa91d43bSTony Lindgren } 17541da177e4SLinus Torvalds 1755c96fbdd0SJean-Christophe PLAGNIOL-VILLARD static int ftdi_8u2232c_probe(struct usb_serial *serial) 1756c96fbdd0SJean-Christophe PLAGNIOL-VILLARD { 1757c96fbdd0SJean-Christophe PLAGNIOL-VILLARD struct usb_device *udev = serial->dev; 1758c96fbdd0SJean-Christophe PLAGNIOL-VILLARD 1759c96fbdd0SJean-Christophe PLAGNIOL-VILLARD dbg("%s", __func__); 1760c96fbdd0SJean-Christophe PLAGNIOL-VILLARD 1761c96fbdd0SJean-Christophe PLAGNIOL-VILLARD if (strcmp(udev->manufacturer, "CALAO Systems") == 0) 1762c96fbdd0SJean-Christophe PLAGNIOL-VILLARD return ftdi_jtag_probe(serial); 1763c96fbdd0SJean-Christophe PLAGNIOL-VILLARD 1764c96fbdd0SJean-Christophe PLAGNIOL-VILLARD return 0; 1765c96fbdd0SJean-Christophe PLAGNIOL-VILLARD } 1766c96fbdd0SJean-Christophe PLAGNIOL-VILLARD 1767546d7eecSKevin Vance /* 17686ec2f46cSJean-Christophe PLAGNIOL-VILLARD * First and second port on STMCLiteadaptors is reserved for JTAG interface 17696ec2f46cSJean-Christophe PLAGNIOL-VILLARD * and the forth port for pio 17706ec2f46cSJean-Christophe PLAGNIOL-VILLARD */ 17716ec2f46cSJean-Christophe PLAGNIOL-VILLARD static int ftdi_stmclite_probe(struct usb_serial *serial) 17726ec2f46cSJean-Christophe PLAGNIOL-VILLARD { 17736ec2f46cSJean-Christophe PLAGNIOL-VILLARD struct usb_device *udev = serial->dev; 17746ec2f46cSJean-Christophe PLAGNIOL-VILLARD struct usb_interface *interface = serial->interface; 17756ec2f46cSJean-Christophe PLAGNIOL-VILLARD 17766ec2f46cSJean-Christophe PLAGNIOL-VILLARD dbg("%s", __func__); 17776ec2f46cSJean-Christophe PLAGNIOL-VILLARD 17786ec2f46cSJean-Christophe PLAGNIOL-VILLARD if (interface == udev->actconfig->interface[2]) 17796ec2f46cSJean-Christophe PLAGNIOL-VILLARD return 0; 17806ec2f46cSJean-Christophe PLAGNIOL-VILLARD 17816ec2f46cSJean-Christophe PLAGNIOL-VILLARD dev_info(&udev->dev, "Ignoring serial port reserved for JTAG\n"); 17826ec2f46cSJean-Christophe PLAGNIOL-VILLARD 17836ec2f46cSJean-Christophe PLAGNIOL-VILLARD return -ENODEV; 17846ec2f46cSJean-Christophe PLAGNIOL-VILLARD } 17856ec2f46cSJean-Christophe PLAGNIOL-VILLARD 17866ec2f46cSJean-Christophe PLAGNIOL-VILLARD /* 1787546d7eecSKevin Vance * The Matrix Orbital VK204-25-USB has an invalid IN endpoint. 1788546d7eecSKevin Vance * We have to correct it if we want to read from it. 1789546d7eecSKevin Vance */ 1790546d7eecSKevin Vance static int ftdi_mtxorb_hack_setup(struct usb_serial *serial) 1791546d7eecSKevin Vance { 1792546d7eecSKevin Vance struct usb_host_endpoint *ep = serial->dev->ep_in[1]; 1793546d7eecSKevin Vance struct usb_endpoint_descriptor *ep_desc = &ep->desc; 1794546d7eecSKevin Vance 1795546d7eecSKevin Vance if (ep->enabled && ep_desc->wMaxPacketSize == 0) { 1796fd05e720SAl Viro ep_desc->wMaxPacketSize = cpu_to_le16(0x40); 1797c197a8dbSGreg Kroah-Hartman dev_info(&serial->dev->dev, 1798c197a8dbSGreg Kroah-Hartman "Fixing invalid wMaxPacketSize on read pipe\n"); 1799546d7eecSKevin Vance } 1800546d7eecSKevin Vance 1801546d7eecSKevin Vance return 0; 1802546d7eecSKevin Vance } 1803546d7eecSKevin Vance 1804c45d6320SAlan Stern static void ftdi_sio_priv_release(struct kref *k) 1805c45d6320SAlan Stern { 1806c45d6320SAlan Stern struct ftdi_private *priv = container_of(k, struct ftdi_private, kref); 1807c45d6320SAlan Stern 1808c45d6320SAlan Stern kfree(priv); 1809c45d6320SAlan Stern } 1810c45d6320SAlan Stern 181112bdbe03SJim Radford static int ftdi_sio_port_remove(struct usb_serial_port *port) 181212bdbe03SJim Radford { 18131da177e4SLinus Torvalds struct ftdi_private *priv = usb_get_serial_port_data(port); 18141da177e4SLinus Torvalds 1815441b62c1SHarvey Harrison dbg("%s", __func__); 18161da177e4SLinus Torvalds 181712bdbe03SJim Radford remove_sysfs_attrs(port); 18181da177e4SLinus Torvalds 1819c45d6320SAlan Stern kref_put(&priv->kref, ftdi_sio_priv_release); 18201da177e4SLinus Torvalds 182112bdbe03SJim Radford return 0; 182212bdbe03SJim Radford } 18231da177e4SLinus Torvalds 1824a509a7e4SAlan Cox static int ftdi_open(struct tty_struct *tty, struct usb_serial_port *port) 1825e49bbce1SJohan Hovold { 18261da177e4SLinus Torvalds struct usb_device *dev = port->serial->dev; 18271da177e4SLinus Torvalds struct ftdi_private *priv = usb_get_serial_port_data(port); 1828c1284d77SJohan Hovold int result; 18291da177e4SLinus Torvalds 1830441b62c1SHarvey Harrison dbg("%s", __func__); 18311da177e4SLinus Torvalds 18321da177e4SLinus Torvalds /* No error checking for this (will get errors later anyway) */ 18331da177e4SLinus Torvalds /* See ftdi_sio.h for description of what is reset */ 18341da177e4SLinus Torvalds usb_control_msg(dev, usb_sndctrlpipe(dev, 0), 18351da177e4SLinus Torvalds FTDI_SIO_RESET_REQUEST, FTDI_SIO_RESET_REQUEST_TYPE, 18361da177e4SLinus Torvalds FTDI_SIO_RESET_SIO, 183766e47e60SJohan Hovold priv->interface, NULL, 0, WDR_TIMEOUT); 18381da177e4SLinus Torvalds 18391da177e4SLinus Torvalds /* Termios defaults are set by usb_serial_init. We don't change 1840c4f01240SNick Andrew port->tty->termios - this would lose speed settings, etc. 18411da177e4SLinus Torvalds This is same behaviour as serial.c/rs_open() - Kuba */ 18421da177e4SLinus Torvalds 18431da177e4SLinus Torvalds /* ftdi_set_termios will send usb control messages */ 184495da310eSAlan Cox if (tty) 184595da310eSAlan Cox ftdi_set_termios(tty, port, tty->termios); 18461da177e4SLinus Torvalds 18471da177e4SLinus Torvalds /* Start reading from the device */ 18481b551015SJohan Hovold result = usb_serial_generic_open(tty, port); 1849cc01f17dSJohan Hovold if (!result) 1850c45d6320SAlan Stern kref_get(&priv->kref); 18511da177e4SLinus Torvalds 18521da177e4SLinus Torvalds return result; 1853e49bbce1SJohan Hovold } 18541da177e4SLinus Torvalds 1855335f8514SAlan Cox static void ftdi_dtr_rts(struct usb_serial_port *port, int on) 1856335f8514SAlan Cox { 1857335f8514SAlan Cox struct ftdi_private *priv = usb_get_serial_port_data(port); 1858335f8514SAlan Cox 1859335f8514SAlan Cox mutex_lock(&port->serial->disc_mutex); 1860335f8514SAlan Cox if (!port->serial->disconnected) { 1861335f8514SAlan Cox /* Disable flow control */ 1862335f8514SAlan Cox if (!on && usb_control_msg(port->serial->dev, 1863335f8514SAlan Cox usb_sndctrlpipe(port->serial->dev, 0), 1864335f8514SAlan Cox FTDI_SIO_SET_FLOW_CTRL_REQUEST, 1865335f8514SAlan Cox FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE, 186666e47e60SJohan Hovold 0, priv->interface, NULL, 0, 1867335f8514SAlan Cox WDR_TIMEOUT) < 0) { 1868335f8514SAlan Cox dev_err(&port->dev, "error from flowcontrol urb\n"); 1869335f8514SAlan Cox } 1870335f8514SAlan Cox /* drop RTS and DTR */ 1871335f8514SAlan Cox if (on) 1872335f8514SAlan Cox set_mctrl(port, TIOCM_DTR | TIOCM_RTS); 1873335f8514SAlan Cox else 1874335f8514SAlan Cox clear_mctrl(port, TIOCM_DTR | TIOCM_RTS); 1875335f8514SAlan Cox } 1876335f8514SAlan Cox mutex_unlock(&port->serial->disc_mutex); 1877335f8514SAlan Cox } 18781da177e4SLinus Torvalds 18791da177e4SLinus Torvalds /* 18801da177e4SLinus Torvalds * usbserial:__serial_close only calls ftdi_close if the point is open 18811da177e4SLinus Torvalds * 18821da177e4SLinus Torvalds * This only gets called when it is the last close 18831da177e4SLinus Torvalds */ 1884335f8514SAlan Cox static void ftdi_close(struct usb_serial_port *port) 1885e49bbce1SJohan Hovold { 18861da177e4SLinus Torvalds struct ftdi_private *priv = usb_get_serial_port_data(port); 18871da177e4SLinus Torvalds 1888441b62c1SHarvey Harrison dbg("%s", __func__); 18891da177e4SLinus Torvalds 1890c23e5fc1SJohan Hovold usb_serial_generic_close(port); 1891c45d6320SAlan Stern kref_put(&priv->kref, ftdi_sio_priv_release); 1892e49bbce1SJohan Hovold } 18931da177e4SLinus Torvalds 18941da177e4SLinus Torvalds /* The SIO requires the first byte to have: 18951da177e4SLinus Torvalds * B0 1 18961da177e4SLinus Torvalds * B1 0 18971da177e4SLinus Torvalds * B2..7 length of message excluding byte 0 18981da177e4SLinus Torvalds * 18991da177e4SLinus Torvalds * The new devices do not require this byte 19001da177e4SLinus Torvalds */ 1901d3901a06SJohan Hovold static int ftdi_prepare_write_buffer(struct usb_serial_port *port, 1902c23e5fc1SJohan Hovold void *dest, size_t size) 1903e49bbce1SJohan Hovold { 1904d3901a06SJohan Hovold struct ftdi_private *priv; 1905c23e5fc1SJohan Hovold int count; 1906c23e5fc1SJohan Hovold unsigned long flags; 19071da177e4SLinus Torvalds 1908d3901a06SJohan Hovold priv = usb_get_serial_port_data(port); 19091da177e4SLinus Torvalds 1910e8770484SJohan Hovold if (priv->chip_type == SIO) { 1911c23e5fc1SJohan Hovold unsigned char *buffer = dest; 1912c23e5fc1SJohan Hovold int i, len, c; 19131da177e4SLinus Torvalds 1914c23e5fc1SJohan Hovold count = 0; 1915c23e5fc1SJohan Hovold spin_lock_irqsave(&port->lock, flags); 1916c23e5fc1SJohan Hovold for (i = 0; i < size - 1; i += priv->max_packet_size) { 1917c23e5fc1SJohan Hovold len = min_t(int, size - i, priv->max_packet_size) - 1; 1918c23e5fc1SJohan Hovold c = kfifo_out(&port->write_fifo, &buffer[i + 1], len); 1919c23e5fc1SJohan Hovold if (!c) 1920c23e5fc1SJohan Hovold break; 1921c1aa075aSJohan Hovold buffer[i] = (c << 2) + 1; 1922c23e5fc1SJohan Hovold count += c + 1; 19231da177e4SLinus Torvalds } 1924c23e5fc1SJohan Hovold spin_unlock_irqrestore(&port->lock, flags); 19251da177e4SLinus Torvalds } else { 1926c23e5fc1SJohan Hovold count = kfifo_out_locked(&port->write_fifo, dest, size, 1927c23e5fc1SJohan Hovold &port->lock); 19281da177e4SLinus Torvalds } 19291da177e4SLinus Torvalds 19301da177e4SLinus Torvalds return count; 193195da310eSAlan Cox } 19321da177e4SLinus Torvalds 1933166ceb69SJohan Hovold #define FTDI_RS_ERR_MASK (FTDI_RS_BI | FTDI_RS_PE | FTDI_RS_FE | FTDI_RS_OE) 1934166ceb69SJohan Hovold 1935cc01f17dSJohan Hovold static int ftdi_process_packet(struct tty_struct *tty, 1936cc01f17dSJohan Hovold struct usb_serial_port *port, struct ftdi_private *priv, 1937cc01f17dSJohan Hovold char *packet, int len) 193895da310eSAlan Cox { 19391da177e4SLinus Torvalds int i; 1940cc01f17dSJohan Hovold char status; 1941cc01f17dSJohan Hovold char flag; 1942cc01f17dSJohan Hovold char *ch; 19431da177e4SLinus Torvalds 1944441b62c1SHarvey Harrison dbg("%s - port %d", __func__, port->number); 19451da177e4SLinus Torvalds 1946cc01f17dSJohan Hovold if (len < 2) { 1947cc01f17dSJohan Hovold dbg("malformed packet"); 1948cc01f17dSJohan Hovold return 0; 19491da177e4SLinus Torvalds } 19501da177e4SLinus Torvalds 1951464cbb24SAlan Cox /* Compare new line status to the old one, signal if different/ 1952464cbb24SAlan Cox N.B. packet may be processed more than once, but differences 1953464cbb24SAlan Cox are only processed once. */ 1954cc01f17dSJohan Hovold status = packet[0] & FTDI_STATUS_B0_MASK; 1955cc01f17dSJohan Hovold if (status != priv->prev_status) { 1956cc01f17dSJohan Hovold priv->diff_status |= status ^ priv->prev_status; 19571da177e4SLinus Torvalds wake_up_interruptible(&priv->delta_msr_wait); 1958cc01f17dSJohan Hovold priv->prev_status = status; 19591da177e4SLinus Torvalds } 19601da177e4SLinus Torvalds 1961cc01f17dSJohan Hovold flag = TTY_NORMAL; 1962166ceb69SJohan Hovold if (packet[1] & FTDI_RS_ERR_MASK) { 1963166ceb69SJohan Hovold /* Break takes precedence over parity, which takes precedence 1964166ceb69SJohan Hovold * over framing errors */ 1965cc01f17dSJohan Hovold if (packet[1] & FTDI_RS_BI) { 1966cc01f17dSJohan Hovold flag = TTY_BREAK; 196772fda3caSJason Wessel usb_serial_handle_break(port); 1968166ceb69SJohan Hovold } else if (packet[1] & FTDI_RS_PE) { 1969cc01f17dSJohan Hovold flag = TTY_PARITY; 1970166ceb69SJohan Hovold } else if (packet[1] & FTDI_RS_FE) { 1971cc01f17dSJohan Hovold flag = TTY_FRAME; 1972166ceb69SJohan Hovold } 1973166ceb69SJohan Hovold /* Overrun is special, not associated with a char */ 1974166ceb69SJohan Hovold if (packet[1] & FTDI_RS_OE) 1975166ceb69SJohan Hovold tty_insert_flip_char(tty, 0, TTY_OVERRUN); 19761da177e4SLinus Torvalds } 19771da177e4SLinus Torvalds 1978c466cd2bSGreg Kroah-Hartman /* save if the transmitter is empty or not */ 1979c466cd2bSGreg Kroah-Hartman if (packet[1] & FTDI_RS_TEMT) 1980c466cd2bSGreg Kroah-Hartman priv->transmit_empty = 1; 1981c466cd2bSGreg Kroah-Hartman else 1982c466cd2bSGreg Kroah-Hartman priv->transmit_empty = 0; 1983c466cd2bSGreg Kroah-Hartman 1984cc01f17dSJohan Hovold len -= 2; 1985cc01f17dSJohan Hovold if (!len) 1986cc01f17dSJohan Hovold return 0; /* status only */ 1987*c9222ec9SUwe Bonnes priv->icount.rx += len; 1988cc01f17dSJohan Hovold ch = packet + 2; 1989cc01f17dSJohan Hovold 199049b2597aSJohan Hovold if (port->port.console && port->sysrq) { 1991cc01f17dSJohan Hovold for (i = 0; i < len; i++, ch++) { 19926ee9f4b4SDmitry Torokhov if (!usb_serial_handle_sysrq_char(port, *ch)) 1993cc01f17dSJohan Hovold tty_insert_flip_char(tty, *ch, flag); 1994cc01f17dSJohan Hovold } 199549b2597aSJohan Hovold } else { 199649b2597aSJohan Hovold tty_insert_flip_string_fixed_flag(tty, ch, flag, len); 1997cc01f17dSJohan Hovold } 199849b2597aSJohan Hovold 1999cc01f17dSJohan Hovold return len; 2000cc01f17dSJohan Hovold } 2001cc01f17dSJohan Hovold 20021b551015SJohan Hovold static void ftdi_process_read_urb(struct urb *urb) 2003cc01f17dSJohan Hovold { 20041b551015SJohan Hovold struct usb_serial_port *port = urb->context; 2005cc01f17dSJohan Hovold struct tty_struct *tty; 2006cc01f17dSJohan Hovold struct ftdi_private *priv = usb_get_serial_port_data(port); 2007cc01f17dSJohan Hovold char *data = (char *)urb->transfer_buffer; 2008cc01f17dSJohan Hovold int i; 2009cc01f17dSJohan Hovold int len; 2010cc01f17dSJohan Hovold int count = 0; 2011cc01f17dSJohan Hovold 2012cc01f17dSJohan Hovold tty = tty_port_tty_get(&port->port); 2013cc01f17dSJohan Hovold if (!tty) 2014cc01f17dSJohan Hovold return; 2015cc01f17dSJohan Hovold 2016cc01f17dSJohan Hovold for (i = 0; i < urb->actual_length; i += priv->max_packet_size) { 2017cc01f17dSJohan Hovold len = min_t(int, urb->actual_length - i, priv->max_packet_size); 2018cc01f17dSJohan Hovold count += ftdi_process_packet(tty, port, priv, &data[i], len); 2019cc01f17dSJohan Hovold } 2020cc01f17dSJohan Hovold 2021cc01f17dSJohan Hovold if (count) 20221da177e4SLinus Torvalds tty_flip_buffer_push(tty); 20234a90f09bSAlan Cox tty_kref_put(tty); 2024cc01f17dSJohan Hovold } 20251da177e4SLinus Torvalds 202695da310eSAlan Cox static void ftdi_break_ctl(struct tty_struct *tty, int break_state) 20271da177e4SLinus Torvalds { 202895da310eSAlan Cox struct usb_serial_port *port = tty->driver_data; 20291da177e4SLinus Torvalds struct ftdi_private *priv = usb_get_serial_port_data(port); 2030c1284d77SJohan Hovold __u16 urb_value; 20311da177e4SLinus Torvalds 20321da177e4SLinus Torvalds /* break_state = -1 to turn on break, and 0 to turn off break */ 20331da177e4SLinus Torvalds /* see drivers/char/tty_io.c to see it used */ 20341da177e4SLinus Torvalds /* last_set_data_urb_value NEVER has the break bit set in it */ 20351da177e4SLinus Torvalds 2036464cbb24SAlan Cox if (break_state) 20371da177e4SLinus Torvalds urb_value = priv->last_set_data_urb_value | FTDI_SIO_SET_BREAK; 2038464cbb24SAlan Cox else 20391da177e4SLinus Torvalds urb_value = priv->last_set_data_urb_value; 20401da177e4SLinus Torvalds 2041464cbb24SAlan Cox if (usb_control_msg(port->serial->dev, 2042464cbb24SAlan Cox usb_sndctrlpipe(port->serial->dev, 0), 20431da177e4SLinus Torvalds FTDI_SIO_SET_DATA_REQUEST, 20441da177e4SLinus Torvalds FTDI_SIO_SET_DATA_REQUEST_TYPE, 20451da177e4SLinus Torvalds urb_value , priv->interface, 204666e47e60SJohan Hovold NULL, 0, WDR_TIMEOUT) < 0) { 2047194343d9SGreg Kroah-Hartman dev_err(&port->dev, "%s FAILED to enable/disable break state " 2048194343d9SGreg Kroah-Hartman "(state was %d)\n", __func__, break_state); 20491da177e4SLinus Torvalds } 20501da177e4SLinus Torvalds 2051464cbb24SAlan Cox dbg("%s break state is %d - urb is %d", __func__, 2052464cbb24SAlan Cox break_state, urb_value); 20531da177e4SLinus Torvalds 20541da177e4SLinus Torvalds } 20551da177e4SLinus Torvalds 20561da177e4SLinus Torvalds /* old_termios contains the original termios settings and tty->termios contains 20571da177e4SLinus Torvalds * the new setting to be used 20581da177e4SLinus Torvalds * WARNING: set_termios calls this with old_termios in kernel space 20591da177e4SLinus Torvalds */ 206095da310eSAlan Cox static void ftdi_set_termios(struct tty_struct *tty, 206195da310eSAlan Cox struct usb_serial_port *port, struct ktermios *old_termios) 2062e49bbce1SJohan Hovold { 20631da177e4SLinus Torvalds struct usb_device *dev = port->serial->dev; 20641da177e4SLinus Torvalds struct ftdi_private *priv = usb_get_serial_port_data(port); 206595da310eSAlan Cox struct ktermios *termios = tty->termios; 2066669a6db1SAlan Cox unsigned int cflag = termios->c_cflag; 20671da177e4SLinus Torvalds __u16 urb_value; /* will hold the new flags */ 20681da177e4SLinus Torvalds 2069464cbb24SAlan Cox /* Added for xon/xoff support */ 2070669a6db1SAlan Cox unsigned int iflag = termios->c_iflag; 20711da177e4SLinus Torvalds unsigned char vstop; 20721da177e4SLinus Torvalds unsigned char vstart; 20731da177e4SLinus Torvalds 2074441b62c1SHarvey Harrison dbg("%s", __func__); 20751da177e4SLinus Torvalds 2076464cbb24SAlan Cox /* Force baud rate if this device requires it, unless it is set to 2077464cbb24SAlan Cox B0. */ 2078669a6db1SAlan Cox if (priv->force_baud && ((termios->c_cflag & CBAUD) != B0)) { 2079441b62c1SHarvey Harrison dbg("%s: forcing baud rate for this device", __func__); 208095da310eSAlan Cox tty_encode_baud_rate(tty, priv->force_baud, 2081bd5e47ccSAndrew Morton priv->force_baud); 20821da177e4SLinus Torvalds } 20831da177e4SLinus Torvalds 20841da177e4SLinus Torvalds /* Force RTS-CTS if this device requires it. */ 20851da177e4SLinus Torvalds if (priv->force_rtscts) { 2086441b62c1SHarvey Harrison dbg("%s: forcing rtscts for this device", __func__); 2087669a6db1SAlan Cox termios->c_cflag |= CRTSCTS; 20881da177e4SLinus Torvalds } 20891da177e4SLinus Torvalds 2090669a6db1SAlan Cox cflag = termios->c_cflag; 20911da177e4SLinus Torvalds 20921da177e4SLinus Torvalds /* FIXME -For this cut I don't care if the line is really changing or 20931da177e4SLinus Torvalds not - so just do the change regardless - should be able to 20941da177e4SLinus Torvalds compare old_termios and tty->termios */ 20951da177e4SLinus Torvalds /* NOTE These routines can get interrupted by 2096464cbb24SAlan Cox ftdi_sio_read_bulk_callback - need to examine what this means - 2097464cbb24SAlan Cox don't see any problems yet */ 20981da177e4SLinus Torvalds 20991da177e4SLinus Torvalds /* Set number of data bits, parity, stop bits */ 21001da177e4SLinus Torvalds 21011da177e4SLinus Torvalds urb_value = 0; 21021da177e4SLinus Torvalds urb_value |= (cflag & CSTOPB ? FTDI_SIO_SET_DATA_STOP_BITS_2 : 21031da177e4SLinus Torvalds FTDI_SIO_SET_DATA_STOP_BITS_1); 210438fcb830SRoland Koebler if (cflag & PARENB) { 210538fcb830SRoland Koebler if (cflag & CMSPAR) 210638fcb830SRoland Koebler urb_value |= cflag & PARODD ? 210738fcb830SRoland Koebler FTDI_SIO_SET_DATA_PARITY_MARK : 210838fcb830SRoland Koebler FTDI_SIO_SET_DATA_PARITY_SPACE; 210938fcb830SRoland Koebler else 211038fcb830SRoland Koebler urb_value |= cflag & PARODD ? 211138fcb830SRoland Koebler FTDI_SIO_SET_DATA_PARITY_ODD : 211238fcb830SRoland Koebler FTDI_SIO_SET_DATA_PARITY_EVEN; 211338fcb830SRoland Koebler } else { 211438fcb830SRoland Koebler urb_value |= FTDI_SIO_SET_DATA_PARITY_NONE; 211538fcb830SRoland Koebler } 21161da177e4SLinus Torvalds if (cflag & CSIZE) { 21171da177e4SLinus Torvalds switch (cflag & CSIZE) { 21181da177e4SLinus Torvalds case CS7: urb_value |= 7; dbg("Setting CS7"); break; 21191da177e4SLinus Torvalds case CS8: urb_value |= 8; dbg("Setting CS8"); break; 21201da177e4SLinus Torvalds default: 2121cabe6cc2SMark Adamson dev_err(&port->dev, "CSIZE was set but not CS7-CS8\n"); 21221da177e4SLinus Torvalds } 21231da177e4SLinus Torvalds } 21241da177e4SLinus Torvalds 2125464cbb24SAlan Cox /* This is needed by the break command since it uses the same command 2126464cbb24SAlan Cox - but is or'ed with this value */ 21271da177e4SLinus Torvalds priv->last_set_data_urb_value = urb_value; 21281da177e4SLinus Torvalds 21291da177e4SLinus Torvalds if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0), 21301da177e4SLinus Torvalds FTDI_SIO_SET_DATA_REQUEST, 21311da177e4SLinus Torvalds FTDI_SIO_SET_DATA_REQUEST_TYPE, 21321da177e4SLinus Torvalds urb_value , priv->interface, 213366e47e60SJohan Hovold NULL, 0, WDR_SHORT_TIMEOUT) < 0) { 2134194343d9SGreg Kroah-Hartman dev_err(&port->dev, "%s FAILED to set " 2135194343d9SGreg Kroah-Hartman "databits/stopbits/parity\n", __func__); 21361da177e4SLinus Torvalds } 21371da177e4SLinus Torvalds 21381da177e4SLinus Torvalds /* Now do the baudrate */ 21391da177e4SLinus Torvalds if ((cflag & CBAUD) == B0) { 21401da177e4SLinus Torvalds /* Disable flow control */ 21411da177e4SLinus Torvalds if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0), 21421da177e4SLinus Torvalds FTDI_SIO_SET_FLOW_CTRL_REQUEST, 21431da177e4SLinus Torvalds FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE, 21441da177e4SLinus Torvalds 0, priv->interface, 214566e47e60SJohan Hovold NULL, 0, WDR_TIMEOUT) < 0) { 2146194343d9SGreg Kroah-Hartman dev_err(&port->dev, 2147194343d9SGreg Kroah-Hartman "%s error from disable flowcontrol urb\n", 2148194343d9SGreg Kroah-Hartman __func__); 21491da177e4SLinus Torvalds } 21501da177e4SLinus Torvalds /* Drop RTS and DTR */ 215174ede0ffSIan Abbott clear_mctrl(port, TIOCM_DTR | TIOCM_RTS); 21521da177e4SLinus Torvalds } else { 21531da177e4SLinus Torvalds /* set the baudrate determined before */ 21549c67d28eSAlessio Igor Bogani mutex_lock(&priv->cfg_lock); 2155464cbb24SAlan Cox if (change_speed(tty, port)) 2156194343d9SGreg Kroah-Hartman dev_err(&port->dev, "%s urb failed to set baudrate\n", 2157194343d9SGreg Kroah-Hartman __func__); 21589c67d28eSAlessio Igor Bogani mutex_unlock(&priv->cfg_lock); 215972a755fcSPeter Favrholdt /* Ensure RTS and DTR are raised when baudrate changed from 0 */ 2160464cbb24SAlan Cox if (!old_termios || (old_termios->c_cflag & CBAUD) == B0) 216174ede0ffSIan Abbott set_mctrl(port, TIOCM_DTR | TIOCM_RTS); 21621da177e4SLinus Torvalds } 21631da177e4SLinus Torvalds 21641da177e4SLinus Torvalds /* Set flow control */ 21651da177e4SLinus Torvalds /* Note device also supports DTR/CD (ugh) and Xon/Xoff in hardware */ 21661da177e4SLinus Torvalds if (cflag & CRTSCTS) { 2167441b62c1SHarvey Harrison dbg("%s Setting to CRTSCTS flow control", __func__); 21681da177e4SLinus Torvalds if (usb_control_msg(dev, 21691da177e4SLinus Torvalds usb_sndctrlpipe(dev, 0), 21701da177e4SLinus Torvalds FTDI_SIO_SET_FLOW_CTRL_REQUEST, 21711da177e4SLinus Torvalds FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE, 21721da177e4SLinus Torvalds 0 , (FTDI_SIO_RTS_CTS_HS | priv->interface), 217366e47e60SJohan Hovold NULL, 0, WDR_TIMEOUT) < 0) { 2174194343d9SGreg Kroah-Hartman dev_err(&port->dev, 2175194343d9SGreg Kroah-Hartman "urb failed to set to rts/cts flow control\n"); 21761da177e4SLinus Torvalds } 21771da177e4SLinus Torvalds 21781da177e4SLinus Torvalds } else { 21791da177e4SLinus Torvalds /* 21801da177e4SLinus Torvalds * Xon/Xoff code 21811da177e4SLinus Torvalds * 2182464cbb24SAlan Cox * Check the IXOFF status in the iflag component of the 2183464cbb24SAlan Cox * termios structure. If IXOFF is not set, the pre-xon/xoff 2184464cbb24SAlan Cox * code is executed. 21851da177e4SLinus Torvalds */ 21861da177e4SLinus Torvalds if (iflag & IXOFF) { 2187464cbb24SAlan Cox dbg("%s request to enable xonxoff iflag=%04x", 2188464cbb24SAlan Cox __func__, iflag); 2189464cbb24SAlan Cox /* Try to enable the XON/XOFF on the ftdi_sio 2190464cbb24SAlan Cox * Set the vstart and vstop -- could have been done up 2191464cbb24SAlan Cox * above where a lot of other dereferencing is done but 2192464cbb24SAlan Cox * that would be very inefficient as vstart and vstop 2193464cbb24SAlan Cox * are not always needed. 2194464cbb24SAlan Cox */ 2195669a6db1SAlan Cox vstart = termios->c_cc[VSTART]; 2196669a6db1SAlan Cox vstop = termios->c_cc[VSTOP]; 21971da177e4SLinus Torvalds urb_value = (vstop << 8) | (vstart); 21981da177e4SLinus Torvalds 21991da177e4SLinus Torvalds if (usb_control_msg(dev, 22001da177e4SLinus Torvalds usb_sndctrlpipe(dev, 0), 22011da177e4SLinus Torvalds FTDI_SIO_SET_FLOW_CTRL_REQUEST, 22021da177e4SLinus Torvalds FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE, 22031da177e4SLinus Torvalds urb_value , (FTDI_SIO_XON_XOFF_HS 22041da177e4SLinus Torvalds | priv->interface), 220566e47e60SJohan Hovold NULL, 0, WDR_TIMEOUT) < 0) { 2206194343d9SGreg Kroah-Hartman dev_err(&port->dev, "urb failed to set to " 2207194343d9SGreg Kroah-Hartman "xon/xoff flow control\n"); 22081da177e4SLinus Torvalds } 22091da177e4SLinus Torvalds } else { 2210464cbb24SAlan Cox /* else clause to only run if cflag ! CRTSCTS and iflag 2211464cbb24SAlan Cox * ! XOFF. CHECKME Assuming XON/XOFF handled by tty 2212464cbb24SAlan Cox * stack - not by device */ 2213441b62c1SHarvey Harrison dbg("%s Turning off hardware flow control", __func__); 22141da177e4SLinus Torvalds if (usb_control_msg(dev, 22151da177e4SLinus Torvalds usb_sndctrlpipe(dev, 0), 22161da177e4SLinus Torvalds FTDI_SIO_SET_FLOW_CTRL_REQUEST, 22171da177e4SLinus Torvalds FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE, 22181da177e4SLinus Torvalds 0, priv->interface, 221966e47e60SJohan Hovold NULL, 0, WDR_TIMEOUT) < 0) { 2220194343d9SGreg Kroah-Hartman dev_err(&port->dev, 2221194343d9SGreg Kroah-Hartman "urb failed to clear flow control\n"); 22221da177e4SLinus Torvalds } 22231da177e4SLinus Torvalds } 22241da177e4SLinus Torvalds 22251da177e4SLinus Torvalds } 222695da310eSAlan Cox } 22271da177e4SLinus Torvalds 222860b33c13SAlan Cox static int ftdi_tiocmget(struct tty_struct *tty) 22291da177e4SLinus Torvalds { 223095da310eSAlan Cox struct usb_serial_port *port = tty->driver_data; 22311da177e4SLinus Torvalds struct ftdi_private *priv = usb_get_serial_port_data(port); 223266e47e60SJohan Hovold unsigned char *buf; 2233a3f8168bSJohan Hovold int len; 22341da177e4SLinus Torvalds int ret; 22351da177e4SLinus Torvalds 2236441b62c1SHarvey Harrison dbg("%s TIOCMGET", __func__); 223766e47e60SJohan Hovold 223866e47e60SJohan Hovold buf = kmalloc(2, GFP_KERNEL); 223966e47e60SJohan Hovold if (!buf) 224066e47e60SJohan Hovold return -ENOMEM; 2241a3f8168bSJohan Hovold /* 2242a3f8168bSJohan Hovold * The 8U232AM returns a two byte value (the SIO a 1 byte value) in 2243a3f8168bSJohan Hovold * the same format as the data returned from the in point. 2244a3f8168bSJohan Hovold */ 22451da177e4SLinus Torvalds switch (priv->chip_type) { 22461da177e4SLinus Torvalds case SIO: 2247a3f8168bSJohan Hovold len = 1; 22481da177e4SLinus Torvalds break; 22491da177e4SLinus Torvalds case FT8U232AM: 22501da177e4SLinus Torvalds case FT232BM: 22511da177e4SLinus Torvalds case FT2232C: 2252ed6e5282SAndrew M. Bishop case FT232RL: 2253094c2e6dSMark Adamson case FT2232H: 2254094c2e6dSMark Adamson case FT4232H: 2255309427b6SUwe Bonnes case FT232H: 2256a3f8168bSJohan Hovold len = 2; 22571da177e4SLinus Torvalds break; 22581da177e4SLinus Torvalds default: 225966e47e60SJohan Hovold ret = -EFAULT; 226066e47e60SJohan Hovold goto out; 22611da177e4SLinus Torvalds } 22621da177e4SLinus Torvalds 2263a3f8168bSJohan Hovold ret = usb_control_msg(port->serial->dev, 2264a3f8168bSJohan Hovold usb_rcvctrlpipe(port->serial->dev, 0), 2265a3f8168bSJohan Hovold FTDI_SIO_GET_MODEM_STATUS_REQUEST, 2266a3f8168bSJohan Hovold FTDI_SIO_GET_MODEM_STATUS_REQUEST_TYPE, 2267a3f8168bSJohan Hovold 0, priv->interface, 2268a3f8168bSJohan Hovold buf, len, WDR_TIMEOUT); 2269a3f8168bSJohan Hovold if (ret < 0) 2270a3f8168bSJohan Hovold goto out; 2271a3f8168bSJohan Hovold 227266e47e60SJohan Hovold ret = (buf[0] & FTDI_SIO_DSR_MASK ? TIOCM_DSR : 0) | 22731da177e4SLinus Torvalds (buf[0] & FTDI_SIO_CTS_MASK ? TIOCM_CTS : 0) | 22741da177e4SLinus Torvalds (buf[0] & FTDI_SIO_RI_MASK ? TIOCM_RI : 0) | 22751da177e4SLinus Torvalds (buf[0] & FTDI_SIO_RLSD_MASK ? TIOCM_CD : 0) | 22761da177e4SLinus Torvalds priv->last_dtr_rts; 227766e47e60SJohan Hovold out: 227866e47e60SJohan Hovold kfree(buf); 227966e47e60SJohan Hovold return ret; 22801da177e4SLinus Torvalds } 22811da177e4SLinus Torvalds 228220b9d177SAlan Cox static int ftdi_tiocmset(struct tty_struct *tty, 228395da310eSAlan Cox unsigned int set, unsigned int clear) 22841da177e4SLinus Torvalds { 228595da310eSAlan Cox struct usb_serial_port *port = tty->driver_data; 2286441b62c1SHarvey Harrison dbg("%s TIOCMSET", __func__); 228774ede0ffSIan Abbott return update_mctrl(port, set, clear); 22881da177e4SLinus Torvalds } 22891da177e4SLinus Torvalds 2290c75ccd48SUwe Bonnes static int ftdi_get_icount(struct tty_struct *tty, 2291c75ccd48SUwe Bonnes struct serial_icounter_struct *icount) 2292c75ccd48SUwe Bonnes { 2293c75ccd48SUwe Bonnes struct usb_serial_port *port = tty->driver_data; 2294c75ccd48SUwe Bonnes struct ftdi_private *priv = usb_get_serial_port_data(port); 2295c75ccd48SUwe Bonnes struct async_icount *ic = &priv->icount; 2296c75ccd48SUwe Bonnes 2297c75ccd48SUwe Bonnes icount->cts = ic->cts; 2298c75ccd48SUwe Bonnes icount->dsr = ic->dsr; 2299c75ccd48SUwe Bonnes icount->rng = ic->rng; 2300c75ccd48SUwe Bonnes icount->dcd = ic->dcd; 2301c75ccd48SUwe Bonnes icount->tx = ic->tx; 2302c75ccd48SUwe Bonnes icount->rx = ic->rx; 2303c75ccd48SUwe Bonnes icount->frame = ic->frame; 2304c75ccd48SUwe Bonnes icount->parity = ic->parity; 2305c75ccd48SUwe Bonnes icount->overrun = ic->overrun; 2306c75ccd48SUwe Bonnes icount->brk = ic->brk; 2307c75ccd48SUwe Bonnes icount->buf_overrun = ic->buf_overrun; 2308c75ccd48SUwe Bonnes return 0; 2309c75ccd48SUwe Bonnes } 2310c75ccd48SUwe Bonnes 231100a0d0d6SAlan Cox static int ftdi_ioctl(struct tty_struct *tty, 2312464cbb24SAlan Cox unsigned int cmd, unsigned long arg) 23131da177e4SLinus Torvalds { 231495da310eSAlan Cox struct usb_serial_port *port = tty->driver_data; 23151da177e4SLinus Torvalds struct ftdi_private *priv = usb_get_serial_port_data(port); 23161da177e4SLinus Torvalds 2317441b62c1SHarvey Harrison dbg("%s cmd 0x%04x", __func__, cmd); 23181da177e4SLinus Torvalds 23191da177e4SLinus Torvalds /* Based on code from acm.c and others */ 23201da177e4SLinus Torvalds switch (cmd) { 23211da177e4SLinus Torvalds 23221da177e4SLinus Torvalds case TIOCGSERIAL: /* gets serial port data */ 2323464cbb24SAlan Cox return get_serial_info(port, 2324464cbb24SAlan Cox (struct serial_struct __user *) arg); 23251da177e4SLinus Torvalds 23261da177e4SLinus Torvalds case TIOCSSERIAL: /* sets serial port data */ 2327464cbb24SAlan Cox return set_serial_info(tty, port, 2328464cbb24SAlan Cox (struct serial_struct __user *) arg); 23291da177e4SLinus Torvalds 23301da177e4SLinus Torvalds /* 23311da177e4SLinus Torvalds * Wait for any of the 4 modem inputs (DCD,RI,DSR,CTS) to change 23321da177e4SLinus Torvalds * - mask passed in arg for lines of interest 23331da177e4SLinus Torvalds * (use |'ed TIOCM_RNG/DSR/CD/CTS for masking) 23341da177e4SLinus Torvalds * Caller should use TIOCGICOUNT to see which one it was. 23350bca1b91SAlan Cox * (except that the driver doesn't support it !) 23361da177e4SLinus Torvalds * 23371da177e4SLinus Torvalds * This code is borrowed from linux/drivers/char/serial.c 23381da177e4SLinus Torvalds */ 23391da177e4SLinus Torvalds case TIOCMIWAIT: 23401da177e4SLinus Torvalds while (priv != NULL) { 23411da177e4SLinus Torvalds interruptible_sleep_on(&priv->delta_msr_wait); 23421da177e4SLinus Torvalds /* see if a signal did it */ 23431da177e4SLinus Torvalds if (signal_pending(current)) 23441da177e4SLinus Torvalds return -ERESTARTSYS; 23451da177e4SLinus Torvalds else { 23461da177e4SLinus Torvalds char diff = priv->diff_status; 23471da177e4SLinus Torvalds 2348464cbb24SAlan Cox if (diff == 0) 23491da177e4SLinus Torvalds return -EIO; /* no change => error */ 23501da177e4SLinus Torvalds 23511da177e4SLinus Torvalds /* Consume all events */ 23521da177e4SLinus Torvalds priv->diff_status = 0; 23531da177e4SLinus Torvalds 2354464cbb24SAlan Cox /* Return 0 if caller wanted to know about 2355464cbb24SAlan Cox these bits */ 23561da177e4SLinus Torvalds if (((arg & TIOCM_RNG) && (diff & FTDI_RS0_RI)) || 23571da177e4SLinus Torvalds ((arg & TIOCM_DSR) && (diff & FTDI_RS0_DSR)) || 23581da177e4SLinus Torvalds ((arg & TIOCM_CD) && (diff & FTDI_RS0_RLSD)) || 23591da177e4SLinus Torvalds ((arg & TIOCM_CTS) && (diff & FTDI_RS0_CTS))) { 23601da177e4SLinus Torvalds return 0; 23611da177e4SLinus Torvalds } 23621da177e4SLinus Torvalds /* 2363464cbb24SAlan Cox * Otherwise caller can't care less about what 2364464cbb24SAlan Cox * happened,and so we continue to wait for more 2365464cbb24SAlan Cox * events. 23661da177e4SLinus Torvalds */ 23671da177e4SLinus Torvalds } 23681da177e4SLinus Torvalds } 236995da310eSAlan Cox return 0; 2370c466cd2bSGreg Kroah-Hartman case TIOCSERGETLSR: 2371c466cd2bSGreg Kroah-Hartman return get_lsr_info(port, (struct serial_struct __user *)arg); 2372c466cd2bSGreg Kroah-Hartman break; 23731da177e4SLinus Torvalds default: 23741da177e4SLinus Torvalds break; 23751da177e4SLinus Torvalds } 2376464cbb24SAlan Cox /* This is not necessarily an error - turns out the higher layers 2377464cbb24SAlan Cox * will do some ioctls themselves (see comment above) 23781da177e4SLinus Torvalds */ 2379441b62c1SHarvey Harrison dbg("%s arg not supported - it was 0x%04x - check /usr/include/asm/ioctls.h", __func__, cmd); 238095da310eSAlan Cox return -ENOIOCTLCMD; 238195da310eSAlan Cox } 23821da177e4SLinus Torvalds 23831da177e4SLinus Torvalds static int __init ftdi_init(void) 23841da177e4SLinus Torvalds { 23851da177e4SLinus Torvalds int retval; 23861da177e4SLinus Torvalds 2387441b62c1SHarvey Harrison dbg("%s", __func__); 2388fdcb0a0fSIan Abbott if (vendor > 0 && product > 0) { 2389fdcb0a0fSIan Abbott /* Add user specified VID/PID to reserved element of table. */ 2390fdcb0a0fSIan Abbott int i; 2391fdcb0a0fSIan Abbott for (i = 0; id_table_combined[i].idVendor; i++) 2392fdcb0a0fSIan Abbott ; 2393fdcb0a0fSIan Abbott id_table_combined[i].match_flags = USB_DEVICE_ID_MATCH_DEVICE; 2394fdcb0a0fSIan Abbott id_table_combined[i].idVendor = vendor; 2395fdcb0a0fSIan Abbott id_table_combined[i].idProduct = product; 2396fdcb0a0fSIan Abbott } 23978f977e42SIan Abbott retval = usb_serial_register(&ftdi_sio_device); 23981da177e4SLinus Torvalds if (retval) 23998f977e42SIan Abbott goto failed_sio_register; 24001da177e4SLinus Torvalds retval = usb_register(&ftdi_driver); 24011da177e4SLinus Torvalds if (retval) 24021da177e4SLinus Torvalds goto failed_usb_register; 24031da177e4SLinus Torvalds 2404c197a8dbSGreg Kroah-Hartman printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" 2405c197a8dbSGreg Kroah-Hartman DRIVER_DESC "\n"); 24061da177e4SLinus Torvalds return 0; 24071da177e4SLinus Torvalds failed_usb_register: 24088f977e42SIan Abbott usb_serial_deregister(&ftdi_sio_device); 24098f977e42SIan Abbott failed_sio_register: 24101da177e4SLinus Torvalds return retval; 24111da177e4SLinus Torvalds } 24121da177e4SLinus Torvalds 24131da177e4SLinus Torvalds static void __exit ftdi_exit(void) 24141da177e4SLinus Torvalds { 2415441b62c1SHarvey Harrison dbg("%s", __func__); 24161da177e4SLinus Torvalds 24171da177e4SLinus Torvalds usb_deregister(&ftdi_driver); 24188f977e42SIan Abbott usb_serial_deregister(&ftdi_sio_device); 24191da177e4SLinus Torvalds } 24201da177e4SLinus Torvalds 24211da177e4SLinus Torvalds 24221da177e4SLinus Torvalds module_init(ftdi_init); 24231da177e4SLinus Torvalds module_exit(ftdi_exit); 24241da177e4SLinus Torvalds 24251da177e4SLinus Torvalds MODULE_AUTHOR(DRIVER_AUTHOR); 24261da177e4SLinus Torvalds MODULE_DESCRIPTION(DRIVER_DESC); 24271da177e4SLinus Torvalds MODULE_LICENSE("GPL"); 24281da177e4SLinus Torvalds 24291da177e4SLinus Torvalds module_param(debug, bool, S_IRUGO | S_IWUSR); 24301da177e4SLinus Torvalds MODULE_PARM_DESC(debug, "Debug enabled or not"); 2431fdcb0a0fSIan Abbott module_param(vendor, ushort, 0); 2432fdcb0a0fSIan Abbott MODULE_PARM_DESC(vendor, "User specified vendor ID (default=" 2433fdcb0a0fSIan Abbott __MODULE_STRING(FTDI_VID)")"); 2434fdcb0a0fSIan Abbott module_param(product, ushort, 0); 243568265043SPaulius Zaleckas MODULE_PARM_DESC(product, "User specified product ID"); 24361da177e4SLinus Torvalds 2437b760dac2SMartin Geleynse module_param(ndi_latency_timer, int, S_IRUGO | S_IWUSR); 2438b760dac2SMartin Geleynse MODULE_PARM_DESC(ndi_latency_timer, "NDI device latency timer override"); 2439