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 51d3901a06SJohan 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>" 521da177e4SLinus Torvalds #define DRIVER_DESC "USB FTDI Serial Converters Driver" 531da177e4SLinus Torvalds 54fdcb0a0fSIan Abbott static __u16 vendor = FTDI_VID; 55fdcb0a0fSIan Abbott static __u16 product; 561da177e4SLinus Torvalds 570ffbbe25SOliver Neukum struct ftdi_private { 58c45d6320SAlan Stern struct kref kref; 593bb36aa2SGreg Kroah-Hartman enum ftdi_chip_type chip_type; 60464cbb24SAlan Cox /* type of device, either SIO or FT8U232AM */ 610ffbbe25SOliver Neukum int baud_base; /* baud base clock for divisor setting */ 62464cbb24SAlan Cox int custom_divisor; /* custom_divisor kludge, this is for 63464cbb24SAlan Cox baud_base (different from what goes to the 64464cbb24SAlan Cox chip!) */ 650ffbbe25SOliver Neukum __u16 last_set_data_urb_value ; 66464cbb24SAlan Cox /* the last data state set - needed for doing 67464cbb24SAlan Cox * a break 68464cbb24SAlan Cox */ 690ffbbe25SOliver Neukum int flags; /* some ASYNC_xxxx flags are supported */ 700ffbbe25SOliver Neukum unsigned long last_dtr_rts; /* saved modem control outputs */ 71c75ccd48SUwe Bonnes struct async_icount icount; 720ffbbe25SOliver Neukum wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */ 73fca5430dSSimon Arlott char prev_status; /* Used for TIOCMIWAIT */ 74876ae50dSSimon Arlott bool dev_gone; /* Used to abort TIOCMIWAIT */ 75c466cd2bSGreg Kroah-Hartman char transmit_empty; /* If transmitter is empty or not */ 76094c2e6dSMark Adamson __u16 interface; /* FT2232C, FT2232H or FT4232H port interface 77094c2e6dSMark Adamson (0 for FT232/245) */ 780ffbbe25SOliver Neukum 79464cbb24SAlan Cox speed_t force_baud; /* if non-zero, force the baud rate to 80464cbb24SAlan Cox this value */ 81464cbb24SAlan Cox int force_rtscts; /* if non-zero, force RTS-CTS to always 82464cbb24SAlan Cox be enabled */ 830ffbbe25SOliver Neukum 84557aaa7fSAlan Cox unsigned int latency; /* latency setting in use */ 85895f28baSMark Adamson unsigned short max_packet_size; 869c67d28eSAlessio Igor Bogani struct mutex cfg_lock; /* Avoid mess by parallel calls of config ioctl() and change_speed() */ 870ffbbe25SOliver Neukum }; 880ffbbe25SOliver Neukum 898f977e42SIan Abbott /* struct ftdi_sio_quirk is used by devices requiring special attention. */ 908f977e42SIan Abbott struct ftdi_sio_quirk { 91fa91d43bSTony Lindgren int (*probe)(struct usb_serial *); 92464cbb24SAlan Cox /* Special settings for probed ports. */ 93464cbb24SAlan Cox void (*port_probe)(struct ftdi_private *); 948f977e42SIan Abbott }; 958f977e42SIan Abbott 9620734345SHarald Welte static int ftdi_jtag_probe(struct usb_serial *serial); 97546d7eecSKevin Vance static int ftdi_mtxorb_hack_setup(struct usb_serial *serial); 98b760dac2SMartin Geleynse static int ftdi_NDI_device_setup(struct usb_serial *serial); 996ec2f46cSJean-Christophe PLAGNIOL-VILLARD static int ftdi_stmclite_probe(struct usb_serial *serial); 100c96fbdd0SJean-Christophe PLAGNIOL-VILLARD static int ftdi_8u2232c_probe(struct usb_serial *serial); 1010ffbbe25SOliver Neukum static void ftdi_USB_UIRT_setup(struct ftdi_private *priv); 1020ffbbe25SOliver Neukum static void ftdi_HE_TIRA1_setup(struct ftdi_private *priv); 1038f977e42SIan Abbott 10420734345SHarald Welte static struct ftdi_sio_quirk ftdi_jtag_quirk = { 10520734345SHarald Welte .probe = ftdi_jtag_probe, 106fa91d43bSTony Lindgren }; 107fa91d43bSTony Lindgren 108546d7eecSKevin Vance static struct ftdi_sio_quirk ftdi_mtxorb_hack_quirk = { 109546d7eecSKevin Vance .probe = ftdi_mtxorb_hack_setup, 110546d7eecSKevin Vance }; 111546d7eecSKevin Vance 112b760dac2SMartin Geleynse static struct ftdi_sio_quirk ftdi_NDI_device_quirk = { 113b760dac2SMartin Geleynse .probe = ftdi_NDI_device_setup, 114b760dac2SMartin Geleynse }; 115b760dac2SMartin Geleynse 1168f977e42SIan Abbott static struct ftdi_sio_quirk ftdi_USB_UIRT_quirk = { 1170ffbbe25SOliver Neukum .port_probe = ftdi_USB_UIRT_setup, 1188f977e42SIan Abbott }; 1198f977e42SIan Abbott 1208f977e42SIan Abbott static struct ftdi_sio_quirk ftdi_HE_TIRA1_quirk = { 1210ffbbe25SOliver Neukum .port_probe = ftdi_HE_TIRA1_setup, 1221da177e4SLinus Torvalds }; 1231da177e4SLinus Torvalds 1246ec2f46cSJean-Christophe PLAGNIOL-VILLARD static struct ftdi_sio_quirk ftdi_stmclite_quirk = { 1256ec2f46cSJean-Christophe PLAGNIOL-VILLARD .probe = ftdi_stmclite_probe, 1266ec2f46cSJean-Christophe PLAGNIOL-VILLARD }; 1276ec2f46cSJean-Christophe PLAGNIOL-VILLARD 128c96fbdd0SJean-Christophe PLAGNIOL-VILLARD static struct ftdi_sio_quirk ftdi_8u2232c_quirk = { 129c96fbdd0SJean-Christophe PLAGNIOL-VILLARD .probe = ftdi_8u2232c_probe, 130c96fbdd0SJean-Christophe PLAGNIOL-VILLARD }; 131c96fbdd0SJean-Christophe PLAGNIOL-VILLARD 1321da177e4SLinus Torvalds /* 1331da177e4SLinus Torvalds * The 8U232AM has the same API as the sio except for: 1341da177e4SLinus Torvalds * - it can support MUCH higher baudrates; up to: 1351da177e4SLinus Torvalds * o 921600 for RS232 and 2000000 for RS422/485 at 48MHz 1361da177e4SLinus Torvalds * o 230400 at 12MHz 1371da177e4SLinus Torvalds * so .. 8U232AM's baudrate setting codes are different 1381da177e4SLinus Torvalds * - it has a two byte status code. 1391da177e4SLinus Torvalds * - it returns characters every 16ms (the FTDI does it every 40ms) 1401da177e4SLinus Torvalds * 1411da177e4SLinus Torvalds * the bcdDevice value is used to differentiate FT232BM and FT245BM from 1421da177e4SLinus Torvalds * the earlier FT8U232AM and FT8U232BM. For now, include all known VID/PID 1431da177e4SLinus Torvalds * combinations in both tables. 1448f977e42SIan Abbott * FIXME: perhaps bcdDevice can also identify 12MHz FT8U232AM devices, 1458f977e42SIan Abbott * but I don't know if those ever went into mass production. [Ian Abbott] 1461da177e4SLinus Torvalds */ 1471da177e4SLinus Torvalds 1481da177e4SLinus Torvalds 1491da177e4SLinus Torvalds 15065e1ec67SAndreas Mohr /* 15165e1ec67SAndreas Mohr * Device ID not listed? Test via module params product/vendor or 15265e1ec67SAndreas Mohr * /sys/bus/usb/ftdi_sio/new_id, then send patch/report! 15365e1ec67SAndreas Mohr */ 1541da177e4SLinus Torvalds static struct usb_device_id id_table_combined [] = { 155ce7e9065SArtur Zimmer { USB_DEVICE(FTDI_VID, FTDI_ZEITCONTROL_TAGTRACE_MIFARE_PID) }, 1565a9443f0SChristian Simon { USB_DEVICE(FTDI_VID, FTDI_CTI_MINI_PID) }, 1575a9443f0SChristian Simon { USB_DEVICE(FTDI_VID, FTDI_CTI_NANO_PID) }, 1582011e924SJonathan Davies { USB_DEVICE(FTDI_VID, FTDI_AMC232_PID) }, 1592011e924SJonathan Davies { USB_DEVICE(FTDI_VID, FTDI_CANUSB_PID) }, 16001ba0856SAndrew Ewert { USB_DEVICE(FTDI_VID, FTDI_CANDAPTER_PID) }, 16165e1ec67SAndreas Mohr { USB_DEVICE(FTDI_VID, FTDI_NXTCAM_PID) }, 1626e1ab3edSPeter Mack { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_0_PID) }, 1636e1ab3edSPeter Mack { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_1_PID) }, 1646e1ab3edSPeter Mack { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_2_PID) }, 1656e1ab3edSPeter Mack { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_3_PID) }, 1666e1ab3edSPeter Mack { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_4_PID) }, 1676e1ab3edSPeter Mack { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_5_PID) }, 1686e1ab3edSPeter Mack { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_6_PID) }, 1696e1ab3edSPeter Mack { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_7_PID) }, 170b6180ef7Sdranch@trinnet.net { USB_DEVICE(FTDI_VID, FTDI_USINT_CAT_PID) }, 171b6180ef7Sdranch@trinnet.net { USB_DEVICE(FTDI_VID, FTDI_USINT_WKEY_PID) }, 172b6180ef7Sdranch@trinnet.net { USB_DEVICE(FTDI_VID, FTDI_USINT_RS232_PID) }, 17372a9f958SRazvan Gavril { USB_DEVICE(FTDI_VID, FTDI_ACTZWAVE_PID) }, 1741da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, FTDI_IRTRANS_PID) }, 17569737dfaSLuiz Fernando N. Capitulino { USB_DEVICE(FTDI_VID, FTDI_IPLUS_PID) }, 176d099321bSLuiz Fernando N. Capitulino { USB_DEVICE(FTDI_VID, FTDI_IPLUS2_PID) }, 177fad14a0dSFrank Sievertsen { USB_DEVICE(FTDI_VID, FTDI_DMX4ALL) }, 1781da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, FTDI_SIO_PID) }, 1791da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, FTDI_8U232AM_PID) }, 1801da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, FTDI_8U232AM_ALT_PID) }, 181d8b21606SGard Spreemann { USB_DEVICE(FTDI_VID, FTDI_232RL_PID) }, 182c96fbdd0SJean-Christophe PLAGNIOL-VILLARD { USB_DEVICE(FTDI_VID, FTDI_8U2232C_PID) , 183c96fbdd0SJean-Christophe PLAGNIOL-VILLARD .driver_info = (kernel_ulong_t)&ftdi_8u2232c_quirk }, 184094c2e6dSMark Adamson { USB_DEVICE(FTDI_VID, FTDI_4232H_PID) }, 185309427b6SUwe Bonnes { USB_DEVICE(FTDI_VID, FTDI_232H_PID) }, 186dc0827c1SJim Paris { USB_DEVICE(FTDI_VID, FTDI_FTX_PID) }, 187c0f8d561SChristophe Mariac { USB_DEVICE(FTDI_VID, FTDI_MICRO_CHAMELEON_PID) }, 1881da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, FTDI_RELAIS_PID) }, 1892adb80e9SGuido Scholz { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_PID) }, 190ec3815c3Smail@rainerkeller.de { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_SNIFFER_PID) }, 191ec3815c3Smail@rainerkeller.de { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_THROTTLE_PID) }, 192ec3815c3Smail@rainerkeller.de { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GATEWAY_PID) }, 19399c1e4f8SRainer Keller { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GBM_PID) }, 1941da177e4SLinus Torvalds { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) }, 1951da177e4SLinus Torvalds { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) }, 196f2ee6955SAlan Cox { USB_DEVICE(FTDI_VID, FTDI_SPROG_II) }, 197ea233f80SGalen Seitz { USB_DEVICE(FTDI_VID, FTDI_LENZ_LIUSB_PID) }, 1981da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, FTDI_XF_632_PID) }, 1991da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, FTDI_XF_634_PID) }, 2001da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, FTDI_XF_547_PID) }, 2011da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, FTDI_XF_633_PID) }, 2021da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, FTDI_XF_631_PID) }, 2031da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, FTDI_XF_635_PID) }, 2041da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, FTDI_XF_640_PID) }, 2051da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, FTDI_XF_642_PID) }, 2061da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, FTDI_DSS20_PID) }, 20774bdf22bSHakan Kvist { USB_DEVICE(FTDI_VID, FTDI_URBAN_0_PID) }, 20874bdf22bSHakan Kvist { USB_DEVICE(FTDI_VID, FTDI_URBAN_1_PID) }, 2091da177e4SLinus Torvalds { USB_DEVICE(FTDI_NF_RIC_VID, FTDI_NF_RIC_PID) }, 2101da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, FTDI_VNHCPCUSB_D_PID) }, 2118f977e42SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_MTXORB_0_PID) }, 2128f977e42SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_MTXORB_1_PID) }, 2138f977e42SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_MTXORB_2_PID) }, 2148f977e42SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_MTXORB_3_PID) }, 2158f977e42SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_MTXORB_4_PID) }, 2168f977e42SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_MTXORB_5_PID) }, 2178f977e42SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) }, 218b34efeeaSFolkert van Heusden { USB_DEVICE(FTDI_VID, FTDI_R2000KU_TRUE_RNG) }, 2196fdbad80SJacques Viviers { USB_DEVICE(FTDI_VID, FTDI_VARDAAN_PID) }, 220ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0100_PID) }, 221ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0101_PID) }, 222ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0102_PID) }, 223ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0103_PID) }, 224ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0104_PID) }, 225ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0105_PID) }, 226ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0106_PID) }, 227ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0107_PID) }, 228ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0108_PID) }, 229ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0109_PID) }, 230ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_010A_PID) }, 231ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_010B_PID) }, 232ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_010C_PID) }, 233ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_010D_PID) }, 234ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_010E_PID) }, 235ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_010F_PID) }, 236ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0110_PID) }, 237ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0111_PID) }, 238ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0112_PID) }, 239ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0113_PID) }, 240ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0114_PID) }, 241ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0115_PID) }, 242ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0116_PID) }, 243ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0117_PID) }, 244ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0118_PID) }, 245ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0119_PID) }, 246ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_011A_PID) }, 247ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_011B_PID) }, 248ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_011C_PID) }, 249ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_011D_PID) }, 250ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_011E_PID) }, 251ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_011F_PID) }, 252ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0120_PID) }, 253ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0121_PID) }, 254ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0122_PID) }, 255ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0123_PID) }, 256ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0124_PID) }, 257ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0125_PID) }, 258ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0126_PID) }, 259ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0127_PID), 260546d7eecSKevin Vance .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, 261ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0128_PID) }, 262ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0129_PID) }, 263ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012A_PID) }, 264ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012B_PID) }, 265ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012C_PID), 266ebb3770cSRay Molenkamp .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, 267ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012D_PID) }, 268ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012E_PID) }, 269ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012F_PID) }, 270ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0130_PID) }, 271ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0131_PID) }, 272ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0132_PID) }, 273ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0133_PID) }, 274ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0134_PID) }, 275ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0135_PID) }, 276ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0136_PID) }, 277ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0137_PID) }, 278ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0138_PID) }, 279ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0139_PID) }, 280ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_013A_PID) }, 281ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_013B_PID) }, 282ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_013C_PID) }, 283ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_013D_PID) }, 284ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_013E_PID) }, 285ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_013F_PID) }, 286ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0140_PID) }, 287ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0141_PID) }, 288ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0142_PID) }, 289ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0143_PID) }, 290ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0144_PID) }, 291ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0145_PID) }, 292ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0146_PID) }, 293ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0147_PID) }, 294ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0148_PID) }, 295ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0149_PID) }, 296ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_014A_PID) }, 297ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_014B_PID) }, 298ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_014C_PID) }, 299ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_014D_PID) }, 300ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_014E_PID) }, 301ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_014F_PID) }, 302ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0150_PID) }, 303ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0151_PID) }, 304ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0152_PID) }, 305ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0153_PID), 306ebb3770cSRay Molenkamp .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, 307ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0154_PID), 308ebb3770cSRay Molenkamp .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, 309ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0155_PID), 310ebb3770cSRay Molenkamp .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, 311ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0156_PID), 312ebb3770cSRay Molenkamp .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, 313ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0157_PID), 314ebb3770cSRay Molenkamp .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, 315ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0158_PID), 316ebb3770cSRay Molenkamp .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, 317ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0159_PID) }, 318ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_015A_PID) }, 319ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_015B_PID) }, 320ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_015C_PID) }, 321ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_015D_PID) }, 322ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_015E_PID) }, 323ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_015F_PID) }, 324ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0160_PID) }, 325ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0161_PID) }, 326ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0162_PID) }, 327ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0163_PID) }, 328ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0164_PID) }, 329ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0165_PID) }, 330ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0166_PID) }, 331ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0167_PID) }, 332ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0168_PID) }, 333ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0169_PID) }, 334ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_016A_PID) }, 335ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_016B_PID) }, 336ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_016C_PID) }, 337ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_016D_PID) }, 338ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_016E_PID) }, 339ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_016F_PID) }, 340ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0170_PID) }, 341ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0171_PID) }, 342ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0172_PID) }, 343ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0173_PID) }, 344ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0174_PID) }, 345ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0175_PID) }, 346ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0176_PID) }, 347ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0177_PID) }, 348ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0178_PID) }, 349ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0179_PID) }, 350ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_017A_PID) }, 351ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_017B_PID) }, 352ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_017C_PID) }, 353ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_017D_PID) }, 354ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_017E_PID) }, 355ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_017F_PID) }, 356ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0180_PID) }, 357ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0181_PID) }, 358ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0182_PID) }, 359ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0183_PID) }, 360ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0184_PID) }, 361ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0185_PID) }, 362ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0186_PID) }, 363ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0187_PID) }, 364ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0188_PID) }, 365ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0189_PID) }, 366ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_018A_PID) }, 367ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_018B_PID) }, 368ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_018C_PID) }, 369ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_018D_PID) }, 370ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_018E_PID) }, 371ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_018F_PID) }, 372ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0190_PID) }, 373ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0191_PID) }, 374ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0192_PID) }, 375ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0193_PID) }, 376ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0194_PID) }, 377ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0195_PID) }, 378ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0196_PID) }, 379ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0197_PID) }, 380ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0198_PID) }, 381ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0199_PID) }, 382ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_019A_PID) }, 383ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_019B_PID) }, 384ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_019C_PID) }, 385ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_019D_PID) }, 386ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_019E_PID) }, 387ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_019F_PID) }, 388ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A0_PID) }, 389ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A1_PID) }, 390ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A2_PID) }, 391ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A3_PID) }, 392ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A4_PID) }, 393ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A5_PID) }, 394ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A6_PID) }, 395ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A7_PID) }, 396ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A8_PID) }, 397ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01A9_PID) }, 398ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01AA_PID) }, 399ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01AB_PID) }, 400ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01AC_PID) }, 401ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01AD_PID) }, 402ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01AE_PID) }, 403ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01AF_PID) }, 404ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B0_PID) }, 405ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B1_PID) }, 406ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B2_PID) }, 407ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B3_PID) }, 408ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B4_PID) }, 409ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B5_PID) }, 410ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B6_PID) }, 411ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B7_PID) }, 412ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B8_PID) }, 413ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01B9_PID) }, 414ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01BA_PID) }, 415ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01BB_PID) }, 416ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01BC_PID) }, 417ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01BD_PID) }, 418ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01BE_PID) }, 419ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01BF_PID) }, 420ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C0_PID) }, 421ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C1_PID) }, 422ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C2_PID) }, 423ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C3_PID) }, 424ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C4_PID) }, 425ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C5_PID) }, 426ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C6_PID) }, 427ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C7_PID) }, 428ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C8_PID) }, 429ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01C9_PID) }, 430ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01CA_PID) }, 431ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01CB_PID) }, 432ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01CC_PID) }, 433ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01CD_PID) }, 434ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01CE_PID) }, 435ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01CF_PID) }, 436ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D0_PID) }, 437ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D1_PID) }, 438ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D2_PID) }, 439ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D3_PID) }, 440ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D4_PID) }, 441ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D5_PID) }, 442ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D6_PID) }, 443ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D7_PID) }, 444ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D8_PID) }, 445ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01D9_PID) }, 446ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01DA_PID) }, 447ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01DB_PID) }, 448ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01DC_PID) }, 449ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01DD_PID) }, 450ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01DE_PID) }, 451ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01DF_PID) }, 452ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E0_PID) }, 453ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E1_PID) }, 454ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E2_PID) }, 455ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E3_PID) }, 456ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E4_PID) }, 457ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E5_PID) }, 458ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E6_PID) }, 459ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E7_PID) }, 460ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E8_PID) }, 461ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01E9_PID) }, 462ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01EA_PID) }, 463ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01EB_PID) }, 464ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01EC_PID) }, 465ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01ED_PID) }, 466ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01EE_PID) }, 467ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01EF_PID) }, 468ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F0_PID) }, 469ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F1_PID) }, 470ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F2_PID) }, 471ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F3_PID) }, 472ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F4_PID) }, 473ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F5_PID) }, 474ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F6_PID) }, 475ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F7_PID) }, 476ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F8_PID) }, 477ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01F9_PID) }, 478ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FA_PID) }, 479ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FB_PID) }, 480ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FC_PID) }, 481ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FD_PID) }, 482ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FE_PID) }, 483ebb3770cSRay Molenkamp { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FF_PID) }, 4848f977e42SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) }, 4851da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) }, 486274a4bbcSDave Platt { USB_DEVICE(FTDI_VID, FTDI_TNC_X_PID) }, 487868e440dSJelle Foks { USB_DEVICE(FTDI_VID, FTDI_USBX_707_PID) }, 4881da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2101_PID) }, 4891da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2102_PID) }, 4901da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2103_PID) }, 4911da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2104_PID) }, 492a1484827SJustin Carlson { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2106_PID) }, 4931da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2201_1_PID) }, 4941da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2201_2_PID) }, 4951da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2202_1_PID) }, 4961da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2202_2_PID) }, 4971da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2203_1_PID) }, 4981da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2203_2_PID) }, 4991da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2401_1_PID) }, 5001da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2401_2_PID) }, 5011da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2401_3_PID) }, 5021da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2401_4_PID) }, 5031da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2402_1_PID) }, 5041da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2402_2_PID) }, 5051da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2402_3_PID) }, 5061da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2402_4_PID) }, 5071da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2403_1_PID) }, 5081da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2403_2_PID) }, 5091da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2403_3_PID) }, 5101da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2403_4_PID) }, 5111da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2801_1_PID) }, 5121da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2801_2_PID) }, 5131da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2801_3_PID) }, 5141da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2801_4_PID) }, 5151da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2801_5_PID) }, 5161da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2801_6_PID) }, 5171da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2801_7_PID) }, 5181da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2801_8_PID) }, 5191da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2802_1_PID) }, 5201da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2802_2_PID) }, 5211da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2802_3_PID) }, 5221da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2802_4_PID) }, 5231da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2802_5_PID) }, 5241da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2802_6_PID) }, 5251da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2802_7_PID) }, 5261da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2802_8_PID) }, 5271da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_1_PID) }, 5281da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_2_PID) }, 5291da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_3_PID) }, 5301da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_4_PID) }, 5311da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_5_PID) }, 5321da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_6_PID) }, 5331da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_7_PID) }, 5341da177e4SLinus Torvalds { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_8_PID) }, 5356d161b99SScott Dial { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803R_1_PID) }, 5366d161b99SScott Dial { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803R_2_PID) }, 5376d161b99SScott Dial { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803R_3_PID) }, 5386d161b99SScott Dial { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803R_4_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) }, 58154575b05SAntonio Ospite { USB_DEVICE(FTDI_VID, FTDI_TIAO_UMPA_PID), 58254575b05SAntonio Ospite .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 583e6ac4a40SIan Abbott /* 58465e1ec67SAndreas Mohr * ELV devices: 585e6ac4a40SIan Abbott */ 58665e1ec67SAndreas Mohr { USB_DEVICE(FTDI_VID, FTDI_ELV_USR_PID) }, 58765e1ec67SAndreas Mohr { USB_DEVICE(FTDI_VID, FTDI_ELV_MSM1_PID) }, 58865e1ec67SAndreas Mohr { USB_DEVICE(FTDI_VID, FTDI_ELV_KL100_PID) }, 58965e1ec67SAndreas Mohr { USB_DEVICE(FTDI_VID, FTDI_ELV_WS550_PID) }, 59065e1ec67SAndreas Mohr { USB_DEVICE(FTDI_VID, FTDI_ELV_EC3000_PID) }, 59165e1ec67SAndreas Mohr { USB_DEVICE(FTDI_VID, FTDI_ELV_WS888_PID) }, 59265e1ec67SAndreas Mohr { USB_DEVICE(FTDI_VID, FTDI_ELV_TWS550_PID) }, 59365e1ec67SAndreas Mohr { USB_DEVICE(FTDI_VID, FTDI_ELV_FEM_PID) }, 59442f8aa94SPeter Stark { USB_DEVICE(FTDI_VID, FTDI_ELV_CLI7000_PID) }, 59542f8aa94SPeter Stark { USB_DEVICE(FTDI_VID, FTDI_ELV_PPS7330_PID) }, 59642f8aa94SPeter Stark { USB_DEVICE(FTDI_VID, FTDI_ELV_TFM100_PID) }, 59742f8aa94SPeter Stark { USB_DEVICE(FTDI_VID, FTDI_ELV_UDF77_PID) }, 59842f8aa94SPeter Stark { USB_DEVICE(FTDI_VID, FTDI_ELV_UIO88_PID) }, 59942f8aa94SPeter Stark { USB_DEVICE(FTDI_VID, FTDI_ELV_UAD8_PID) }, 60042f8aa94SPeter Stark { USB_DEVICE(FTDI_VID, FTDI_ELV_UDA7_PID) }, 60142f8aa94SPeter Stark { USB_DEVICE(FTDI_VID, FTDI_ELV_USI2_PID) }, 60242f8aa94SPeter Stark { USB_DEVICE(FTDI_VID, FTDI_ELV_T1100_PID) }, 60342f8aa94SPeter Stark { USB_DEVICE(FTDI_VID, FTDI_ELV_PCD200_PID) }, 60442f8aa94SPeter Stark { USB_DEVICE(FTDI_VID, FTDI_ELV_ULA200_PID) }, 60542f8aa94SPeter Stark { USB_DEVICE(FTDI_VID, FTDI_ELV_CSI8_PID) }, 60642f8aa94SPeter Stark { USB_DEVICE(FTDI_VID, FTDI_ELV_EM1000DL_PID) }, 60742f8aa94SPeter Stark { USB_DEVICE(FTDI_VID, FTDI_ELV_PCK100_PID) }, 60842f8aa94SPeter Stark { USB_DEVICE(FTDI_VID, FTDI_ELV_RFP500_PID) }, 60942f8aa94SPeter Stark { USB_DEVICE(FTDI_VID, FTDI_ELV_FS20SIG_PID) }, 61065e1ec67SAndreas Mohr { USB_DEVICE(FTDI_VID, FTDI_ELV_UTP8_PID) }, 61142f8aa94SPeter Stark { USB_DEVICE(FTDI_VID, FTDI_ELV_WS300PC_PID) }, 61265e1ec67SAndreas Mohr { USB_DEVICE(FTDI_VID, FTDI_ELV_WS444PC_PID) }, 61342f8aa94SPeter Stark { USB_DEVICE(FTDI_VID, FTDI_ELV_FHZ1300PC_PID) }, 6144ae897dfSSven Andersen { USB_DEVICE(FTDI_VID, FTDI_ELV_EM1010PC_PID) }, 61542f8aa94SPeter Stark { USB_DEVICE(FTDI_VID, FTDI_ELV_WS500_PID) }, 616b5894a50SAndré Schenk { USB_DEVICE(FTDI_VID, FTDI_ELV_HS485_PID) }, 61765e1ec67SAndreas Mohr { USB_DEVICE(FTDI_VID, FTDI_ELV_UMS100_PID) }, 61865e1ec67SAndreas Mohr { USB_DEVICE(FTDI_VID, FTDI_ELV_TFD128_PID) }, 61965e1ec67SAndreas Mohr { USB_DEVICE(FTDI_VID, FTDI_ELV_FM3RX_PID) }, 62065e1ec67SAndreas Mohr { USB_DEVICE(FTDI_VID, FTDI_ELV_WS777_PID) }, 6218f977e42SIan Abbott { USB_DEVICE(FTDI_VID, LINX_SDMUSBQSS_PID) }, 6228f977e42SIan Abbott { USB_DEVICE(FTDI_VID, LINX_MASTERDEVEL2_PID) }, 6238f977e42SIan Abbott { USB_DEVICE(FTDI_VID, LINX_FUTURE_0_PID) }, 6248f977e42SIan Abbott { USB_DEVICE(FTDI_VID, LINX_FUTURE_1_PID) }, 6258f977e42SIan Abbott { USB_DEVICE(FTDI_VID, LINX_FUTURE_2_PID) }, 6261da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, FTDI_CCSICDU20_0_PID) }, 6271da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, FTDI_CCSICDU40_1_PID) }, 628ec434e9bSJan Capek { USB_DEVICE(FTDI_VID, FTDI_CCSMACHX_2_PID) }, 6299d37ff64SJan Capek { USB_DEVICE(FTDI_VID, FTDI_CCSLOAD_N_GO_3_PID) }, 6309d37ff64SJan Capek { USB_DEVICE(FTDI_VID, FTDI_CCSICDU64_4_PID) }, 6319d37ff64SJan Capek { USB_DEVICE(FTDI_VID, FTDI_CCSPRIME8_5_PID) }, 6321da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, INSIDE_ACCESSO) }, 6331da177e4SLinus Torvalds { USB_DEVICE(INTREPID_VID, INTREPID_VALUECAN_PID) }, 6341da177e4SLinus Torvalds { USB_DEVICE(INTREPID_VID, INTREPID_NEOVI_PID) }, 6351da177e4SLinus Torvalds { USB_DEVICE(FALCOM_VID, FALCOM_TWIST_PID) }, 636e6ac4a40SIan Abbott { USB_DEVICE(FALCOM_VID, FALCOM_SAMBA_PID) }, 6371da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, FTDI_SUUNTO_SPORTS_PID) }, 638c3d36c45SVladimir Vukicevic { USB_DEVICE(FTDI_VID, FTDI_OCEANIC_PID) }, 639ef31fec0SMichael Olberg { USB_DEVICE(TTI_VID, TTI_QL355P_PID) }, 6406f92872cSIan Abbott { USB_DEVICE(FTDI_VID, FTDI_RM_CANVIEW_PID) }, 64128fe2eb0SMichael Williamson { USB_DEVICE(ACTON_VID, ACTON_SPECTRAPRO_PID) }, 64246b72d78SDaniel Sangorrin { USB_DEVICE(CONTEC_VID, CONTEC_COM1USBH_PID) }, 6431da177e4SLinus Torvalds { USB_DEVICE(BANDB_VID, BANDB_USOTL4_PID) }, 6441da177e4SLinus Torvalds { USB_DEVICE(BANDB_VID, BANDB_USTL4_PID) }, 6451da177e4SLinus Torvalds { USB_DEVICE(BANDB_VID, BANDB_USO9ML2_PID) }, 646a8cbd90aSCliff Brake { USB_DEVICE(BANDB_VID, BANDB_USOPTL4_PID) }, 647a8cbd90aSCliff Brake { USB_DEVICE(BANDB_VID, BANDB_USPTL4_PID) }, 648a8cbd90aSCliff Brake { USB_DEVICE(BANDB_VID, BANDB_USO9ML2DR_2_PID) }, 649a8cbd90aSCliff Brake { USB_DEVICE(BANDB_VID, BANDB_USO9ML2DR_PID) }, 650a8cbd90aSCliff Brake { USB_DEVICE(BANDB_VID, BANDB_USOPTL4DR2_PID) }, 651a8cbd90aSCliff Brake { USB_DEVICE(BANDB_VID, BANDB_USOPTL4DR_PID) }, 652a8cbd90aSCliff Brake { USB_DEVICE(BANDB_VID, BANDB_485USB9F_2W_PID) }, 653a8cbd90aSCliff Brake { USB_DEVICE(BANDB_VID, BANDB_485USB9F_4W_PID) }, 654a8cbd90aSCliff Brake { USB_DEVICE(BANDB_VID, BANDB_232USB9M_PID) }, 655a8cbd90aSCliff Brake { USB_DEVICE(BANDB_VID, BANDB_485USBTB_2W_PID) }, 656a8cbd90aSCliff Brake { USB_DEVICE(BANDB_VID, BANDB_485USBTB_4W_PID) }, 657a8cbd90aSCliff Brake { USB_DEVICE(BANDB_VID, BANDB_TTL5USB9M_PID) }, 658a8cbd90aSCliff Brake { USB_DEVICE(BANDB_VID, BANDB_TTL3USB9M_PID) }, 659a8cbd90aSCliff Brake { USB_DEVICE(BANDB_VID, BANDB_ZZ_PROG1_USB_PID) }, 6601da177e4SLinus Torvalds { USB_DEVICE(FTDI_VID, EVER_ECO_PRO_CDS) }, 6616f92872cSIan Abbott { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_1_PID) }, 6626f92872cSIan Abbott { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_2_PID) }, 663a26d31ceSSteffen Sledz { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_3_PID) }, 664e6ac4a40SIan Abbott { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_0_PID) }, 665e6ac4a40SIan Abbott { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_1_PID) }, 666e6ac4a40SIan Abbott { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_2_PID) }, 667e6ac4a40SIan Abbott { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_3_PID) }, 668e6ac4a40SIan Abbott { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_4_PID) }, 669e6ac4a40SIan Abbott { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_5_PID) }, 670e6ac4a40SIan Abbott { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_6_PID) }, 671e6ac4a40SIan Abbott { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_7_PID) }, 6726f92872cSIan Abbott { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) }, 6738f977e42SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_ACTIVE_ROBOTS_PID) }, 67434d1a8aaSIan Abbott { USB_DEVICE(FTDI_VID, FTDI_MHAM_KW_PID) }, 67534d1a8aaSIan Abbott { USB_DEVICE(FTDI_VID, FTDI_MHAM_YS_PID) }, 6769b1513d9SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_MHAM_Y6_PID) }, 6779b1513d9SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_MHAM_Y8_PID) }, 67834d1a8aaSIan Abbott { USB_DEVICE(FTDI_VID, FTDI_MHAM_IC_PID) }, 67934d1a8aaSIan Abbott { USB_DEVICE(FTDI_VID, FTDI_MHAM_DB9_PID) }, 68034d1a8aaSIan Abbott { USB_DEVICE(FTDI_VID, FTDI_MHAM_RS232_PID) }, 68134d1a8aaSIan Abbott { USB_DEVICE(FTDI_VID, FTDI_MHAM_Y9_PID) }, 682740a4282SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_TERATRONIK_VCP_PID) }, 683740a4282SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_TERATRONIK_D2XX_PID) }, 6849b1513d9SIan Abbott { USB_DEVICE(EVOLUTION_VID, EVOLUTION_ER1_PID) }, 685c1f8ea7dSSøren Hauberg { USB_DEVICE(EVOLUTION_VID, EVO_HYBRID_PID) }, 686c1f8ea7dSSøren Hauberg { USB_DEVICE(EVOLUTION_VID, EVO_RCM4_PID) }, 687c9c7746dSRui Santos { USB_DEVICE(FTDI_VID, FTDI_ARTEMIS_PID) }, 688c9c7746dSRui Santos { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16_PID) }, 68909c280a2SRui Santos { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16C_PID) }, 690c9c7746dSRui Santos { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16HR_PID) }, 69109c280a2SRui Santos { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16HRC_PID) }, 69234910434SFranco Lanza { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16IC_PID) }, 693b4723ae3SIan Abbott { USB_DEVICE(KOBIL_VID, KOBIL_CONV_B1_PID) }, 694b4723ae3SIan Abbott { USB_DEVICE(KOBIL_VID, KOBIL_CONV_KAAN_PID) }, 695effac8beSPavel Fedin { USB_DEVICE(POSIFLEX_VID, POSIFLEX_PP7000_PID) }, 696641adaaeSLouis Nyffenegger { USB_DEVICE(FTDI_VID, FTDI_TTUSB_PID) }, 6977e1c0b86SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_ECLO_COM_1WIRE_PID) }, 698a94b52acSIan Abbott { USB_DEVICE(FTDI_VID, FTDI_WESTREX_MODEL_777_PID) }, 699a94b52acSIan Abbott { USB_DEVICE(FTDI_VID, FTDI_WESTREX_MODEL_8900F_PID) }, 700ce40d290SWouter Paesen { USB_DEVICE(FTDI_VID, FTDI_PCDJ_DAC2_PID) }, 701cdd3b156SNathan Bronson { USB_DEVICE(FTDI_VID, FTDI_RRCIRKITS_LOCOBUFFER_PID) }, 7027e0258fdSIan Abbott { USB_DEVICE(FTDI_VID, FTDI_ASK_RDR400_PID) }, 70326a538b9SHorst Schirmeier { USB_DEVICE(FTDI_VID, FTDI_NZR_SEM_USB_PID) }, 704a9d61bc4SPieter Maes { USB_DEVICE(ICOM_VID, ICOM_ID_1_PID) }, 705a9d61bc4SPieter Maes { USB_DEVICE(ICOM_VID, ICOM_OPC_U_UC_PID) }, 706a9d61bc4SPieter Maes { USB_DEVICE(ICOM_VID, ICOM_ID_RP2C1_PID) }, 707a9d61bc4SPieter Maes { USB_DEVICE(ICOM_VID, ICOM_ID_RP2C2_PID) }, 708a9d61bc4SPieter Maes { USB_DEVICE(ICOM_VID, ICOM_ID_RP2D_PID) }, 709a9d61bc4SPieter Maes { USB_DEVICE(ICOM_VID, ICOM_ID_RP2VT_PID) }, 710a9d61bc4SPieter Maes { USB_DEVICE(ICOM_VID, ICOM_ID_RP2VR_PID) }, 711a9d61bc4SPieter Maes { USB_DEVICE(ICOM_VID, ICOM_ID_RP4KVT_PID) }, 712a9d61bc4SPieter Maes { USB_DEVICE(ICOM_VID, ICOM_ID_RP4KVR_PID) }, 713a9d61bc4SPieter Maes { USB_DEVICE(ICOM_VID, ICOM_ID_RP2KVT_PID) }, 714a9d61bc4SPieter Maes { USB_DEVICE(ICOM_VID, ICOM_ID_RP2KVR_PID) }, 71520a0f47eSIan Abbott { USB_DEVICE(FTDI_VID, FTDI_ACG_HFDUAL_PID) }, 716eb79b4fdSIan Abbott { USB_DEVICE(FTDI_VID, FTDI_YEI_SERVOCENTER31_PID) }, 71748437486SD. Peter Siddons { USB_DEVICE(FTDI_VID, FTDI_THORLABS_PID) }, 718e1979fefSColin Leroy { USB_DEVICE(TESTO_VID, TESTO_USB_INTERFACE_PID) }, 719eaede2cbSRalf Schlatterbeck { USB_DEVICE(FTDI_VID, FTDI_GAMMA_SCOUT_PID) }, 7209978f9e1SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_TACTRIX_OPENPORT_13M_PID) }, 7219978f9e1SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_TACTRIX_OPENPORT_13S_PID) }, 7229978f9e1SIan Abbott { USB_DEVICE(FTDI_VID, FTDI_TACTRIX_OPENPORT_13U_PID) }, 72340c36092SKjell Myksvoll { USB_DEVICE(ELEKTOR_VID, ELEKTOR_FT323R_PID) }, 724b760dac2SMartin Geleynse { USB_DEVICE(FTDI_VID, FTDI_NDI_HUC_PID), 725b760dac2SMartin Geleynse .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, 726b760dac2SMartin Geleynse { USB_DEVICE(FTDI_VID, FTDI_NDI_SPECTRA_SCU_PID), 727b760dac2SMartin Geleynse .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, 728b760dac2SMartin Geleynse { USB_DEVICE(FTDI_VID, FTDI_NDI_FUTURE_2_PID), 729b760dac2SMartin Geleynse .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, 730b760dac2SMartin Geleynse { USB_DEVICE(FTDI_VID, FTDI_NDI_FUTURE_3_PID), 731b760dac2SMartin Geleynse .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, 732b760dac2SMartin Geleynse { USB_DEVICE(FTDI_VID, FTDI_NDI_AURORA_SCU_PID), 733b760dac2SMartin Geleynse .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, 734822c7ef4SMicke Prag { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, 735fcc6cb78SCorey Minyard { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_SERIAL_VX7_PID) }, 73628942bb6SMichael Stuermer { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_CT29B_PID) }, 737e00a54d7SEvan McNabb { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_RTS01_PID) }, 738762e92faSNeil \"Superna\" ARMSTRONG { USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) }, 739a5f62399SLex Ross { USB_DEVICE(FTDI_VID, FTDI_PHI_FISCO_PID) }, 740d7fde2d6SPierre Castella { USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) }, 7414bb0ef19SEd Beroset { USB_DEVICE(FTDI_VID, FTDI_ELSTER_UNICOM_PID) }, 74211171d1bSMirko Bordignon { USB_DEVICE(FTDI_VID, FTDI_PROPOX_JTAGCABLEII_PID) }, 743307369b0SMarcin Kościelnicki { USB_DEVICE(FTDI_VID, FTDI_PROPOX_ISPCABLEIII_PID) }, 744fa91d43bSTony Lindgren { USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_PID), 74520734345SHarald Welte .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 746b88ccf6fSJF Argentino { USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_H_PID), 747b88ccf6fSJF Argentino .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 74820734345SHarald Welte { USB_DEVICE(FIC_VID, FIC_NEO1973_DEBUG_PID), 74920734345SHarald Welte .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 75020734345SHarald Welte { USB_DEVICE(FTDI_VID, FTDI_OOCDLINK_PID), 75120734345SHarald Welte .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 752a00c3cadSFrederik Kriewitz { USB_DEVICE(FTDI_VID, LMI_LM3S_DEVEL_BOARD_PID), 753a00c3cadSFrederik Kriewitz .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 754a00c3cadSFrederik Kriewitz { USB_DEVICE(FTDI_VID, LMI_LM3S_EVAL_BOARD_PID), 755a00c3cadSFrederik Kriewitz .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 7563687f641SPeter Stuge { USB_DEVICE(FTDI_VID, LMI_LM3S_ICDI_BOARD_PID), 7573687f641SPeter Stuge .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 75814511412SKrzysztof Halasa { USB_DEVICE(FTDI_VID, FTDI_TURTELIZER_PID), 75914511412SKrzysztof Halasa .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 76026ab7053SAtsushi Nemoto { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) }, 7612542335cSJon K Hellan { USB_DEVICE(FTDI_VID, FTDI_REU_TINY_PID) }, 76259c6ccd9SDaniel Suchy 76359c6ccd9SDaniel Suchy /* Papouch devices based on FTDI chip */ 76459c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB485_PID) }, 76559c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_AP485_PID) }, 76659c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB422_PID) }, 76759c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB485_2_PID) }, 76859c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_AP485_2_PID) }, 76959c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB422_2_PID) }, 77059c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB485S_PID) }, 77159c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB485C_PID) }, 77259c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_LEC_PID) }, 77359c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB232_PID) }, 77459c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_TMU_PID) }, 77559c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_IRAMP_PID) }, 77659c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_DRAK5_PID) }, 77759c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO8x8_PID) }, 778a18f80b4SJaroslav Kysela { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO4x4_PID) }, 77959c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO2x2_PID) }, 78059c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO10x1_PID) }, 78159c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO30x3_PID) }, 78259c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO60x3_PID) }, 78359c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO2x16_PID) }, 78459c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO3x32_PID) }, 78559c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_DRAK6_PID) }, 78659c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_UPSUSB_PID) }, 78759c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_MU_PID) }, 78859c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SIMUKEY_PID) }, 789a7787e50SRadek Liboska { USB_DEVICE(PAPOUCH_VID, PAPOUCH_AD4USB_PID) }, 79059c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_GMUX_PID) }, 79159c6ccd9SDaniel Suchy { USB_DEVICE(PAPOUCH_VID, PAPOUCH_GMSR_PID) }, 79259c6ccd9SDaniel Suchy 79396285cb8SGaetan Carlier { USB_DEVICE(FTDI_VID, FTDI_DOMINTELL_DGQG_PID) }, 79496285cb8SGaetan Carlier { USB_DEVICE(FTDI_VID, FTDI_DOMINTELL_DUSB_PID) }, 79545eeff84SRobie Basak { USB_DEVICE(ALTI2_VID, ALTI2_N3_PID) }, 796ca80801bSMhayk Whandson { USB_DEVICE(FTDI_VID, DIEBOLD_BCS_SE923_PID) }, 7977f82b6ddSAxel Wachtler { USB_DEVICE(ATMEL_VID, STK541_PID) }, 7987f82b6ddSAxel Wachtler { USB_DEVICE(DE_VID, STB_PID) }, 7997f82b6ddSAxel Wachtler { USB_DEVICE(DE_VID, WHT_PID) }, 800b0d65900SMichael Hennerich { USB_DEVICE(ADI_VID, ADI_GNICE_PID), 801b0d65900SMichael Hennerich .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 80211eaf170SMichael Hennerich { USB_DEVICE(ADI_VID, ADI_GNICEPLUS_PID), 80311eaf170SMichael Hennerich .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 804f08dea73SBjørn Mork { USB_DEVICE_AND_INTERFACE_INFO(MICROCHIP_VID, MICROCHIP_USB_BOARD_PID, 805f08dea73SBjørn Mork USB_CLASS_VENDOR_SPEC, 806f08dea73SBjørn Mork USB_SUBCLASS_VENDOR_SPEC, 0x00) }, 807ae27d843SPeter Korsgaard { USB_DEVICE(JETI_VID, JETI_SPC1201_PID) }, 8081002bb77SNicolas Pitre { USB_DEVICE(MARVELL_VID, MARVELL_SHEEVAPLUG_PID), 8091002bb77SNicolas Pitre .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 810d46130abSDaniel Suchy { USB_DEVICE(LARSENBRUSGAARD_VID, LB_ALTITRACK_PID) }, 811fca4404cSVille Sundberg { USB_DEVICE(GN_OTOMETRICS_VID, AURICAL_USB_PID) }, 812dafc4f7bSÉric Piel { USB_DEVICE(FTDI_VID, PI_C865_PID) }, 813dafc4f7bSÉric Piel { USB_DEVICE(FTDI_VID, PI_C857_PID) }, 814dafc4f7bSÉric Piel { USB_DEVICE(PI_VID, PI_C866_PID) }, 815dafc4f7bSÉric Piel { USB_DEVICE(PI_VID, PI_C663_PID) }, 816dafc4f7bSÉric Piel { USB_DEVICE(PI_VID, PI_C725_PID) }, 817dafc4f7bSÉric Piel { USB_DEVICE(PI_VID, PI_E517_PID) }, 818dafc4f7bSÉric Piel { USB_DEVICE(PI_VID, PI_C863_PID) }, 819b69cc672SÉric Piel { USB_DEVICE(PI_VID, PI_E861_PID) }, 820dafc4f7bSÉric Piel { USB_DEVICE(PI_VID, PI_C867_PID) }, 821dafc4f7bSÉric Piel { USB_DEVICE(PI_VID, PI_E609_PID) }, 822dafc4f7bSÉric Piel { USB_DEVICE(PI_VID, PI_E709_PID) }, 823dafc4f7bSÉric Piel { USB_DEVICE(PI_VID, PI_100F_PID) }, 824dafc4f7bSÉric Piel { USB_DEVICE(PI_VID, PI_1011_PID) }, 825dafc4f7bSÉric Piel { USB_DEVICE(PI_VID, PI_1012_PID) }, 826dafc4f7bSÉric Piel { USB_DEVICE(PI_VID, PI_1013_PID) }, 827dafc4f7bSÉric Piel { USB_DEVICE(PI_VID, PI_1014_PID) }, 828dafc4f7bSÉric Piel { USB_DEVICE(PI_VID, PI_1015_PID) }, 829dafc4f7bSÉric Piel { USB_DEVICE(PI_VID, PI_1016_PID) }, 8307724a1edSOzan Çağlayan { USB_DEVICE(KONDO_VID, KONDO_USB_SERIAL_PID) }, 831c47aacc6SMarko Hänninen { USB_DEVICE(BAYER_VID, BAYER_CONTOUR_CABLE_PID) }, 83250d0678eSDhaval Vasa { USB_DEVICE(FTDI_VID, MARVELL_OPENRD_PID), 83350d0678eSDhaval Vasa .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 83455f13aeaSPeter Korsgaard { USB_DEVICE(FTDI_VID, TI_XDS100V2_PID), 83555f13aeaSPeter Korsgaard .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 836e7d7fcc0SPawel Ludwikow { USB_DEVICE(FTDI_VID, HAMEG_HO820_PID) }, 837c53c2fabSPaul Friedrich { USB_DEVICE(FTDI_VID, HAMEG_HO720_PID) }, 838c53c2fabSPaul Friedrich { USB_DEVICE(FTDI_VID, HAMEG_HO730_PID) }, 839e7d7fcc0SPawel Ludwikow { USB_DEVICE(FTDI_VID, HAMEG_HO870_PID) }, 8409714080dSMitchell Solomon { USB_DEVICE(FTDI_VID, MJSG_GENERIC_PID) }, 8419714080dSMitchell Solomon { USB_DEVICE(FTDI_VID, MJSG_SR_RADIO_PID) }, 8429714080dSMitchell Solomon { USB_DEVICE(FTDI_VID, MJSG_HD_RADIO_PID) }, 8439714080dSMitchell Solomon { USB_DEVICE(FTDI_VID, MJSG_XM_RADIO_PID) }, 84477dbd74eSColin Leitner { USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_ST_PID), 84577dbd74eSColin Leitner .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 84677dbd74eSColin Leitner { USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_SLITE_PID), 84777dbd74eSColin Leitner .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 84877dbd74eSColin Leitner { USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_SH2_PID), 84977dbd74eSColin Leitner .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 85077dbd74eSColin Leitner { USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_SH4_PID), 85177dbd74eSColin Leitner .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 852afad1964SJohn G. Rogers { USB_DEVICE(FTDI_VID, SEGWAY_RMP200_PID) }, 8533126d823SRich Mattes { USB_DEVICE(FTDI_VID, ACCESIO_COM4SM_PID) }, 854666cc076SMartin Michlmayr { USB_DEVICE(IONICS_VID, IONICS_PLUGCOMPUTER_PID), 855666cc076SMartin Michlmayr .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 85665737388SLuke Lowrey { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_24_MASTER_WING_PID) }, 85765737388SLuke Lowrey { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_PC_WING_PID) }, 85865737388SLuke Lowrey { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_USB_DMX_PID) }, 85965737388SLuke Lowrey { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_MIDI_TIMECODE_PID) }, 86065737388SLuke Lowrey { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_MINI_WING_PID) }, 86165737388SLuke Lowrey { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_MAXI_WING_PID) }, 86265737388SLuke Lowrey { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_MEDIA_WING_PID) }, 86365737388SLuke Lowrey { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_WING_PID) }, 8640f266abdSGreg Kroah-Hartman { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LOGBOOKML_PID) }, 8650f266abdSGreg Kroah-Hartman { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LS_LOGBOOK_PID) }, 8660f266abdSGreg Kroah-Hartman { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_HS_LOGBOOK_PID) }, 86790451e69SMilan Kocian { USB_DEVICE(FTDI_VID, FTDI_CINTERION_MC55I_PID) }, 8685363cdc3SFlorian Faber { USB_DEVICE(FTDI_VID, FTDI_DOTEC_PID) }, 8697fea0f71SSebastien Bourdeauducq { USB_DEVICE(QIHARDWARE_VID, MILKYMISTONE_JTAGSERIAL_PID), 8707fea0f71SSebastien Bourdeauducq .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 8716ec2f46cSJean-Christophe PLAGNIOL-VILLARD { USB_DEVICE(ST_VID, ST_STMCLT1030_PID), 8726ec2f46cSJean-Christophe PLAGNIOL-VILLARD .driver_info = (kernel_ulong_t)&ftdi_stmclite_quirk }, 873fc216ec3SPeter Naulls { USB_DEVICE(FTDI_VID, FTDI_RF_R106) }, 87447594d55SMichał Wróbel { USB_DEVICE(FTDI_VID, FTDI_DISTORTEC_JTAG_LOCK_PICK_PID), 87547594d55SMichał Wróbel .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 87657e596f3SMichał Wróbel { USB_DEVICE(FTDI_VID, FTDI_LUMEL_PD12_PID) }, 877fdcb0a0fSIan Abbott { }, /* Optional parameter entry */ 8781da177e4SLinus Torvalds { } /* Terminating entry */ 8791da177e4SLinus Torvalds }; 8801da177e4SLinus Torvalds 8811da177e4SLinus Torvalds MODULE_DEVICE_TABLE(usb, id_table_combined); 8821da177e4SLinus Torvalds 8834c4c9432SArjan van de Ven static const char *ftdi_chip_name[] = { 8841da177e4SLinus Torvalds [SIO] = "SIO", /* the serial part of FT8U100AX */ 8851da177e4SLinus Torvalds [FT8U232AM] = "FT8U232AM", 8861da177e4SLinus Torvalds [FT232BM] = "FT232BM", 8871da177e4SLinus Torvalds [FT2232C] = "FT2232C", 888d8b21606SGard Spreemann [FT232RL] = "FT232RL", 889094c2e6dSMark Adamson [FT2232H] = "FT2232H", 890309427b6SUwe Bonnes [FT4232H] = "FT4232H", 891dc0827c1SJim Paris [FT232H] = "FT232H", 892dc0827c1SJim Paris [FTX] = "FT-X" 8931da177e4SLinus Torvalds }; 8941da177e4SLinus Torvalds 8951da177e4SLinus Torvalds 8961da177e4SLinus Torvalds /* Used for TIOCMIWAIT */ 8971da177e4SLinus Torvalds #define FTDI_STATUS_B0_MASK (FTDI_RS0_CTS | FTDI_RS0_DSR | FTDI_RS0_RI | FTDI_RS0_RLSD) 8981da177e4SLinus Torvalds #define FTDI_STATUS_B1_MASK (FTDI_RS_BI) 8991da177e4SLinus Torvalds /* End TIOCMIWAIT */ 9001da177e4SLinus Torvalds 9011da177e4SLinus Torvalds #define FTDI_IMPL_ASYNC_FLAGS = (ASYNC_SPD_HI | ASYNC_SPD_VHI \ 902bbc5d276SRoel Kluin | ASYNC_SPD_CUST | ASYNC_SPD_SHI | ASYNC_SPD_WARP) 9031da177e4SLinus Torvalds 9041da177e4SLinus Torvalds /* function prototypes for a FTDI serial converter */ 905464cbb24SAlan Cox static int ftdi_sio_probe(struct usb_serial *serial, 906464cbb24SAlan Cox const struct usb_device_id *id); 90712bdbe03SJim Radford static int ftdi_sio_port_probe(struct usb_serial_port *port); 90812bdbe03SJim Radford static int ftdi_sio_port_remove(struct usb_serial_port *port); 909a509a7e4SAlan Cox static int ftdi_open(struct tty_struct *tty, struct usb_serial_port *port); 910335f8514SAlan Cox static void ftdi_close(struct usb_serial_port *port); 911335f8514SAlan Cox static void ftdi_dtr_rts(struct usb_serial_port *port, int on); 9121b551015SJohan Hovold static void ftdi_process_read_urb(struct urb *urb); 913d3901a06SJohan Hovold static int ftdi_prepare_write_buffer(struct usb_serial_port *port, 914c23e5fc1SJohan Hovold void *dest, size_t size); 915464cbb24SAlan Cox static void ftdi_set_termios(struct tty_struct *tty, 916464cbb24SAlan Cox struct usb_serial_port *port, struct ktermios *old); 91760b33c13SAlan Cox static int ftdi_tiocmget(struct tty_struct *tty); 91820b9d177SAlan Cox static int ftdi_tiocmset(struct tty_struct *tty, 919464cbb24SAlan Cox unsigned int set, unsigned int clear); 920c75ccd48SUwe Bonnes static int ftdi_get_icount(struct tty_struct *tty, 921c75ccd48SUwe Bonnes struct serial_icounter_struct *icount); 92200a0d0d6SAlan Cox static int ftdi_ioctl(struct tty_struct *tty, 923464cbb24SAlan Cox unsigned int cmd, unsigned long arg); 92495da310eSAlan Cox static void ftdi_break_ctl(struct tty_struct *tty, int break_state); 9256f602912SJarkko Huijts static int ftdi_chars_in_buffer(struct tty_struct *tty); 9261da177e4SLinus Torvalds 9271da177e4SLinus Torvalds static unsigned short int ftdi_232am_baud_base_to_divisor(int baud, int base); 9281da177e4SLinus Torvalds static unsigned short int ftdi_232am_baud_to_divisor(int baud); 9291da177e4SLinus Torvalds static __u32 ftdi_232bm_baud_base_to_divisor(int baud, int base); 9301da177e4SLinus Torvalds static __u32 ftdi_232bm_baud_to_divisor(int baud); 931094c2e6dSMark Adamson static __u32 ftdi_2232h_baud_base_to_divisor(int baud, int base); 932094c2e6dSMark Adamson static __u32 ftdi_2232h_baud_to_divisor(int baud); 9331da177e4SLinus Torvalds 934ea65370dSGreg Kroah-Hartman static struct usb_serial_driver ftdi_sio_device = { 93518fcac35SGreg Kroah-Hartman .driver = { 9361da177e4SLinus Torvalds .owner = THIS_MODULE, 937269bda1cSGreg Kroah-Hartman .name = "ftdi_sio", 93818fcac35SGreg Kroah-Hartman }, 939269bda1cSGreg Kroah-Hartman .description = "FTDI USB Serial Device", 9408f977e42SIan Abbott .id_table = id_table_combined, 9411da177e4SLinus Torvalds .num_ports = 1, 942bbcb2b90SJohan Hovold .bulk_in_size = 512, 943c23e5fc1SJohan Hovold .bulk_out_size = 256, 9448f977e42SIan Abbott .probe = ftdi_sio_probe, 94512bdbe03SJim Radford .port_probe = ftdi_sio_port_probe, 94612bdbe03SJim Radford .port_remove = ftdi_sio_port_remove, 9471da177e4SLinus Torvalds .open = ftdi_open, 9481da177e4SLinus Torvalds .close = ftdi_close, 949335f8514SAlan Cox .dtr_rts = ftdi_dtr_rts, 9501b551015SJohan Hovold .throttle = usb_serial_generic_throttle, 9511b551015SJohan Hovold .unthrottle = usb_serial_generic_unthrottle, 9521b551015SJohan Hovold .process_read_urb = ftdi_process_read_urb, 953d3901a06SJohan Hovold .prepare_write_buffer = ftdi_prepare_write_buffer, 9541da177e4SLinus Torvalds .tiocmget = ftdi_tiocmget, 9551da177e4SLinus Torvalds .tiocmset = ftdi_tiocmset, 956c75ccd48SUwe Bonnes .get_icount = ftdi_get_icount, 9571da177e4SLinus Torvalds .ioctl = ftdi_ioctl, 9581da177e4SLinus Torvalds .set_termios = ftdi_set_termios, 9591da177e4SLinus Torvalds .break_ctl = ftdi_break_ctl, 9606f602912SJarkko Huijts .chars_in_buffer = ftdi_chars_in_buffer, 9611da177e4SLinus Torvalds }; 9621da177e4SLinus Torvalds 96397b6b6d2SAlan Stern static struct usb_serial_driver * const serial_drivers[] = { 96497b6b6d2SAlan Stern &ftdi_sio_device, NULL 96597b6b6d2SAlan Stern }; 96697b6b6d2SAlan Stern 9671da177e4SLinus Torvalds 9681da177e4SLinus Torvalds #define WDR_TIMEOUT 5000 /* default urb timeout */ 969279e1545SIan Abbott #define WDR_SHORT_TIMEOUT 1000 /* shorter urb timeout */ 9701da177e4SLinus Torvalds 9711da177e4SLinus Torvalds /* High and low are for DTR, RTS etc etc */ 9721da177e4SLinus Torvalds #define HIGH 1 9731da177e4SLinus Torvalds #define LOW 0 9741da177e4SLinus Torvalds 9751da177e4SLinus Torvalds /* 9761da177e4SLinus Torvalds * *************************************************************************** 977fa91d43bSTony Lindgren * Utility functions 9781da177e4SLinus Torvalds * *************************************************************************** 9791da177e4SLinus Torvalds */ 9801da177e4SLinus Torvalds 9811da177e4SLinus Torvalds static unsigned short int ftdi_232am_baud_base_to_divisor(int baud, int base) 9821da177e4SLinus Torvalds { 9831da177e4SLinus Torvalds unsigned short int divisor; 984464cbb24SAlan Cox /* divisor shifted 3 bits to the left */ 985464cbb24SAlan Cox int divisor3 = base / 2 / baud; 986464cbb24SAlan Cox if ((divisor3 & 0x7) == 7) 987464cbb24SAlan Cox divisor3++; /* round x.7/8 up to x+1 */ 9881da177e4SLinus Torvalds divisor = divisor3 >> 3; 9891da177e4SLinus Torvalds divisor3 &= 0x7; 990464cbb24SAlan Cox if (divisor3 == 1) 991464cbb24SAlan Cox divisor |= 0xc000; 992464cbb24SAlan Cox else if (divisor3 >= 4) 993464cbb24SAlan Cox divisor |= 0x4000; 994464cbb24SAlan Cox else if (divisor3 != 0) 995464cbb24SAlan Cox divisor |= 0x8000; 996464cbb24SAlan Cox else if (divisor == 1) 997464cbb24SAlan Cox divisor = 0; /* special case for maximum baud rate */ 9981da177e4SLinus Torvalds return divisor; 9991da177e4SLinus Torvalds } 10001da177e4SLinus Torvalds 10011da177e4SLinus Torvalds static unsigned short int ftdi_232am_baud_to_divisor(int baud) 10021da177e4SLinus Torvalds { 1003464cbb24SAlan Cox return ftdi_232am_baud_base_to_divisor(baud, 48000000); 10041da177e4SLinus Torvalds } 10051da177e4SLinus Torvalds 10061da177e4SLinus Torvalds static __u32 ftdi_232bm_baud_base_to_divisor(int baud, int base) 10071da177e4SLinus Torvalds { 10081da177e4SLinus Torvalds static const unsigned char divfrac[8] = { 0, 3, 2, 4, 1, 5, 6, 7 }; 10091da177e4SLinus Torvalds __u32 divisor; 1010464cbb24SAlan Cox /* divisor shifted 3 bits to the left */ 1011464cbb24SAlan Cox int divisor3 = base / 2 / baud; 10121da177e4SLinus Torvalds divisor = divisor3 >> 3; 10131da177e4SLinus Torvalds divisor |= (__u32)divfrac[divisor3 & 0x7] << 14; 10141da177e4SLinus Torvalds /* Deal with special cases for highest baud rates. */ 1015464cbb24SAlan Cox if (divisor == 1) 1016464cbb24SAlan Cox divisor = 0; 1017464cbb24SAlan Cox else if (divisor == 0x4001) 1018464cbb24SAlan Cox divisor = 1; 10191da177e4SLinus Torvalds return divisor; 10201da177e4SLinus Torvalds } 10211da177e4SLinus Torvalds 10221da177e4SLinus Torvalds static __u32 ftdi_232bm_baud_to_divisor(int baud) 10231da177e4SLinus Torvalds { 1024464cbb24SAlan Cox return ftdi_232bm_baud_base_to_divisor(baud, 48000000); 10251da177e4SLinus Torvalds } 10261da177e4SLinus Torvalds 1027094c2e6dSMark Adamson static __u32 ftdi_2232h_baud_base_to_divisor(int baud, int base) 1028094c2e6dSMark Adamson { 1029094c2e6dSMark Adamson static const unsigned char divfrac[8] = { 0, 3, 2, 4, 1, 5, 6, 7 }; 1030094c2e6dSMark Adamson __u32 divisor; 1031094c2e6dSMark Adamson int divisor3; 1032094c2e6dSMark Adamson 1033094c2e6dSMark Adamson /* hi-speed baud rate is 10-bit sampling instead of 16-bit */ 1034f6c259a3SDaniel Glöckner divisor3 = base * 8 / (baud * 10); 1035094c2e6dSMark Adamson 1036094c2e6dSMark Adamson divisor = divisor3 >> 3; 1037094c2e6dSMark Adamson divisor |= (__u32)divfrac[divisor3 & 0x7] << 14; 1038094c2e6dSMark Adamson /* Deal with special cases for highest baud rates. */ 1039094c2e6dSMark Adamson if (divisor == 1) 1040094c2e6dSMark Adamson divisor = 0; 1041094c2e6dSMark Adamson else if (divisor == 0x4001) 1042094c2e6dSMark Adamson divisor = 1; 1043094c2e6dSMark Adamson /* 1044094c2e6dSMark Adamson * Set this bit to turn off a divide by 2.5 on baud rate generator 1045094c2e6dSMark Adamson * This enables baud rates up to 12Mbaud but cannot reach below 1200 1046094c2e6dSMark Adamson * baud with this bit set 1047094c2e6dSMark Adamson */ 1048094c2e6dSMark Adamson divisor |= 0x00020000; 1049094c2e6dSMark Adamson return divisor; 1050094c2e6dSMark Adamson } 1051094c2e6dSMark Adamson 1052094c2e6dSMark Adamson static __u32 ftdi_2232h_baud_to_divisor(int baud) 1053094c2e6dSMark Adamson { 1054094c2e6dSMark Adamson return ftdi_2232h_baud_base_to_divisor(baud, 120000000); 1055094c2e6dSMark Adamson } 1056094c2e6dSMark Adamson 105774ede0ffSIan Abbott #define set_mctrl(port, set) update_mctrl((port), (set), 0) 105874ede0ffSIan Abbott #define clear_mctrl(port, clear) update_mctrl((port), 0, (clear)) 105974ede0ffSIan Abbott 1060464cbb24SAlan Cox static int update_mctrl(struct usb_serial_port *port, unsigned int set, 1061464cbb24SAlan Cox unsigned int clear) 10621da177e4SLinus Torvalds { 10631da177e4SLinus Torvalds struct ftdi_private *priv = usb_get_serial_port_data(port); 1064bfc51614SGreg Kroah-Hartman struct device *dev = &port->dev; 106574ede0ffSIan Abbott unsigned urb_value; 10661da177e4SLinus Torvalds int rv; 10671da177e4SLinus Torvalds 106874ede0ffSIan Abbott if (((set | clear) & (TIOCM_DTR | TIOCM_RTS)) == 0) { 1069bfc51614SGreg Kroah-Hartman dev_dbg(dev, "%s - DTR|RTS not being set|cleared\n", __func__); 107074ede0ffSIan Abbott return 0; /* no change */ 10711da177e4SLinus Torvalds } 107274ede0ffSIan Abbott 107374ede0ffSIan Abbott clear &= ~set; /* 'set' takes precedence over 'clear' */ 107474ede0ffSIan Abbott urb_value = 0; 107574ede0ffSIan Abbott if (clear & TIOCM_DTR) 107674ede0ffSIan Abbott urb_value |= FTDI_SIO_SET_DTR_LOW; 107774ede0ffSIan Abbott if (clear & TIOCM_RTS) 107874ede0ffSIan Abbott urb_value |= FTDI_SIO_SET_RTS_LOW; 107974ede0ffSIan Abbott if (set & TIOCM_DTR) 108074ede0ffSIan Abbott urb_value |= FTDI_SIO_SET_DTR_HIGH; 108174ede0ffSIan Abbott if (set & TIOCM_RTS) 108274ede0ffSIan Abbott urb_value |= FTDI_SIO_SET_RTS_HIGH; 10831da177e4SLinus Torvalds rv = usb_control_msg(port->serial->dev, 10841da177e4SLinus Torvalds usb_sndctrlpipe(port->serial->dev, 0), 10851da177e4SLinus Torvalds FTDI_SIO_SET_MODEM_CTRL_REQUEST, 10861da177e4SLinus Torvalds FTDI_SIO_SET_MODEM_CTRL_REQUEST_TYPE, 108774ede0ffSIan Abbott urb_value, priv->interface, 108866e47e60SJohan Hovold NULL, 0, WDR_TIMEOUT); 108974ede0ffSIan Abbott if (rv < 0) { 1090bfc51614SGreg Kroah-Hartman dev_dbg(dev, "%s Error from MODEM_CTRL urb: DTR %s, RTS %s\n", 1091441b62c1SHarvey Harrison __func__, 1092bfc51614SGreg Kroah-Hartman (set & TIOCM_DTR) ? "HIGH" : (clear & TIOCM_DTR) ? "LOW" : "unchanged", 1093bfc51614SGreg Kroah-Hartman (set & TIOCM_RTS) ? "HIGH" : (clear & TIOCM_RTS) ? "LOW" : "unchanged"); 1094*2c2ee545SJohan Hovold rv = usb_translate_errors(rv); 10951da177e4SLinus Torvalds } else { 1096bfc51614SGreg Kroah-Hartman dev_dbg(dev, "%s - DTR %s, RTS %s\n", __func__, 1097bfc51614SGreg Kroah-Hartman (set & TIOCM_DTR) ? "HIGH" : (clear & TIOCM_DTR) ? "LOW" : "unchanged", 1098bfc51614SGreg Kroah-Hartman (set & TIOCM_RTS) ? "HIGH" : (clear & TIOCM_RTS) ? "LOW" : "unchanged"); 10999b0f2582SAlan Cox /* FIXME: locking on last_dtr_rts */ 110074ede0ffSIan Abbott priv->last_dtr_rts = (priv->last_dtr_rts & ~clear) | set; 11011da177e4SLinus Torvalds } 11021da177e4SLinus Torvalds return rv; 11031da177e4SLinus Torvalds } 11041da177e4SLinus Torvalds 11051da177e4SLinus Torvalds 1106464cbb24SAlan Cox static __u32 get_ftdi_divisor(struct tty_struct *tty, 1107464cbb24SAlan Cox struct usb_serial_port *port) 1108e49bbce1SJohan Hovold { 11091da177e4SLinus Torvalds struct ftdi_private *priv = usb_get_serial_port_data(port); 1110bfc51614SGreg Kroah-Hartman struct device *dev = &port->dev; 11111da177e4SLinus Torvalds __u32 div_value = 0; 11121da177e4SLinus Torvalds int div_okay = 1; 11131da177e4SLinus Torvalds int baud; 11141da177e4SLinus Torvalds 11151da177e4SLinus Torvalds /* 1116464cbb24SAlan Cox * The logic involved in setting the baudrate can be cleanly split into 1117464cbb24SAlan Cox * 3 steps. 11181da177e4SLinus Torvalds * 1. Standard baud rates are set in tty->termios->c_cflag 1119464cbb24SAlan Cox * 2. If these are not enough, you can set any speed using alt_speed as 1120464cbb24SAlan Cox * follows: 11211da177e4SLinus Torvalds * - set tty->termios->c_cflag speed to B38400 11221da177e4SLinus Torvalds * - set your real speed in tty->alt_speed; it gets ignored when 11231da177e4SLinus Torvalds * alt_speed==0, (or) 1124464cbb24SAlan Cox * - call TIOCSSERIAL ioctl with (struct serial_struct) set as 1125464cbb24SAlan Cox * follows: 1126464cbb24SAlan Cox * flags & ASYNC_SPD_MASK == ASYNC_SPD_[HI, VHI, SHI, WARP], 1127464cbb24SAlan Cox * this just sets alt_speed to (HI: 57600, VHI: 115200, 1128464cbb24SAlan Cox * SHI: 230400, WARP: 460800) 11291da177e4SLinus Torvalds * ** Steps 1, 2 are done courtesy of tty_get_baud_rate 11301da177e4SLinus Torvalds * 3. You can also set baud rate by setting custom divisor as follows 11311da177e4SLinus Torvalds * - set tty->termios->c_cflag speed to B38400 1132464cbb24SAlan Cox * - call TIOCSSERIAL ioctl with (struct serial_struct) set as 1133464cbb24SAlan Cox * follows: 11341da177e4SLinus Torvalds * o flags & ASYNC_SPD_MASK == ASYNC_SPD_CUST 11351da177e4SLinus Torvalds * o custom_divisor set to baud_base / your_new_baudrate 1136464cbb24SAlan Cox * ** Step 3 is done courtesy of code borrowed from serial.c 1137464cbb24SAlan Cox * I should really spend some time and separate + move this common 1138464cbb24SAlan Cox * code to serial.c, it is replicated in nearly every serial driver 1139464cbb24SAlan Cox * you see. 11401da177e4SLinus Torvalds */ 11411da177e4SLinus Torvalds 1142464cbb24SAlan Cox /* 1. Get the baud rate from the tty settings, this observes 1143464cbb24SAlan Cox alt_speed hack */ 11441da177e4SLinus Torvalds 114595da310eSAlan Cox baud = tty_get_baud_rate(tty); 1146bfc51614SGreg Kroah-Hartman dev_dbg(dev, "%s - tty_get_baud_rate reports speed %d\n", __func__, baud); 11471da177e4SLinus Torvalds 1148464cbb24SAlan Cox /* 2. Observe async-compatible custom_divisor hack, update baudrate 1149464cbb24SAlan Cox if needed */ 11501da177e4SLinus Torvalds 11511da177e4SLinus Torvalds if (baud == 38400 && 11521da177e4SLinus Torvalds ((priv->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) && 11531da177e4SLinus Torvalds (priv->custom_divisor)) { 11541da177e4SLinus Torvalds baud = priv->baud_base / priv->custom_divisor; 1155bfc51614SGreg Kroah-Hartman dev_dbg(dev, "%s - custom divisor %d sets baud rate to %d\n", 1156464cbb24SAlan Cox __func__, priv->custom_divisor, baud); 11571da177e4SLinus Torvalds } 11581da177e4SLinus Torvalds 11591da177e4SLinus Torvalds /* 3. Convert baudrate to device-specific divisor */ 11601da177e4SLinus Torvalds 1161464cbb24SAlan Cox if (!baud) 1162464cbb24SAlan Cox baud = 9600; 11631da177e4SLinus Torvalds switch (priv->chip_type) { 11641da177e4SLinus Torvalds case SIO: /* SIO chip */ 11651da177e4SLinus Torvalds switch (baud) { 11661da177e4SLinus Torvalds case 300: div_value = ftdi_sio_b300; break; 11671da177e4SLinus Torvalds case 600: div_value = ftdi_sio_b600; break; 11681da177e4SLinus Torvalds case 1200: div_value = ftdi_sio_b1200; break; 11691da177e4SLinus Torvalds case 2400: div_value = ftdi_sio_b2400; break; 11701da177e4SLinus Torvalds case 4800: div_value = ftdi_sio_b4800; break; 11711da177e4SLinus Torvalds case 9600: div_value = ftdi_sio_b9600; break; 11721da177e4SLinus Torvalds case 19200: div_value = ftdi_sio_b19200; break; 11731da177e4SLinus Torvalds case 38400: div_value = ftdi_sio_b38400; break; 11741da177e4SLinus Torvalds case 57600: div_value = ftdi_sio_b57600; break; 11751da177e4SLinus Torvalds case 115200: div_value = ftdi_sio_b115200; break; 11761da177e4SLinus Torvalds } /* baud */ 11771da177e4SLinus Torvalds if (div_value == 0) { 1178bfc51614SGreg Kroah-Hartman dev_dbg(dev, "%s - Baudrate (%d) requested is not supported\n", 1179464cbb24SAlan Cox __func__, baud); 11801da177e4SLinus Torvalds div_value = ftdi_sio_b9600; 1181669a6db1SAlan Cox baud = 9600; 11821da177e4SLinus Torvalds div_okay = 0; 11831da177e4SLinus Torvalds } 11841da177e4SLinus Torvalds break; 11851da177e4SLinus Torvalds case FT8U232AM: /* 8U232AM chip */ 11861da177e4SLinus Torvalds if (baud <= 3000000) { 11871da177e4SLinus Torvalds div_value = ftdi_232am_baud_to_divisor(baud); 11881da177e4SLinus Torvalds } else { 1189bfc51614SGreg Kroah-Hartman dev_dbg(dev, "%s - Baud rate too high!\n", __func__); 1190669a6db1SAlan Cox baud = 9600; 11911da177e4SLinus Torvalds div_value = ftdi_232am_baud_to_divisor(9600); 11921da177e4SLinus Torvalds div_okay = 0; 11931da177e4SLinus Torvalds } 11941da177e4SLinus Torvalds break; 11951da177e4SLinus Torvalds case FT232BM: /* FT232BM chip */ 11961da177e4SLinus Torvalds case FT2232C: /* FT2232C chip */ 1197dc0827c1SJim Paris case FT232RL: /* FT232RL chip */ 1198dc0827c1SJim Paris case FTX: /* FT-X series */ 11991da177e4SLinus Torvalds if (baud <= 3000000) { 1200b760dac2SMartin Geleynse __u16 product_id = le16_to_cpu( 1201b760dac2SMartin Geleynse port->serial->dev->descriptor.idProduct); 1202b760dac2SMartin Geleynse if (((FTDI_NDI_HUC_PID == product_id) || 1203b760dac2SMartin Geleynse (FTDI_NDI_SPECTRA_SCU_PID == product_id) || 1204b760dac2SMartin Geleynse (FTDI_NDI_FUTURE_2_PID == product_id) || 1205b760dac2SMartin Geleynse (FTDI_NDI_FUTURE_3_PID == product_id) || 1206b760dac2SMartin Geleynse (FTDI_NDI_AURORA_SCU_PID == product_id)) && 1207b760dac2SMartin Geleynse (baud == 19200)) { 1208b760dac2SMartin Geleynse baud = 1200000; 1209b760dac2SMartin Geleynse } 12101da177e4SLinus Torvalds div_value = ftdi_232bm_baud_to_divisor(baud); 12111da177e4SLinus Torvalds } else { 1212bfc51614SGreg Kroah-Hartman dev_dbg(dev, "%s - Baud rate too high!\n", __func__); 12131da177e4SLinus Torvalds div_value = ftdi_232bm_baud_to_divisor(9600); 12141da177e4SLinus Torvalds div_okay = 0; 1215669a6db1SAlan Cox baud = 9600; 12161da177e4SLinus Torvalds } 12171da177e4SLinus Torvalds break; 1218094c2e6dSMark Adamson case FT2232H: /* FT2232H chip */ 1219094c2e6dSMark Adamson case FT4232H: /* FT4232H chip */ 1220309427b6SUwe Bonnes case FT232H: /* FT232H chip */ 12211862cdd5SIonut Nicu if ((baud <= 12000000) && (baud >= 1200)) { 1222094c2e6dSMark Adamson div_value = ftdi_2232h_baud_to_divisor(baud); 1223094c2e6dSMark Adamson } else if (baud < 1200) { 1224094c2e6dSMark Adamson div_value = ftdi_232bm_baud_to_divisor(baud); 1225094c2e6dSMark Adamson } else { 1226bfc51614SGreg Kroah-Hartman dev_dbg(dev, "%s - Baud rate too high!\n", __func__); 1227094c2e6dSMark Adamson div_value = ftdi_232bm_baud_to_divisor(9600); 1228094c2e6dSMark Adamson div_okay = 0; 1229094c2e6dSMark Adamson baud = 9600; 1230094c2e6dSMark Adamson } 1231094c2e6dSMark Adamson break; 12321da177e4SLinus Torvalds } /* priv->chip_type */ 12331da177e4SLinus Torvalds 12341da177e4SLinus Torvalds if (div_okay) { 1235bfc51614SGreg Kroah-Hartman dev_dbg(dev, "%s - Baud rate set to %d (divisor 0x%lX) on chip %s\n", 1236441b62c1SHarvey Harrison __func__, baud, (unsigned long)div_value, 12371da177e4SLinus Torvalds ftdi_chip_name[priv->chip_type]); 12381da177e4SLinus Torvalds } 12391da177e4SLinus Torvalds 124095da310eSAlan Cox tty_encode_baud_rate(tty, baud, baud); 1241464cbb24SAlan Cox return div_value; 12421da177e4SLinus Torvalds } 12431da177e4SLinus Torvalds 124495da310eSAlan Cox static int change_speed(struct tty_struct *tty, struct usb_serial_port *port) 124595da310eSAlan Cox { 124695da310eSAlan Cox struct ftdi_private *priv = usb_get_serial_port_data(port); 124795da310eSAlan Cox __u16 urb_value; 124895da310eSAlan Cox __u16 urb_index; 124995da310eSAlan Cox __u32 urb_index_value; 125095da310eSAlan Cox int rv; 125195da310eSAlan Cox 125295da310eSAlan Cox urb_index_value = get_ftdi_divisor(tty, port); 125395da310eSAlan Cox urb_value = (__u16)urb_index_value; 125495da310eSAlan Cox urb_index = (__u16)(urb_index_value >> 16); 12550ee404ccSUwe Bonnes if ((priv->chip_type == FT2232C) || (priv->chip_type == FT2232H) || 12560ee404ccSUwe Bonnes (priv->chip_type == FT4232H) || (priv->chip_type == FT232H)) { 12570ee404ccSUwe Bonnes /* Probably the BM type needs the MSB of the encoded fractional 12580ee404ccSUwe Bonnes * divider also moved like for the chips above. Any infos? */ 125995da310eSAlan Cox urb_index = (__u16)((urb_index << 8) | priv->interface); 126095da310eSAlan Cox } 126195da310eSAlan Cox 126295da310eSAlan Cox rv = usb_control_msg(port->serial->dev, 126395da310eSAlan Cox usb_sndctrlpipe(port->serial->dev, 0), 126495da310eSAlan Cox FTDI_SIO_SET_BAUDRATE_REQUEST, 126595da310eSAlan Cox FTDI_SIO_SET_BAUDRATE_REQUEST_TYPE, 126695da310eSAlan Cox urb_value, urb_index, 126766e47e60SJohan Hovold NULL, 0, WDR_SHORT_TIMEOUT); 126895da310eSAlan Cox return rv; 126995da310eSAlan Cox } 127095da310eSAlan Cox 1271557aaa7fSAlan Cox static int write_latency_timer(struct usb_serial_port *port) 1272557aaa7fSAlan Cox { 1273557aaa7fSAlan Cox struct ftdi_private *priv = usb_get_serial_port_data(port); 1274557aaa7fSAlan Cox struct usb_device *udev = port->serial->dev; 1275c1284d77SJohan Hovold int rv; 1276557aaa7fSAlan Cox int l = priv->latency; 127795da310eSAlan Cox 1278557aaa7fSAlan Cox if (priv->flags & ASYNC_LOW_LATENCY) 1279557aaa7fSAlan Cox l = 1; 1280557aaa7fSAlan Cox 1281bfc51614SGreg Kroah-Hartman dev_dbg(&port->dev, "%s: setting latency timer = %i\n", __func__, l); 1282557aaa7fSAlan Cox 1283557aaa7fSAlan Cox rv = usb_control_msg(udev, 1284557aaa7fSAlan Cox usb_sndctrlpipe(udev, 0), 1285557aaa7fSAlan Cox FTDI_SIO_SET_LATENCY_TIMER_REQUEST, 1286557aaa7fSAlan Cox FTDI_SIO_SET_LATENCY_TIMER_REQUEST_TYPE, 1287557aaa7fSAlan Cox l, priv->interface, 128866e47e60SJohan Hovold NULL, 0, WDR_TIMEOUT); 1289557aaa7fSAlan Cox if (rv < 0) 1290557aaa7fSAlan Cox dev_err(&port->dev, "Unable to write latency timer: %i\n", rv); 1291557aaa7fSAlan Cox return rv; 1292557aaa7fSAlan Cox } 1293557aaa7fSAlan Cox 1294557aaa7fSAlan Cox static int read_latency_timer(struct usb_serial_port *port) 1295557aaa7fSAlan Cox { 1296557aaa7fSAlan Cox struct ftdi_private *priv = usb_get_serial_port_data(port); 1297557aaa7fSAlan Cox struct usb_device *udev = port->serial->dev; 129854f328d0SJohan Hovold unsigned char *buf; 1299c1284d77SJohan Hovold int rv; 1300557aaa7fSAlan Cox 130154f328d0SJohan Hovold buf = kmalloc(1, GFP_KERNEL); 130254f328d0SJohan Hovold if (!buf) 130354f328d0SJohan Hovold return -ENOMEM; 130454f328d0SJohan Hovold 1305557aaa7fSAlan Cox rv = usb_control_msg(udev, 1306557aaa7fSAlan Cox usb_rcvctrlpipe(udev, 0), 1307557aaa7fSAlan Cox FTDI_SIO_GET_LATENCY_TIMER_REQUEST, 1308557aaa7fSAlan Cox FTDI_SIO_GET_LATENCY_TIMER_REQUEST_TYPE, 1309557aaa7fSAlan Cox 0, priv->interface, 131054f328d0SJohan Hovold buf, 1, WDR_TIMEOUT); 13114357369dSJohan Hovold if (rv < 0) 1312557aaa7fSAlan Cox dev_err(&port->dev, "Unable to read latency timer: %i\n", rv); 13134357369dSJohan Hovold else 131454f328d0SJohan Hovold priv->latency = buf[0]; 131554f328d0SJohan Hovold 131654f328d0SJohan Hovold kfree(buf); 131754f328d0SJohan Hovold 13188c4f99cdSJohan Hovold return rv; 1319557aaa7fSAlan Cox } 13201da177e4SLinus Torvalds 1321464cbb24SAlan Cox static int get_serial_info(struct usb_serial_port *port, 1322464cbb24SAlan Cox struct serial_struct __user *retinfo) 13231da177e4SLinus Torvalds { 13241da177e4SLinus Torvalds struct ftdi_private *priv = usb_get_serial_port_data(port); 13251da177e4SLinus Torvalds struct serial_struct tmp; 13261da177e4SLinus Torvalds 13271da177e4SLinus Torvalds if (!retinfo) 13281da177e4SLinus Torvalds return -EFAULT; 13291da177e4SLinus Torvalds memset(&tmp, 0, sizeof(tmp)); 13301da177e4SLinus Torvalds tmp.flags = priv->flags; 13311da177e4SLinus Torvalds tmp.baud_base = priv->baud_base; 13321da177e4SLinus Torvalds tmp.custom_divisor = priv->custom_divisor; 13331da177e4SLinus Torvalds if (copy_to_user(retinfo, &tmp, sizeof(*retinfo))) 13341da177e4SLinus Torvalds return -EFAULT; 13351da177e4SLinus Torvalds return 0; 1336e49bbce1SJohan Hovold } 13371da177e4SLinus Torvalds 133895da310eSAlan Cox static int set_serial_info(struct tty_struct *tty, 133995da310eSAlan Cox struct usb_serial_port *port, struct serial_struct __user *newinfo) 1340e49bbce1SJohan Hovold { 13411da177e4SLinus Torvalds struct ftdi_private *priv = usb_get_serial_port_data(port); 13421da177e4SLinus Torvalds struct serial_struct new_serial; 13431da177e4SLinus Torvalds struct ftdi_private old_priv; 13441da177e4SLinus Torvalds 13451da177e4SLinus Torvalds if (copy_from_user(&new_serial, newinfo, sizeof(new_serial))) 13461da177e4SLinus Torvalds return -EFAULT; 13476b447f04SAlan Cox 1348bd09a9f5SAlessio Igor Bogani mutex_lock(&priv->cfg_lock); 13491da177e4SLinus Torvalds old_priv = *priv; 13501da177e4SLinus Torvalds 13511da177e4SLinus Torvalds /* Do error checking and permission checking */ 13521da177e4SLinus Torvalds 13531da177e4SLinus Torvalds if (!capable(CAP_SYS_ADMIN)) { 13541da177e4SLinus Torvalds if (((new_serial.flags & ~ASYNC_USR_MASK) != 135564905b48SDan Carpenter (priv->flags & ~ASYNC_USR_MASK))) { 1356bd09a9f5SAlessio Igor Bogani mutex_unlock(&priv->cfg_lock); 13571da177e4SLinus Torvalds return -EPERM; 135864905b48SDan Carpenter } 13591da177e4SLinus Torvalds priv->flags = ((priv->flags & ~ASYNC_USR_MASK) | 13601da177e4SLinus Torvalds (new_serial.flags & ASYNC_USR_MASK)); 13611da177e4SLinus Torvalds priv->custom_divisor = new_serial.custom_divisor; 13621da177e4SLinus Torvalds goto check_and_exit; 13631da177e4SLinus Torvalds } 13641da177e4SLinus Torvalds 1365eb833a9eSJohan Hovold if (new_serial.baud_base != priv->baud_base) { 1366bd09a9f5SAlessio Igor Bogani mutex_unlock(&priv->cfg_lock); 13671da177e4SLinus Torvalds return -EINVAL; 13686b447f04SAlan Cox } 13691da177e4SLinus Torvalds 13701da177e4SLinus Torvalds /* Make the changes - these are privileged changes! */ 13711da177e4SLinus Torvalds 13721da177e4SLinus Torvalds priv->flags = ((priv->flags & ~ASYNC_FLAGS) | 13731da177e4SLinus Torvalds (new_serial.flags & ASYNC_FLAGS)); 13741da177e4SLinus Torvalds priv->custom_divisor = new_serial.custom_divisor; 13751da177e4SLinus Torvalds 1376557aaa7fSAlan Cox write_latency_timer(port); 13771da177e4SLinus Torvalds 13781da177e4SLinus Torvalds check_and_exit: 13791da177e4SLinus Torvalds if ((old_priv.flags & ASYNC_SPD_MASK) != 13801da177e4SLinus Torvalds (priv->flags & ASYNC_SPD_MASK)) { 13811da177e4SLinus Torvalds if ((priv->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) 138295da310eSAlan Cox tty->alt_speed = 57600; 13831da177e4SLinus Torvalds else if ((priv->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) 138495da310eSAlan Cox tty->alt_speed = 115200; 13851da177e4SLinus Torvalds else if ((priv->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) 138695da310eSAlan Cox tty->alt_speed = 230400; 13871da177e4SLinus Torvalds else if ((priv->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) 138895da310eSAlan Cox tty->alt_speed = 460800; 13891da177e4SLinus Torvalds else 139095da310eSAlan Cox tty->alt_speed = 0; 13911da177e4SLinus Torvalds } 13921da177e4SLinus Torvalds if (((old_priv.flags & ASYNC_SPD_MASK) != 13931da177e4SLinus Torvalds (priv->flags & ASYNC_SPD_MASK)) || 13941da177e4SLinus Torvalds (((priv->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) && 13951da177e4SLinus Torvalds (old_priv.custom_divisor != priv->custom_divisor))) { 139695da310eSAlan Cox change_speed(tty, port); 13979c67d28eSAlessio Igor Bogani mutex_unlock(&priv->cfg_lock); 13981da177e4SLinus Torvalds } 13996b447f04SAlan Cox else 1400bd09a9f5SAlessio Igor Bogani mutex_unlock(&priv->cfg_lock); 140195da310eSAlan Cox return 0; 1402e49bbce1SJohan Hovold } 14031da177e4SLinus Torvalds 1404c466cd2bSGreg Kroah-Hartman static int get_lsr_info(struct usb_serial_port *port, 1405c466cd2bSGreg Kroah-Hartman struct serial_struct __user *retinfo) 1406c466cd2bSGreg Kroah-Hartman { 1407c466cd2bSGreg Kroah-Hartman struct ftdi_private *priv = usb_get_serial_port_data(port); 1408c466cd2bSGreg Kroah-Hartman unsigned int result = 0; 1409c466cd2bSGreg Kroah-Hartman 1410c466cd2bSGreg Kroah-Hartman if (!retinfo) 1411c466cd2bSGreg Kroah-Hartman return -EFAULT; 1412c466cd2bSGreg Kroah-Hartman 1413c466cd2bSGreg Kroah-Hartman if (priv->transmit_empty) 1414c466cd2bSGreg Kroah-Hartman result = TIOCSER_TEMT; 1415c466cd2bSGreg Kroah-Hartman 1416c466cd2bSGreg Kroah-Hartman if (copy_to_user(retinfo, &result, sizeof(unsigned int))) 1417c466cd2bSGreg Kroah-Hartman return -EFAULT; 1418c466cd2bSGreg Kroah-Hartman return 0; 1419c466cd2bSGreg Kroah-Hartman } 1420c466cd2bSGreg Kroah-Hartman 14211da177e4SLinus Torvalds 14228f977e42SIan Abbott /* Determine type of FTDI chip based on USB config and descriptor. */ 14238f977e42SIan Abbott static void ftdi_determine_type(struct usb_serial_port *port) 14248f977e42SIan Abbott { 14258f977e42SIan Abbott struct ftdi_private *priv = usb_get_serial_port_data(port); 14268f977e42SIan Abbott struct usb_serial *serial = port->serial; 14278f977e42SIan Abbott struct usb_device *udev = serial->dev; 14288f977e42SIan Abbott unsigned version; 14298f977e42SIan Abbott unsigned interfaces; 14308f977e42SIan Abbott 14318f977e42SIan Abbott /* Assume it is not the original SIO device for now. */ 1432f5e09b7cSIan Abbott priv->baud_base = 48000000 / 2; 14338f977e42SIan Abbott 14348f977e42SIan Abbott version = le16_to_cpu(udev->descriptor.bcdDevice); 14358f977e42SIan Abbott interfaces = udev->actconfig->desc.bNumInterfaces; 1436bfc51614SGreg Kroah-Hartman dev_dbg(&port->dev, "%s: bcdDevice = 0x%x, bNumInterfaces = %u\n", __func__, 14378f977e42SIan Abbott version, interfaces); 14388f977e42SIan Abbott if (interfaces > 1) { 14398f977e42SIan Abbott int inter; 14408f977e42SIan Abbott 1441094c2e6dSMark Adamson /* Multiple interfaces.*/ 1442094c2e6dSMark Adamson if (version == 0x0800) { 1443094c2e6dSMark Adamson priv->chip_type = FT4232H; 1444094c2e6dSMark Adamson /* Hi-speed - baud clock runs at 120MHz */ 1445094c2e6dSMark Adamson priv->baud_base = 120000000 / 2; 1446094c2e6dSMark Adamson } else if (version == 0x0700) { 1447094c2e6dSMark Adamson priv->chip_type = FT2232H; 1448094c2e6dSMark Adamson /* Hi-speed - baud clock runs at 120MHz */ 1449094c2e6dSMark Adamson priv->baud_base = 120000000 / 2; 1450094c2e6dSMark Adamson } else 14518f977e42SIan Abbott priv->chip_type = FT2232C; 1452094c2e6dSMark Adamson 14538f977e42SIan Abbott /* Determine interface code. */ 14548f977e42SIan Abbott inter = serial->interface->altsetting->desc.bInterfaceNumber; 1455094c2e6dSMark Adamson if (inter == 0) { 1456094c2e6dSMark Adamson priv->interface = INTERFACE_A; 1457094c2e6dSMark Adamson } else if (inter == 1) { 1458094c2e6dSMark Adamson priv->interface = INTERFACE_B; 1459094c2e6dSMark Adamson } else if (inter == 2) { 1460094c2e6dSMark Adamson priv->interface = INTERFACE_C; 1461094c2e6dSMark Adamson } else if (inter == 3) { 1462094c2e6dSMark Adamson priv->interface = INTERFACE_D; 1463094c2e6dSMark Adamson } 14648f977e42SIan Abbott /* BM-type devices have a bug where bcdDevice gets set 14658f977e42SIan Abbott * to 0x200 when iSerialNumber is 0. */ 14668f977e42SIan Abbott if (version < 0x500) { 1467bfc51614SGreg Kroah-Hartman dev_dbg(&port->dev, 1468bfc51614SGreg Kroah-Hartman "%s: something fishy - bcdDevice too low for multi-interface device\n", 1469441b62c1SHarvey Harrison __func__); 14708f977e42SIan Abbott } 14718f977e42SIan Abbott } else if (version < 0x200) { 1472330e3c4cSAndreas Mohr /* Old device. Assume it's the original SIO. */ 14738f977e42SIan Abbott priv->chip_type = SIO; 14748f977e42SIan Abbott priv->baud_base = 12000000 / 16; 14758f977e42SIan Abbott } else if (version < 0x400) { 1476330e3c4cSAndreas Mohr /* Assume it's an FT8U232AM (or FT8U245AM) */ 14778f977e42SIan Abbott /* (It might be a BM because of the iSerialNumber bug, 14788f977e42SIan Abbott * but it will still work as an AM device.) */ 14798f977e42SIan Abbott priv->chip_type = FT8U232AM; 14803b009c63SDavid Brownell } else if (version < 0x600) { 1481330e3c4cSAndreas Mohr /* Assume it's an FT232BM (or FT245BM) */ 14828f977e42SIan Abbott priv->chip_type = FT232BM; 1483309427b6SUwe Bonnes } else if (version < 0x900) { 1484309427b6SUwe Bonnes /* Assume it's an FT232RL */ 14853b009c63SDavid Brownell priv->chip_type = FT232RL; 1486dc0827c1SJim Paris } else if (version < 0x1000) { 1487309427b6SUwe Bonnes /* Assume it's an FT232H */ 1488309427b6SUwe Bonnes priv->chip_type = FT232H; 1489dc0827c1SJim Paris } else { 1490dc0827c1SJim Paris /* Assume it's an FT-X series device */ 1491dc0827c1SJim Paris priv->chip_type = FTX; 14928f977e42SIan Abbott } 1493dc0827c1SJim Paris 1494c197a8dbSGreg Kroah-Hartman dev_info(&udev->dev, "Detected %s\n", ftdi_chip_name[priv->chip_type]); 14958f977e42SIan Abbott } 14968f977e42SIan Abbott 14978f977e42SIan Abbott 1498895f28baSMark Adamson /* Determine the maximum packet size for the device. This depends on the chip 1499895f28baSMark Adamson * type and the USB host capabilities. The value should be obtained from the 1500895f28baSMark Adamson * device descriptor as the chip will use the appropriate values for the host.*/ 1501895f28baSMark Adamson static void ftdi_set_max_packet_size(struct usb_serial_port *port) 1502895f28baSMark Adamson { 1503895f28baSMark Adamson struct ftdi_private *priv = usb_get_serial_port_data(port); 1504895f28baSMark Adamson struct usb_serial *serial = port->serial; 1505895f28baSMark Adamson struct usb_device *udev = serial->dev; 1506895f28baSMark Adamson 1507895f28baSMark Adamson struct usb_interface *interface = serial->interface; 1508895f28baSMark Adamson struct usb_endpoint_descriptor *ep_desc = &interface->cur_altsetting->endpoint[1].desc; 1509895f28baSMark Adamson 1510895f28baSMark Adamson unsigned num_endpoints; 1511c1284d77SJohan Hovold int i; 1512895f28baSMark Adamson 1513895f28baSMark Adamson num_endpoints = interface->cur_altsetting->desc.bNumEndpoints; 1514895f28baSMark Adamson dev_info(&udev->dev, "Number of endpoints %d\n", num_endpoints); 1515895f28baSMark Adamson 1516895f28baSMark Adamson /* NOTE: some customers have programmed FT232R/FT245R devices 1517895f28baSMark Adamson * with an endpoint size of 0 - not good. In this case, we 1518895f28baSMark Adamson * want to override the endpoint descriptor setting and use a 1519895f28baSMark Adamson * value of 64 for wMaxPacketSize */ 1520895f28baSMark Adamson for (i = 0; i < num_endpoints; i++) { 1521895f28baSMark Adamson dev_info(&udev->dev, "Endpoint %d MaxPacketSize %d\n", i+1, 1522895f28baSMark Adamson interface->cur_altsetting->endpoint[i].desc.wMaxPacketSize); 1523895f28baSMark Adamson ep_desc = &interface->cur_altsetting->endpoint[i].desc; 1524895f28baSMark Adamson if (ep_desc->wMaxPacketSize == 0) { 1525895f28baSMark Adamson ep_desc->wMaxPacketSize = cpu_to_le16(0x40); 1526895f28baSMark Adamson dev_info(&udev->dev, "Overriding wMaxPacketSize on endpoint %d\n", i); 1527895f28baSMark Adamson } 1528895f28baSMark Adamson } 1529895f28baSMark Adamson 1530895f28baSMark Adamson /* set max packet size based on descriptor */ 153129cc8897SKuninori Morimoto priv->max_packet_size = usb_endpoint_maxp(ep_desc); 1532895f28baSMark Adamson 1533895f28baSMark Adamson dev_info(&udev->dev, "Setting MaxPacketSize %d\n", priv->max_packet_size); 1534895f28baSMark Adamson } 1535895f28baSMark Adamson 1536895f28baSMark Adamson 15371da177e4SLinus Torvalds /* 15381da177e4SLinus Torvalds * *************************************************************************** 15391da177e4SLinus Torvalds * Sysfs Attribute 15401da177e4SLinus Torvalds * *************************************************************************** 15411da177e4SLinus Torvalds */ 15421da177e4SLinus Torvalds 1543464cbb24SAlan Cox static ssize_t show_latency_timer(struct device *dev, 1544464cbb24SAlan Cox struct device_attribute *attr, char *buf) 15451da177e4SLinus Torvalds { 15461da177e4SLinus Torvalds struct usb_serial_port *port = to_usb_serial_port(dev); 15471da177e4SLinus Torvalds struct ftdi_private *priv = usb_get_serial_port_data(port); 1548557aaa7fSAlan Cox if (priv->flags & ASYNC_LOW_LATENCY) 1549557aaa7fSAlan Cox return sprintf(buf, "1\n"); 1550557aaa7fSAlan Cox else 1551557aaa7fSAlan Cox return sprintf(buf, "%i\n", priv->latency); 15521da177e4SLinus Torvalds } 1553557aaa7fSAlan Cox 15541da177e4SLinus Torvalds 15551da177e4SLinus Torvalds /* Write a new value of the latency timer, in units of milliseconds. */ 1556464cbb24SAlan Cox static ssize_t store_latency_timer(struct device *dev, 1557464cbb24SAlan Cox struct device_attribute *attr, const char *valbuf, 15581da177e4SLinus Torvalds size_t count) 15591da177e4SLinus Torvalds { 15601da177e4SLinus Torvalds struct usb_serial_port *port = to_usb_serial_port(dev); 15611da177e4SLinus Torvalds struct ftdi_private *priv = usb_get_serial_port_data(port); 15621da177e4SLinus Torvalds int v = simple_strtoul(valbuf, NULL, 10); 1563c1284d77SJohan Hovold int rv; 15641da177e4SLinus Torvalds 1565557aaa7fSAlan Cox priv->latency = v; 1566557aaa7fSAlan Cox rv = write_latency_timer(port); 1567557aaa7fSAlan Cox if (rv < 0) 15681da177e4SLinus Torvalds return -EIO; 15691da177e4SLinus Torvalds return count; 15701da177e4SLinus Torvalds } 15711da177e4SLinus Torvalds 15721da177e4SLinus Torvalds /* Write an event character directly to the FTDI register. The ASCII 15731da177e4SLinus Torvalds value is in the low 8 bits, with the enable bit in the 9th bit. */ 1574464cbb24SAlan Cox static ssize_t store_event_char(struct device *dev, 1575464cbb24SAlan Cox struct device_attribute *attr, const char *valbuf, size_t count) 15761da177e4SLinus Torvalds { 15771da177e4SLinus Torvalds struct usb_serial_port *port = to_usb_serial_port(dev); 15781da177e4SLinus Torvalds struct ftdi_private *priv = usb_get_serial_port_data(port); 157912bdbe03SJim Radford struct usb_device *udev = port->serial->dev; 15801da177e4SLinus Torvalds int v = simple_strtoul(valbuf, NULL, 10); 1581c1284d77SJohan Hovold int rv; 15821da177e4SLinus Torvalds 1583bfc51614SGreg Kroah-Hartman dev_dbg(&port->dev, "%s: setting event char = %i\n", __func__, v); 15841da177e4SLinus Torvalds 15851da177e4SLinus Torvalds rv = usb_control_msg(udev, 15861da177e4SLinus Torvalds usb_sndctrlpipe(udev, 0), 15871da177e4SLinus Torvalds FTDI_SIO_SET_EVENT_CHAR_REQUEST, 15881da177e4SLinus Torvalds FTDI_SIO_SET_EVENT_CHAR_REQUEST_TYPE, 15891da177e4SLinus Torvalds v, priv->interface, 159066e47e60SJohan Hovold NULL, 0, WDR_TIMEOUT); 15911da177e4SLinus Torvalds if (rv < 0) { 1592bfc51614SGreg Kroah-Hartman dev_dbg(&port->dev, "Unable to write event character: %i\n", rv); 15931da177e4SLinus Torvalds return -EIO; 15941da177e4SLinus Torvalds } 15951da177e4SLinus Torvalds 15961da177e4SLinus Torvalds return count; 15971da177e4SLinus Torvalds } 15981da177e4SLinus Torvalds 1599464cbb24SAlan Cox static DEVICE_ATTR(latency_timer, S_IWUSR | S_IRUGO, show_latency_timer, 1600464cbb24SAlan Cox store_latency_timer); 16011da177e4SLinus Torvalds static DEVICE_ATTR(event_char, S_IWUSR, NULL, store_event_char); 16021da177e4SLinus Torvalds 160312bdbe03SJim Radford static int create_sysfs_attrs(struct usb_serial_port *port) 16041da177e4SLinus Torvalds { 160512bdbe03SJim Radford struct ftdi_private *priv = usb_get_serial_port_data(port); 160613f4db9eSGreg Kroah-Hartman int retval = 0; 16071da177e4SLinus Torvalds 16081da177e4SLinus Torvalds /* XXX I've no idea if the original SIO supports the event_char 16091da177e4SLinus Torvalds * sysfs parameter, so I'm playing it safe. */ 16101da177e4SLinus Torvalds if (priv->chip_type != SIO) { 1611bfc51614SGreg Kroah-Hartman dev_dbg(&port->dev, "sysfs attributes for %s\n", ftdi_chip_name[priv->chip_type]); 161212bdbe03SJim Radford retval = device_create_file(&port->dev, &dev_attr_event_char); 161313f4db9eSGreg Kroah-Hartman if ((!retval) && 161497cd49ebSStepan Moskovchenko (priv->chip_type == FT232BM || 161597cd49ebSStepan Moskovchenko priv->chip_type == FT2232C || 1616094c2e6dSMark Adamson priv->chip_type == FT232RL || 1617094c2e6dSMark Adamson priv->chip_type == FT2232H || 1618309427b6SUwe Bonnes priv->chip_type == FT4232H || 1619dc0827c1SJim Paris priv->chip_type == FT232H || 1620dc0827c1SJim Paris priv->chip_type == FTX)) { 162112bdbe03SJim Radford retval = device_create_file(&port->dev, 162213f4db9eSGreg Kroah-Hartman &dev_attr_latency_timer); 16231da177e4SLinus Torvalds } 16241da177e4SLinus Torvalds } 162513f4db9eSGreg Kroah-Hartman return retval; 16261da177e4SLinus Torvalds } 16271da177e4SLinus Torvalds 162812bdbe03SJim Radford static void remove_sysfs_attrs(struct usb_serial_port *port) 16291da177e4SLinus Torvalds { 163012bdbe03SJim Radford struct ftdi_private *priv = usb_get_serial_port_data(port); 16311da177e4SLinus Torvalds 16321da177e4SLinus Torvalds /* XXX see create_sysfs_attrs */ 16331da177e4SLinus Torvalds if (priv->chip_type != SIO) { 163412bdbe03SJim Radford device_remove_file(&port->dev, &dev_attr_event_char); 1635ed6e5282SAndrew M. Bishop if (priv->chip_type == FT232BM || 1636ed6e5282SAndrew M. Bishop priv->chip_type == FT2232C || 1637094c2e6dSMark Adamson priv->chip_type == FT232RL || 1638094c2e6dSMark Adamson priv->chip_type == FT2232H || 1639309427b6SUwe Bonnes priv->chip_type == FT4232H || 1640dc0827c1SJim Paris priv->chip_type == FT232H || 1641dc0827c1SJim Paris priv->chip_type == FTX) { 164212bdbe03SJim Radford device_remove_file(&port->dev, &dev_attr_latency_timer); 16431da177e4SLinus Torvalds } 16441da177e4SLinus Torvalds } 16451da177e4SLinus Torvalds 16461da177e4SLinus Torvalds } 16471da177e4SLinus Torvalds 16481da177e4SLinus Torvalds /* 16491da177e4SLinus Torvalds * *************************************************************************** 16501da177e4SLinus Torvalds * FTDI driver specific functions 16511da177e4SLinus Torvalds * *************************************************************************** 16521da177e4SLinus Torvalds */ 16531da177e4SLinus Torvalds 16548f977e42SIan Abbott /* Probe function to check for special devices */ 1655464cbb24SAlan Cox static int ftdi_sio_probe(struct usb_serial *serial, 1656464cbb24SAlan Cox const struct usb_device_id *id) 16578f977e42SIan Abbott { 1658464cbb24SAlan Cox struct ftdi_sio_quirk *quirk = 1659464cbb24SAlan Cox (struct ftdi_sio_quirk *)id->driver_info; 1660fa91d43bSTony Lindgren 1661fa91d43bSTony Lindgren if (quirk && quirk->probe) { 1662fa91d43bSTony Lindgren int ret = quirk->probe(serial); 1663fa91d43bSTony Lindgren if (ret != 0) 1664fa91d43bSTony Lindgren return ret; 1665fa91d43bSTony Lindgren } 1666fa91d43bSTony Lindgren 16678f977e42SIan Abbott usb_set_serial_data(serial, (void *)id->driver_info); 16688f977e42SIan Abbott 1669fa91d43bSTony Lindgren return 0; 16708f977e42SIan Abbott } 16718f977e42SIan Abbott 167212bdbe03SJim Radford static int ftdi_sio_port_probe(struct usb_serial_port *port) 16731da177e4SLinus Torvalds { 16741da177e4SLinus Torvalds struct ftdi_private *priv; 16750ffbbe25SOliver Neukum struct ftdi_sio_quirk *quirk = usb_get_serial_data(port->serial); 16760ffbbe25SOliver Neukum 16771da177e4SLinus Torvalds 167880b6ca48SEric Sesterhenn priv = kzalloc(sizeof(struct ftdi_private), GFP_KERNEL); 16791da177e4SLinus Torvalds if (!priv) { 1680194343d9SGreg Kroah-Hartman dev_err(&port->dev, "%s- kmalloc(%Zd) failed.\n", __func__, 1681464cbb24SAlan Cox sizeof(struct ftdi_private)); 16821da177e4SLinus Torvalds return -ENOMEM; 16831da177e4SLinus Torvalds } 16841da177e4SLinus Torvalds 1685c45d6320SAlan Stern kref_init(&priv->kref); 1686bd09a9f5SAlessio Igor Bogani mutex_init(&priv->cfg_lock); 16871da177e4SLinus Torvalds init_waitqueue_head(&priv->delta_msr_wait); 16880076b4beSJohan Hovold 16891da177e4SLinus Torvalds priv->flags = ASYNC_LOW_LATENCY; 1690876ae50dSSimon Arlott priv->dev_gone = false; 16911da177e4SLinus Torvalds 16920ffbbe25SOliver Neukum if (quirk && quirk->port_probe) 16930ffbbe25SOliver Neukum quirk->port_probe(priv); 16940ffbbe25SOliver Neukum 169512bdbe03SJim Radford usb_set_serial_port_data(port, priv); 16961da177e4SLinus Torvalds 169712bdbe03SJim Radford ftdi_determine_type(port); 1698895f28baSMark Adamson ftdi_set_max_packet_size(port); 16998c4f99cdSJohan Hovold if (read_latency_timer(port) < 0) 17008c4f99cdSJohan Hovold priv->latency = 16; 1701c19db4c9SJohan Hovold write_latency_timer(port); 170212bdbe03SJim Radford create_sysfs_attrs(port); 170312bdbe03SJim Radford return 0; 17041da177e4SLinus Torvalds } 17051da177e4SLinus Torvalds 17068f977e42SIan Abbott /* Setup for the USB-UIRT device, which requires hardwired 17078f977e42SIan Abbott * baudrate (38400 gets mapped to 312500) */ 17081da177e4SLinus Torvalds /* Called from usbserial:serial_probe */ 17090ffbbe25SOliver Neukum static void ftdi_USB_UIRT_setup(struct ftdi_private *priv) 17101da177e4SLinus Torvalds { 17111da177e4SLinus Torvalds priv->flags |= ASYNC_SPD_CUST; 17121da177e4SLinus Torvalds priv->custom_divisor = 77; 1713669a6db1SAlan Cox priv->force_baud = 38400; 1714e49bbce1SJohan Hovold } 17151da177e4SLinus Torvalds 17168f977e42SIan Abbott /* Setup for the HE-TIRA1 device, which requires hardwired 17178f977e42SIan Abbott * baudrate (38400 gets mapped to 100000) and RTS-CTS enabled. */ 1718464cbb24SAlan Cox 17190ffbbe25SOliver Neukum static void ftdi_HE_TIRA1_setup(struct ftdi_private *priv) 17208f977e42SIan Abbott { 17211da177e4SLinus Torvalds priv->flags |= ASYNC_SPD_CUST; 17221da177e4SLinus Torvalds priv->custom_divisor = 240; 1723669a6db1SAlan Cox priv->force_baud = 38400; 17241da177e4SLinus Torvalds priv->force_rtscts = 1; 1725e49bbce1SJohan Hovold } 17261da177e4SLinus Torvalds 1727fa91d43bSTony Lindgren /* 1728b760dac2SMartin Geleynse * Module parameter to control latency timer for NDI FTDI-based USB devices. 1729970e2486SLucas De Marchi * If this value is not set in /etc/modprobe.d/ its value will be set 1730970e2486SLucas De Marchi * to 1ms. 1731b760dac2SMartin Geleynse */ 1732b760dac2SMartin Geleynse static int ndi_latency_timer = 1; 1733b760dac2SMartin Geleynse 1734b760dac2SMartin Geleynse /* Setup for the NDI FTDI-based USB devices, which requires hardwired 1735b760dac2SMartin Geleynse * baudrate (19200 gets mapped to 1200000). 1736b760dac2SMartin Geleynse * 1737b760dac2SMartin Geleynse * Called from usbserial:serial_probe. 1738b760dac2SMartin Geleynse */ 1739b760dac2SMartin Geleynse static int ftdi_NDI_device_setup(struct usb_serial *serial) 1740b760dac2SMartin Geleynse { 1741b760dac2SMartin Geleynse struct usb_device *udev = serial->dev; 1742b760dac2SMartin Geleynse int latency = ndi_latency_timer; 1743b760dac2SMartin Geleynse 1744b760dac2SMartin Geleynse if (latency == 0) 1745b760dac2SMartin Geleynse latency = 1; 1746b760dac2SMartin Geleynse if (latency > 99) 1747b760dac2SMartin Geleynse latency = 99; 1748b760dac2SMartin Geleynse 1749bfc51614SGreg Kroah-Hartman dev_dbg(&udev->dev, "%s setting NDI device latency to %d\n", __func__, latency); 1750bfc51614SGreg Kroah-Hartman dev_info(&udev->dev, "NDI device with a latency value of %d\n", latency); 1751b760dac2SMartin Geleynse 1752c1284d77SJohan Hovold /* FIXME: errors are not returned */ 1753c1284d77SJohan Hovold usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 1754b760dac2SMartin Geleynse FTDI_SIO_SET_LATENCY_TIMER_REQUEST, 1755b760dac2SMartin Geleynse FTDI_SIO_SET_LATENCY_TIMER_REQUEST_TYPE, 175666e47e60SJohan Hovold latency, 0, NULL, 0, WDR_TIMEOUT); 1757b760dac2SMartin Geleynse return 0; 1758b760dac2SMartin Geleynse } 1759b760dac2SMartin Geleynse 1760b760dac2SMartin Geleynse /* 176120734345SHarald Welte * First port on JTAG adaptors such as Olimex arm-usb-ocd or the FIC/OpenMoko 176220734345SHarald Welte * Neo1973 Debug Board is reserved for JTAG interface and can be accessed from 176320734345SHarald Welte * userspace using openocd. 1764fa91d43bSTony Lindgren */ 176520734345SHarald Welte static int ftdi_jtag_probe(struct usb_serial *serial) 1766fa91d43bSTony Lindgren { 1767fa91d43bSTony Lindgren struct usb_device *udev = serial->dev; 1768fa91d43bSTony Lindgren struct usb_interface *interface = serial->interface; 1769fa91d43bSTony Lindgren 1770fa91d43bSTony Lindgren if (interface == udev->actconfig->interface[0]) { 1771c197a8dbSGreg Kroah-Hartman dev_info(&udev->dev, 1772c197a8dbSGreg Kroah-Hartman "Ignoring serial port reserved for JTAG\n"); 1773fa91d43bSTony Lindgren return -ENODEV; 1774fa91d43bSTony Lindgren } 1775fa91d43bSTony Lindgren 1776fa91d43bSTony Lindgren return 0; 1777fa91d43bSTony Lindgren } 17781da177e4SLinus Torvalds 1779c96fbdd0SJean-Christophe PLAGNIOL-VILLARD static int ftdi_8u2232c_probe(struct usb_serial *serial) 1780c96fbdd0SJean-Christophe PLAGNIOL-VILLARD { 1781c96fbdd0SJean-Christophe PLAGNIOL-VILLARD struct usb_device *udev = serial->dev; 1782c96fbdd0SJean-Christophe PLAGNIOL-VILLARD 1783444aa7faSPeter Korsgaard if ((udev->manufacturer && !strcmp(udev->manufacturer, "CALAO Systems")) || 1784444aa7faSPeter Korsgaard (udev->product && !strcmp(udev->product, "BeagleBone/XDS100"))) 1785c96fbdd0SJean-Christophe PLAGNIOL-VILLARD return ftdi_jtag_probe(serial); 1786c96fbdd0SJean-Christophe PLAGNIOL-VILLARD 1787c96fbdd0SJean-Christophe PLAGNIOL-VILLARD return 0; 1788c96fbdd0SJean-Christophe PLAGNIOL-VILLARD } 1789c96fbdd0SJean-Christophe PLAGNIOL-VILLARD 1790546d7eecSKevin Vance /* 17916ec2f46cSJean-Christophe PLAGNIOL-VILLARD * First and second port on STMCLiteadaptors is reserved for JTAG interface 17926ec2f46cSJean-Christophe PLAGNIOL-VILLARD * and the forth port for pio 17936ec2f46cSJean-Christophe PLAGNIOL-VILLARD */ 17946ec2f46cSJean-Christophe PLAGNIOL-VILLARD static int ftdi_stmclite_probe(struct usb_serial *serial) 17956ec2f46cSJean-Christophe PLAGNIOL-VILLARD { 17966ec2f46cSJean-Christophe PLAGNIOL-VILLARD struct usb_device *udev = serial->dev; 17976ec2f46cSJean-Christophe PLAGNIOL-VILLARD struct usb_interface *interface = serial->interface; 17986ec2f46cSJean-Christophe PLAGNIOL-VILLARD 17996ec2f46cSJean-Christophe PLAGNIOL-VILLARD if (interface == udev->actconfig->interface[2]) 18006ec2f46cSJean-Christophe PLAGNIOL-VILLARD return 0; 18016ec2f46cSJean-Christophe PLAGNIOL-VILLARD 18026ec2f46cSJean-Christophe PLAGNIOL-VILLARD dev_info(&udev->dev, "Ignoring serial port reserved for JTAG\n"); 18036ec2f46cSJean-Christophe PLAGNIOL-VILLARD 18046ec2f46cSJean-Christophe PLAGNIOL-VILLARD return -ENODEV; 18056ec2f46cSJean-Christophe PLAGNIOL-VILLARD } 18066ec2f46cSJean-Christophe PLAGNIOL-VILLARD 18076ec2f46cSJean-Christophe PLAGNIOL-VILLARD /* 1808546d7eecSKevin Vance * The Matrix Orbital VK204-25-USB has an invalid IN endpoint. 1809546d7eecSKevin Vance * We have to correct it if we want to read from it. 1810546d7eecSKevin Vance */ 1811546d7eecSKevin Vance static int ftdi_mtxorb_hack_setup(struct usb_serial *serial) 1812546d7eecSKevin Vance { 1813546d7eecSKevin Vance struct usb_host_endpoint *ep = serial->dev->ep_in[1]; 1814546d7eecSKevin Vance struct usb_endpoint_descriptor *ep_desc = &ep->desc; 1815546d7eecSKevin Vance 1816546d7eecSKevin Vance if (ep->enabled && ep_desc->wMaxPacketSize == 0) { 1817fd05e720SAl Viro ep_desc->wMaxPacketSize = cpu_to_le16(0x40); 1818c197a8dbSGreg Kroah-Hartman dev_info(&serial->dev->dev, 1819c197a8dbSGreg Kroah-Hartman "Fixing invalid wMaxPacketSize on read pipe\n"); 1820546d7eecSKevin Vance } 1821546d7eecSKevin Vance 1822546d7eecSKevin Vance return 0; 1823546d7eecSKevin Vance } 1824546d7eecSKevin Vance 1825c45d6320SAlan Stern static void ftdi_sio_priv_release(struct kref *k) 1826c45d6320SAlan Stern { 1827c45d6320SAlan Stern struct ftdi_private *priv = container_of(k, struct ftdi_private, kref); 1828c45d6320SAlan Stern 1829c45d6320SAlan Stern kfree(priv); 1830c45d6320SAlan Stern } 1831c45d6320SAlan Stern 183212bdbe03SJim Radford static int ftdi_sio_port_remove(struct usb_serial_port *port) 183312bdbe03SJim Radford { 18341da177e4SLinus Torvalds struct ftdi_private *priv = usb_get_serial_port_data(port); 18351da177e4SLinus Torvalds 1836876ae50dSSimon Arlott priv->dev_gone = true; 1837876ae50dSSimon Arlott wake_up_interruptible_all(&priv->delta_msr_wait); 1838876ae50dSSimon Arlott 183912bdbe03SJim Radford remove_sysfs_attrs(port); 18401da177e4SLinus Torvalds 1841c45d6320SAlan Stern kref_put(&priv->kref, ftdi_sio_priv_release); 18421da177e4SLinus Torvalds 184312bdbe03SJim Radford return 0; 184412bdbe03SJim Radford } 18451da177e4SLinus Torvalds 1846a509a7e4SAlan Cox static int ftdi_open(struct tty_struct *tty, struct usb_serial_port *port) 1847e49bbce1SJohan Hovold { 1848108e02b1SJohan Hovold struct ktermios dummy; 18491da177e4SLinus Torvalds struct usb_device *dev = port->serial->dev; 18501da177e4SLinus Torvalds struct ftdi_private *priv = usb_get_serial_port_data(port); 1851c1284d77SJohan Hovold int result; 18521da177e4SLinus Torvalds 18531da177e4SLinus Torvalds /* No error checking for this (will get errors later anyway) */ 18541da177e4SLinus Torvalds /* See ftdi_sio.h for description of what is reset */ 18551da177e4SLinus Torvalds usb_control_msg(dev, usb_sndctrlpipe(dev, 0), 18561da177e4SLinus Torvalds FTDI_SIO_RESET_REQUEST, FTDI_SIO_RESET_REQUEST_TYPE, 18571da177e4SLinus Torvalds FTDI_SIO_RESET_SIO, 185866e47e60SJohan Hovold priv->interface, NULL, 0, WDR_TIMEOUT); 18591da177e4SLinus Torvalds 18601da177e4SLinus Torvalds /* Termios defaults are set by usb_serial_init. We don't change 1861c4f01240SNick Andrew port->tty->termios - this would lose speed settings, etc. 18621da177e4SLinus Torvalds This is same behaviour as serial.c/rs_open() - Kuba */ 18631da177e4SLinus Torvalds 18641da177e4SLinus Torvalds /* ftdi_set_termios will send usb control messages */ 1865108e02b1SJohan Hovold if (tty) { 1866108e02b1SJohan Hovold memset(&dummy, 0, sizeof(dummy)); 1867108e02b1SJohan Hovold ftdi_set_termios(tty, port, &dummy); 1868108e02b1SJohan Hovold } 18691da177e4SLinus Torvalds 18701da177e4SLinus Torvalds /* Start reading from the device */ 18711b551015SJohan Hovold result = usb_serial_generic_open(tty, port); 1872cc01f17dSJohan Hovold if (!result) 1873c45d6320SAlan Stern kref_get(&priv->kref); 18741da177e4SLinus Torvalds 18751da177e4SLinus Torvalds return result; 1876e49bbce1SJohan Hovold } 18771da177e4SLinus Torvalds 1878335f8514SAlan Cox static void ftdi_dtr_rts(struct usb_serial_port *port, int on) 1879335f8514SAlan Cox { 1880335f8514SAlan Cox struct ftdi_private *priv = usb_get_serial_port_data(port); 1881335f8514SAlan Cox 1882335f8514SAlan Cox mutex_lock(&port->serial->disc_mutex); 1883335f8514SAlan Cox if (!port->serial->disconnected) { 1884335f8514SAlan Cox /* Disable flow control */ 1885335f8514SAlan Cox if (!on && usb_control_msg(port->serial->dev, 1886335f8514SAlan Cox usb_sndctrlpipe(port->serial->dev, 0), 1887335f8514SAlan Cox FTDI_SIO_SET_FLOW_CTRL_REQUEST, 1888335f8514SAlan Cox FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE, 188966e47e60SJohan Hovold 0, priv->interface, NULL, 0, 1890335f8514SAlan Cox WDR_TIMEOUT) < 0) { 1891335f8514SAlan Cox dev_err(&port->dev, "error from flowcontrol urb\n"); 1892335f8514SAlan Cox } 1893335f8514SAlan Cox /* drop RTS and DTR */ 1894335f8514SAlan Cox if (on) 1895335f8514SAlan Cox set_mctrl(port, TIOCM_DTR | TIOCM_RTS); 1896335f8514SAlan Cox else 1897335f8514SAlan Cox clear_mctrl(port, TIOCM_DTR | TIOCM_RTS); 1898335f8514SAlan Cox } 1899335f8514SAlan Cox mutex_unlock(&port->serial->disc_mutex); 1900335f8514SAlan Cox } 19011da177e4SLinus Torvalds 19021da177e4SLinus Torvalds /* 19031da177e4SLinus Torvalds * usbserial:__serial_close only calls ftdi_close if the point is open 19041da177e4SLinus Torvalds * 19051da177e4SLinus Torvalds * This only gets called when it is the last close 19061da177e4SLinus Torvalds */ 1907335f8514SAlan Cox static void ftdi_close(struct usb_serial_port *port) 1908e49bbce1SJohan Hovold { 19091da177e4SLinus Torvalds struct ftdi_private *priv = usb_get_serial_port_data(port); 19101da177e4SLinus Torvalds 1911c23e5fc1SJohan Hovold usb_serial_generic_close(port); 1912c45d6320SAlan Stern kref_put(&priv->kref, ftdi_sio_priv_release); 1913e49bbce1SJohan Hovold } 19141da177e4SLinus Torvalds 19151da177e4SLinus Torvalds /* The SIO requires the first byte to have: 19161da177e4SLinus Torvalds * B0 1 19171da177e4SLinus Torvalds * B1 0 19181da177e4SLinus Torvalds * B2..7 length of message excluding byte 0 19191da177e4SLinus Torvalds * 19201da177e4SLinus Torvalds * The new devices do not require this byte 19211da177e4SLinus Torvalds */ 1922d3901a06SJohan Hovold static int ftdi_prepare_write_buffer(struct usb_serial_port *port, 1923c23e5fc1SJohan Hovold void *dest, size_t size) 1924e49bbce1SJohan Hovold { 1925d3901a06SJohan Hovold struct ftdi_private *priv; 1926c23e5fc1SJohan Hovold int count; 1927c23e5fc1SJohan Hovold unsigned long flags; 19281da177e4SLinus Torvalds 1929d3901a06SJohan Hovold priv = usb_get_serial_port_data(port); 19301da177e4SLinus Torvalds 1931e8770484SJohan Hovold if (priv->chip_type == SIO) { 1932c23e5fc1SJohan Hovold unsigned char *buffer = dest; 1933c23e5fc1SJohan Hovold int i, len, c; 19341da177e4SLinus Torvalds 1935c23e5fc1SJohan Hovold count = 0; 1936c23e5fc1SJohan Hovold spin_lock_irqsave(&port->lock, flags); 1937c23e5fc1SJohan Hovold for (i = 0; i < size - 1; i += priv->max_packet_size) { 1938c23e5fc1SJohan Hovold len = min_t(int, size - i, priv->max_packet_size) - 1; 1939c23e5fc1SJohan Hovold c = kfifo_out(&port->write_fifo, &buffer[i + 1], len); 1940c23e5fc1SJohan Hovold if (!c) 1941c23e5fc1SJohan Hovold break; 1942da7fbb6dSUwe Bonnes priv->icount.tx += c; 1943c1aa075aSJohan Hovold buffer[i] = (c << 2) + 1; 1944c23e5fc1SJohan Hovold count += c + 1; 19451da177e4SLinus Torvalds } 1946c23e5fc1SJohan Hovold spin_unlock_irqrestore(&port->lock, flags); 19471da177e4SLinus Torvalds } else { 1948c23e5fc1SJohan Hovold count = kfifo_out_locked(&port->write_fifo, dest, size, 1949c23e5fc1SJohan Hovold &port->lock); 1950da7fbb6dSUwe Bonnes priv->icount.tx += count; 19511da177e4SLinus Torvalds } 19521da177e4SLinus Torvalds 19531da177e4SLinus Torvalds return count; 195495da310eSAlan Cox } 19551da177e4SLinus Torvalds 1956166ceb69SJohan Hovold #define FTDI_RS_ERR_MASK (FTDI_RS_BI | FTDI_RS_PE | FTDI_RS_FE | FTDI_RS_OE) 1957166ceb69SJohan Hovold 1958cc01f17dSJohan Hovold static int ftdi_process_packet(struct tty_struct *tty, 1959cc01f17dSJohan Hovold struct usb_serial_port *port, struct ftdi_private *priv, 1960cc01f17dSJohan Hovold char *packet, int len) 196195da310eSAlan Cox { 19621da177e4SLinus Torvalds int i; 1963cc01f17dSJohan Hovold char status; 1964cc01f17dSJohan Hovold char flag; 1965cc01f17dSJohan Hovold char *ch; 19661da177e4SLinus Torvalds 1967cc01f17dSJohan Hovold if (len < 2) { 1968bfc51614SGreg Kroah-Hartman dev_dbg(&port->dev, "malformed packet\n"); 1969cc01f17dSJohan Hovold return 0; 19701da177e4SLinus Torvalds } 19711da177e4SLinus Torvalds 1972464cbb24SAlan Cox /* Compare new line status to the old one, signal if different/ 1973464cbb24SAlan Cox N.B. packet may be processed more than once, but differences 1974464cbb24SAlan Cox are only processed once. */ 1975cc01f17dSJohan Hovold status = packet[0] & FTDI_STATUS_B0_MASK; 1976cc01f17dSJohan Hovold if (status != priv->prev_status) { 1977fca5430dSSimon Arlott char diff_status = status ^ priv->prev_status; 1978fca5430dSSimon Arlott 1979fca5430dSSimon Arlott if (diff_status & FTDI_RS0_CTS) 1980fca5430dSSimon Arlott priv->icount.cts++; 1981fca5430dSSimon Arlott if (diff_status & FTDI_RS0_DSR) 1982fca5430dSSimon Arlott priv->icount.dsr++; 1983fca5430dSSimon Arlott if (diff_status & FTDI_RS0_RI) 1984fca5430dSSimon Arlott priv->icount.rng++; 1985fca5430dSSimon Arlott if (diff_status & FTDI_RS0_RLSD) 1986fca5430dSSimon Arlott priv->icount.dcd++; 1987fca5430dSSimon Arlott 1988fca5430dSSimon Arlott wake_up_interruptible_all(&priv->delta_msr_wait); 1989cc01f17dSJohan Hovold priv->prev_status = status; 19901da177e4SLinus Torvalds } 19911da177e4SLinus Torvalds 1992cc01f17dSJohan Hovold flag = TTY_NORMAL; 1993166ceb69SJohan Hovold if (packet[1] & FTDI_RS_ERR_MASK) { 1994166ceb69SJohan Hovold /* Break takes precedence over parity, which takes precedence 1995166ceb69SJohan Hovold * over framing errors */ 1996cc01f17dSJohan Hovold if (packet[1] & FTDI_RS_BI) { 1997cc01f17dSJohan Hovold flag = TTY_BREAK; 1998005b3cdeSUwe Bonnes priv->icount.brk++; 199972fda3caSJason Wessel usb_serial_handle_break(port); 2000166ceb69SJohan Hovold } else if (packet[1] & FTDI_RS_PE) { 2001cc01f17dSJohan Hovold flag = TTY_PARITY; 2002005b3cdeSUwe Bonnes priv->icount.parity++; 2003166ceb69SJohan Hovold } else if (packet[1] & FTDI_RS_FE) { 2004cc01f17dSJohan Hovold flag = TTY_FRAME; 2005005b3cdeSUwe Bonnes priv->icount.frame++; 2006166ceb69SJohan Hovold } 2007166ceb69SJohan Hovold /* Overrun is special, not associated with a char */ 2008005b3cdeSUwe Bonnes if (packet[1] & FTDI_RS_OE) { 2009005b3cdeSUwe Bonnes priv->icount.overrun++; 2010166ceb69SJohan Hovold tty_insert_flip_char(tty, 0, TTY_OVERRUN); 20111da177e4SLinus Torvalds } 2012005b3cdeSUwe Bonnes } 20131da177e4SLinus Torvalds 2014c466cd2bSGreg Kroah-Hartman /* save if the transmitter is empty or not */ 2015c466cd2bSGreg Kroah-Hartman if (packet[1] & FTDI_RS_TEMT) 2016c466cd2bSGreg Kroah-Hartman priv->transmit_empty = 1; 2017c466cd2bSGreg Kroah-Hartman else 2018c466cd2bSGreg Kroah-Hartman priv->transmit_empty = 0; 2019c466cd2bSGreg Kroah-Hartman 2020cc01f17dSJohan Hovold len -= 2; 2021cc01f17dSJohan Hovold if (!len) 2022cc01f17dSJohan Hovold return 0; /* status only */ 2023c9222ec9SUwe Bonnes priv->icount.rx += len; 2024cc01f17dSJohan Hovold ch = packet + 2; 2025cc01f17dSJohan Hovold 202649b2597aSJohan Hovold if (port->port.console && port->sysrq) { 2027cc01f17dSJohan Hovold for (i = 0; i < len; i++, ch++) { 20286ee9f4b4SDmitry Torokhov if (!usb_serial_handle_sysrq_char(port, *ch)) 2029cc01f17dSJohan Hovold tty_insert_flip_char(tty, *ch, flag); 2030cc01f17dSJohan Hovold } 203149b2597aSJohan Hovold } else { 203249b2597aSJohan Hovold tty_insert_flip_string_fixed_flag(tty, ch, flag, len); 2033cc01f17dSJohan Hovold } 203449b2597aSJohan Hovold 2035cc01f17dSJohan Hovold return len; 2036cc01f17dSJohan Hovold } 2037cc01f17dSJohan Hovold 20381b551015SJohan Hovold static void ftdi_process_read_urb(struct urb *urb) 2039cc01f17dSJohan Hovold { 20401b551015SJohan Hovold struct usb_serial_port *port = urb->context; 2041cc01f17dSJohan Hovold struct tty_struct *tty; 2042cc01f17dSJohan Hovold struct ftdi_private *priv = usb_get_serial_port_data(port); 2043cc01f17dSJohan Hovold char *data = (char *)urb->transfer_buffer; 2044cc01f17dSJohan Hovold int i; 2045cc01f17dSJohan Hovold int len; 2046cc01f17dSJohan Hovold int count = 0; 2047cc01f17dSJohan Hovold 2048cc01f17dSJohan Hovold tty = tty_port_tty_get(&port->port); 2049cc01f17dSJohan Hovold if (!tty) 2050cc01f17dSJohan Hovold return; 2051cc01f17dSJohan Hovold 2052cc01f17dSJohan Hovold for (i = 0; i < urb->actual_length; i += priv->max_packet_size) { 2053cc01f17dSJohan Hovold len = min_t(int, urb->actual_length - i, priv->max_packet_size); 2054cc01f17dSJohan Hovold count += ftdi_process_packet(tty, port, priv, &data[i], len); 2055cc01f17dSJohan Hovold } 2056cc01f17dSJohan Hovold 2057cc01f17dSJohan Hovold if (count) 20581da177e4SLinus Torvalds tty_flip_buffer_push(tty); 20594a90f09bSAlan Cox tty_kref_put(tty); 2060cc01f17dSJohan Hovold } 20611da177e4SLinus Torvalds 206295da310eSAlan Cox static void ftdi_break_ctl(struct tty_struct *tty, int break_state) 20631da177e4SLinus Torvalds { 206495da310eSAlan Cox struct usb_serial_port *port = tty->driver_data; 20651da177e4SLinus Torvalds struct ftdi_private *priv = usb_get_serial_port_data(port); 2066c1284d77SJohan Hovold __u16 urb_value; 20671da177e4SLinus Torvalds 20681da177e4SLinus Torvalds /* break_state = -1 to turn on break, and 0 to turn off break */ 20691da177e4SLinus Torvalds /* see drivers/char/tty_io.c to see it used */ 20701da177e4SLinus Torvalds /* last_set_data_urb_value NEVER has the break bit set in it */ 20711da177e4SLinus Torvalds 2072464cbb24SAlan Cox if (break_state) 20731da177e4SLinus Torvalds urb_value = priv->last_set_data_urb_value | FTDI_SIO_SET_BREAK; 2074464cbb24SAlan Cox else 20751da177e4SLinus Torvalds urb_value = priv->last_set_data_urb_value; 20761da177e4SLinus Torvalds 2077464cbb24SAlan Cox if (usb_control_msg(port->serial->dev, 2078464cbb24SAlan Cox usb_sndctrlpipe(port->serial->dev, 0), 20791da177e4SLinus Torvalds FTDI_SIO_SET_DATA_REQUEST, 20801da177e4SLinus Torvalds FTDI_SIO_SET_DATA_REQUEST_TYPE, 20811da177e4SLinus Torvalds urb_value , priv->interface, 208266e47e60SJohan Hovold NULL, 0, WDR_TIMEOUT) < 0) { 2083bfc51614SGreg Kroah-Hartman dev_err(&port->dev, "%s FAILED to enable/disable break state (state was %d)\n", 2084bfc51614SGreg Kroah-Hartman __func__, break_state); 20851da177e4SLinus Torvalds } 20861da177e4SLinus Torvalds 2087bfc51614SGreg Kroah-Hartman dev_dbg(&port->dev, "%s break state is %d - urb is %d\n", __func__, 2088464cbb24SAlan Cox break_state, urb_value); 20891da177e4SLinus Torvalds 20901da177e4SLinus Torvalds } 20911da177e4SLinus Torvalds 20926f602912SJarkko Huijts static int ftdi_chars_in_buffer(struct tty_struct *tty) 20936f602912SJarkko Huijts { 20946f602912SJarkko Huijts struct usb_serial_port *port = tty->driver_data; 20956f602912SJarkko Huijts struct ftdi_private *priv = usb_get_serial_port_data(port); 20966f602912SJarkko Huijts unsigned long flags; 20976f602912SJarkko Huijts int chars; 20986f602912SJarkko Huijts unsigned char *buf; 20996f602912SJarkko Huijts int ret; 21006f602912SJarkko Huijts 21016f602912SJarkko Huijts /* Check software buffer (code from 21026f602912SJarkko Huijts * usb_serial_generic_chars_in_buffer()) */ 21036f602912SJarkko Huijts spin_lock_irqsave(&port->lock, flags); 21046f602912SJarkko Huijts chars = kfifo_len(&port->write_fifo) + port->tx_bytes; 21056f602912SJarkko Huijts spin_unlock_irqrestore(&port->lock, flags); 21066f602912SJarkko Huijts 21076f602912SJarkko Huijts /* Check hardware buffer */ 21086f602912SJarkko Huijts switch (priv->chip_type) { 21096f602912SJarkko Huijts case FT8U232AM: 21106f602912SJarkko Huijts case FT232BM: 21116f602912SJarkko Huijts case FT2232C: 21126f602912SJarkko Huijts case FT232RL: 21136f602912SJarkko Huijts case FT2232H: 21146f602912SJarkko Huijts case FT4232H: 21156f602912SJarkko Huijts case FT232H: 21166f602912SJarkko Huijts case FTX: 21176f602912SJarkko Huijts break; 21186f602912SJarkko Huijts case SIO: 21196f602912SJarkko Huijts default: 21206f602912SJarkko Huijts return chars; 21216f602912SJarkko Huijts } 21226f602912SJarkko Huijts 21236f602912SJarkko Huijts buf = kmalloc(2, GFP_KERNEL); 21246f602912SJarkko Huijts if (!buf) { 21256f602912SJarkko Huijts dev_err(&port->dev, "kmalloc failed"); 21266f602912SJarkko Huijts return chars; 21276f602912SJarkko Huijts } 21286f602912SJarkko Huijts 21296f602912SJarkko Huijts ret = usb_control_msg(port->serial->dev, 21306f602912SJarkko Huijts usb_rcvctrlpipe(port->serial->dev, 0), 21316f602912SJarkko Huijts FTDI_SIO_GET_MODEM_STATUS_REQUEST, 21326f602912SJarkko Huijts FTDI_SIO_GET_MODEM_STATUS_REQUEST_TYPE, 21336f602912SJarkko Huijts 0, priv->interface, 21346f602912SJarkko Huijts buf, 2, WDR_TIMEOUT); 21356f602912SJarkko Huijts 21366f602912SJarkko Huijts if (ret < 2) { 21376f602912SJarkko Huijts dev_err(&port->dev, "Unable to read modem and line status: " 21386f602912SJarkko Huijts "%i\n", ret); 21396f602912SJarkko Huijts goto chars_in_buffer_out; 21406f602912SJarkko Huijts } 21416f602912SJarkko Huijts 21426f602912SJarkko Huijts if (!(buf[1] & FTDI_RS_TEMT)) 21436f602912SJarkko Huijts chars++; 21446f602912SJarkko Huijts 21456f602912SJarkko Huijts chars_in_buffer_out: 21466f602912SJarkko Huijts kfree(buf); 21476f602912SJarkko Huijts return chars; 21486f602912SJarkko Huijts } 21496f602912SJarkko Huijts 21501da177e4SLinus Torvalds /* old_termios contains the original termios settings and tty->termios contains 21511da177e4SLinus Torvalds * the new setting to be used 21521da177e4SLinus Torvalds * WARNING: set_termios calls this with old_termios in kernel space 21531da177e4SLinus Torvalds */ 215495da310eSAlan Cox static void ftdi_set_termios(struct tty_struct *tty, 215595da310eSAlan Cox struct usb_serial_port *port, struct ktermios *old_termios) 2156e49bbce1SJohan Hovold { 21571da177e4SLinus Torvalds struct usb_device *dev = port->serial->dev; 2158bfc51614SGreg Kroah-Hartman struct device *ddev = &port->dev; 21591da177e4SLinus Torvalds struct ftdi_private *priv = usb_get_serial_port_data(port); 2160adc8d746SAlan Cox struct ktermios *termios = &tty->termios; 2161669a6db1SAlan Cox unsigned int cflag = termios->c_cflag; 21621da177e4SLinus Torvalds __u16 urb_value; /* will hold the new flags */ 21631da177e4SLinus Torvalds 2164464cbb24SAlan Cox /* Added for xon/xoff support */ 2165669a6db1SAlan Cox unsigned int iflag = termios->c_iflag; 21661da177e4SLinus Torvalds unsigned char vstop; 21671da177e4SLinus Torvalds unsigned char vstart; 21681da177e4SLinus Torvalds 2169464cbb24SAlan Cox /* Force baud rate if this device requires it, unless it is set to 2170464cbb24SAlan Cox B0. */ 2171669a6db1SAlan Cox if (priv->force_baud && ((termios->c_cflag & CBAUD) != B0)) { 2172bfc51614SGreg Kroah-Hartman dev_dbg(ddev, "%s: forcing baud rate for this device\n", __func__); 217395da310eSAlan Cox tty_encode_baud_rate(tty, priv->force_baud, 2174bd5e47ccSAndrew Morton priv->force_baud); 21751da177e4SLinus Torvalds } 21761da177e4SLinus Torvalds 21771da177e4SLinus Torvalds /* Force RTS-CTS if this device requires it. */ 21781da177e4SLinus Torvalds if (priv->force_rtscts) { 2179bfc51614SGreg Kroah-Hartman dev_dbg(ddev, "%s: forcing rtscts for this device\n", __func__); 2180669a6db1SAlan Cox termios->c_cflag |= CRTSCTS; 21811da177e4SLinus Torvalds } 21821da177e4SLinus Torvalds 2183669a6db1SAlan Cox cflag = termios->c_cflag; 21841da177e4SLinus Torvalds 2185a816e311SYing Xue if (!old_termios) 2186c515598eSAndrew Worsley goto no_skip; 2187c515598eSAndrew Worsley 2188b1ffb4c8SAndrew Worsley if (old_termios->c_cflag == termios->c_cflag 2189b1ffb4c8SAndrew Worsley && old_termios->c_ispeed == termios->c_ispeed 2190b1ffb4c8SAndrew Worsley && old_termios->c_ospeed == termios->c_ospeed) 2191b1ffb4c8SAndrew Worsley goto no_c_cflag_changes; 2192b1ffb4c8SAndrew Worsley 21931da177e4SLinus Torvalds /* NOTE These routines can get interrupted by 2194464cbb24SAlan Cox ftdi_sio_read_bulk_callback - need to examine what this means - 2195464cbb24SAlan Cox don't see any problems yet */ 21961da177e4SLinus Torvalds 2197b1ffb4c8SAndrew Worsley if ((old_termios->c_cflag & (CSIZE|PARODD|PARENB|CMSPAR|CSTOPB)) == 2198b1ffb4c8SAndrew Worsley (termios->c_cflag & (CSIZE|PARODD|PARENB|CMSPAR|CSTOPB))) 2199b1ffb4c8SAndrew Worsley goto no_data_parity_stop_changes; 2200b1ffb4c8SAndrew Worsley 2201c515598eSAndrew Worsley no_skip: 22021da177e4SLinus Torvalds /* Set number of data bits, parity, stop bits */ 22031da177e4SLinus Torvalds 22041da177e4SLinus Torvalds urb_value = 0; 22051da177e4SLinus Torvalds urb_value |= (cflag & CSTOPB ? FTDI_SIO_SET_DATA_STOP_BITS_2 : 22061da177e4SLinus Torvalds FTDI_SIO_SET_DATA_STOP_BITS_1); 220738fcb830SRoland Koebler if (cflag & PARENB) { 220838fcb830SRoland Koebler if (cflag & CMSPAR) 220938fcb830SRoland Koebler urb_value |= cflag & PARODD ? 221038fcb830SRoland Koebler FTDI_SIO_SET_DATA_PARITY_MARK : 221138fcb830SRoland Koebler FTDI_SIO_SET_DATA_PARITY_SPACE; 221238fcb830SRoland Koebler else 221338fcb830SRoland Koebler urb_value |= cflag & PARODD ? 221438fcb830SRoland Koebler FTDI_SIO_SET_DATA_PARITY_ODD : 221538fcb830SRoland Koebler FTDI_SIO_SET_DATA_PARITY_EVEN; 221638fcb830SRoland Koebler } else { 221738fcb830SRoland Koebler urb_value |= FTDI_SIO_SET_DATA_PARITY_NONE; 221838fcb830SRoland Koebler } 22191da177e4SLinus Torvalds if (cflag & CSIZE) { 22201da177e4SLinus Torvalds switch (cflag & CSIZE) { 2221bfc51614SGreg Kroah-Hartman case CS7: 2222bfc51614SGreg Kroah-Hartman urb_value |= 7; 2223bfc51614SGreg Kroah-Hartman dev_dbg(ddev, "Setting CS7\n"); 2224bfc51614SGreg Kroah-Hartman break; 2225bfc51614SGreg Kroah-Hartman case CS8: 2226bfc51614SGreg Kroah-Hartman urb_value |= 8; 2227bfc51614SGreg Kroah-Hartman dev_dbg(ddev, "Setting CS8\n"); 2228bfc51614SGreg Kroah-Hartman break; 22291da177e4SLinus Torvalds default: 2230bfc51614SGreg Kroah-Hartman dev_err(ddev, "CSIZE was set but not CS7-CS8\n"); 22311da177e4SLinus Torvalds } 22321da177e4SLinus Torvalds } 22331da177e4SLinus Torvalds 2234464cbb24SAlan Cox /* This is needed by the break command since it uses the same command 2235464cbb24SAlan Cox - but is or'ed with this value */ 22361da177e4SLinus Torvalds priv->last_set_data_urb_value = urb_value; 22371da177e4SLinus Torvalds 22381da177e4SLinus Torvalds if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0), 22391da177e4SLinus Torvalds FTDI_SIO_SET_DATA_REQUEST, 22401da177e4SLinus Torvalds FTDI_SIO_SET_DATA_REQUEST_TYPE, 22411da177e4SLinus Torvalds urb_value , priv->interface, 224266e47e60SJohan Hovold NULL, 0, WDR_SHORT_TIMEOUT) < 0) { 2243bfc51614SGreg Kroah-Hartman dev_err(ddev, "%s FAILED to set databits/stopbits/parity\n", 2244bfc51614SGreg Kroah-Hartman __func__); 22451da177e4SLinus Torvalds } 22461da177e4SLinus Torvalds 22471da177e4SLinus Torvalds /* Now do the baudrate */ 2248b1ffb4c8SAndrew Worsley no_data_parity_stop_changes: 22491da177e4SLinus Torvalds if ((cflag & CBAUD) == B0) { 22501da177e4SLinus Torvalds /* Disable flow control */ 22511da177e4SLinus Torvalds if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0), 22521da177e4SLinus Torvalds FTDI_SIO_SET_FLOW_CTRL_REQUEST, 22531da177e4SLinus Torvalds FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE, 22541da177e4SLinus Torvalds 0, priv->interface, 225566e47e60SJohan Hovold NULL, 0, WDR_TIMEOUT) < 0) { 2256bfc51614SGreg Kroah-Hartman dev_err(ddev, "%s error from disable flowcontrol urb\n", 2257194343d9SGreg Kroah-Hartman __func__); 22581da177e4SLinus Torvalds } 22591da177e4SLinus Torvalds /* Drop RTS and DTR */ 226074ede0ffSIan Abbott clear_mctrl(port, TIOCM_DTR | TIOCM_RTS); 22611da177e4SLinus Torvalds } else { 22621da177e4SLinus Torvalds /* set the baudrate determined before */ 22639c67d28eSAlessio Igor Bogani mutex_lock(&priv->cfg_lock); 2264464cbb24SAlan Cox if (change_speed(tty, port)) 2265bfc51614SGreg Kroah-Hartman dev_err(ddev, "%s urb failed to set baudrate\n", __func__); 22669c67d28eSAlessio Igor Bogani mutex_unlock(&priv->cfg_lock); 226772a755fcSPeter Favrholdt /* Ensure RTS and DTR are raised when baudrate changed from 0 */ 2268464cbb24SAlan Cox if (!old_termios || (old_termios->c_cflag & CBAUD) == B0) 226974ede0ffSIan Abbott set_mctrl(port, TIOCM_DTR | TIOCM_RTS); 22701da177e4SLinus Torvalds } 22711da177e4SLinus Torvalds 22721da177e4SLinus Torvalds /* Set flow control */ 22731da177e4SLinus Torvalds /* Note device also supports DTR/CD (ugh) and Xon/Xoff in hardware */ 2274b1ffb4c8SAndrew Worsley no_c_cflag_changes: 22751da177e4SLinus Torvalds if (cflag & CRTSCTS) { 2276bfc51614SGreg Kroah-Hartman dev_dbg(ddev, "%s Setting to CRTSCTS flow control\n", __func__); 22771da177e4SLinus Torvalds if (usb_control_msg(dev, 22781da177e4SLinus Torvalds usb_sndctrlpipe(dev, 0), 22791da177e4SLinus Torvalds FTDI_SIO_SET_FLOW_CTRL_REQUEST, 22801da177e4SLinus Torvalds FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE, 22811da177e4SLinus Torvalds 0 , (FTDI_SIO_RTS_CTS_HS | priv->interface), 228266e47e60SJohan Hovold NULL, 0, WDR_TIMEOUT) < 0) { 2283bfc51614SGreg Kroah-Hartman dev_err(ddev, "urb failed to set to rts/cts flow control\n"); 22841da177e4SLinus Torvalds } 22851da177e4SLinus Torvalds } else { 22861da177e4SLinus Torvalds /* 22871da177e4SLinus Torvalds * Xon/Xoff code 22881da177e4SLinus Torvalds * 2289464cbb24SAlan Cox * Check the IXOFF status in the iflag component of the 2290464cbb24SAlan Cox * termios structure. If IXOFF is not set, the pre-xon/xoff 2291464cbb24SAlan Cox * code is executed. 22921da177e4SLinus Torvalds */ 22931da177e4SLinus Torvalds if (iflag & IXOFF) { 2294bfc51614SGreg Kroah-Hartman dev_dbg(ddev, "%s request to enable xonxoff iflag=%04x\n", 2295464cbb24SAlan Cox __func__, iflag); 2296464cbb24SAlan Cox /* Try to enable the XON/XOFF on the ftdi_sio 2297464cbb24SAlan Cox * Set the vstart and vstop -- could have been done up 2298464cbb24SAlan Cox * above where a lot of other dereferencing is done but 2299464cbb24SAlan Cox * that would be very inefficient as vstart and vstop 2300464cbb24SAlan Cox * are not always needed. 2301464cbb24SAlan Cox */ 2302669a6db1SAlan Cox vstart = termios->c_cc[VSTART]; 2303669a6db1SAlan Cox vstop = termios->c_cc[VSTOP]; 23041da177e4SLinus Torvalds urb_value = (vstop << 8) | (vstart); 23051da177e4SLinus Torvalds 23061da177e4SLinus Torvalds if (usb_control_msg(dev, 23071da177e4SLinus Torvalds usb_sndctrlpipe(dev, 0), 23081da177e4SLinus Torvalds FTDI_SIO_SET_FLOW_CTRL_REQUEST, 23091da177e4SLinus Torvalds FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE, 23101da177e4SLinus Torvalds urb_value , (FTDI_SIO_XON_XOFF_HS 23111da177e4SLinus Torvalds | priv->interface), 231266e47e60SJohan Hovold NULL, 0, WDR_TIMEOUT) < 0) { 2313194343d9SGreg Kroah-Hartman dev_err(&port->dev, "urb failed to set to " 2314194343d9SGreg Kroah-Hartman "xon/xoff flow control\n"); 23151da177e4SLinus Torvalds } 23161da177e4SLinus Torvalds } else { 2317464cbb24SAlan Cox /* else clause to only run if cflag ! CRTSCTS and iflag 2318464cbb24SAlan Cox * ! XOFF. CHECKME Assuming XON/XOFF handled by tty 2319464cbb24SAlan Cox * stack - not by device */ 2320bfc51614SGreg Kroah-Hartman dev_dbg(ddev, "%s Turning off hardware flow control\n", __func__); 23211da177e4SLinus Torvalds if (usb_control_msg(dev, 23221da177e4SLinus Torvalds usb_sndctrlpipe(dev, 0), 23231da177e4SLinus Torvalds FTDI_SIO_SET_FLOW_CTRL_REQUEST, 23241da177e4SLinus Torvalds FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE, 23251da177e4SLinus Torvalds 0, priv->interface, 232666e47e60SJohan Hovold NULL, 0, WDR_TIMEOUT) < 0) { 2327bfc51614SGreg Kroah-Hartman dev_err(ddev, "urb failed to clear flow control\n"); 23281da177e4SLinus Torvalds } 23291da177e4SLinus Torvalds } 23301da177e4SLinus Torvalds } 233195da310eSAlan Cox } 23321da177e4SLinus Torvalds 233360b33c13SAlan Cox static int ftdi_tiocmget(struct tty_struct *tty) 23341da177e4SLinus Torvalds { 233595da310eSAlan Cox struct usb_serial_port *port = tty->driver_data; 23361da177e4SLinus Torvalds struct ftdi_private *priv = usb_get_serial_port_data(port); 233766e47e60SJohan Hovold unsigned char *buf; 2338a3f8168bSJohan Hovold int len; 23391da177e4SLinus Torvalds int ret; 23401da177e4SLinus Torvalds 234166e47e60SJohan Hovold buf = kmalloc(2, GFP_KERNEL); 234266e47e60SJohan Hovold if (!buf) 234366e47e60SJohan Hovold return -ENOMEM; 2344a3f8168bSJohan Hovold /* 2345a3f8168bSJohan Hovold * The 8U232AM returns a two byte value (the SIO a 1 byte value) in 2346a3f8168bSJohan Hovold * the same format as the data returned from the in point. 2347a3f8168bSJohan Hovold */ 23481da177e4SLinus Torvalds switch (priv->chip_type) { 23491da177e4SLinus Torvalds case SIO: 2350a3f8168bSJohan Hovold len = 1; 23511da177e4SLinus Torvalds break; 23521da177e4SLinus Torvalds case FT8U232AM: 23531da177e4SLinus Torvalds case FT232BM: 23541da177e4SLinus Torvalds case FT2232C: 2355ed6e5282SAndrew M. Bishop case FT232RL: 2356094c2e6dSMark Adamson case FT2232H: 2357094c2e6dSMark Adamson case FT4232H: 2358309427b6SUwe Bonnes case FT232H: 2359dc0827c1SJim Paris case FTX: 2360a3f8168bSJohan Hovold len = 2; 23611da177e4SLinus Torvalds break; 23621da177e4SLinus Torvalds default: 236366e47e60SJohan Hovold ret = -EFAULT; 236466e47e60SJohan Hovold goto out; 23651da177e4SLinus Torvalds } 23661da177e4SLinus Torvalds 2367a3f8168bSJohan Hovold ret = usb_control_msg(port->serial->dev, 2368a3f8168bSJohan Hovold usb_rcvctrlpipe(port->serial->dev, 0), 2369a3f8168bSJohan Hovold FTDI_SIO_GET_MODEM_STATUS_REQUEST, 2370a3f8168bSJohan Hovold FTDI_SIO_GET_MODEM_STATUS_REQUEST_TYPE, 2371a3f8168bSJohan Hovold 0, priv->interface, 2372a3f8168bSJohan Hovold buf, len, WDR_TIMEOUT); 2373*2c2ee545SJohan Hovold if (ret < 0) { 2374*2c2ee545SJohan Hovold ret = usb_translate_errors(ret); 2375a3f8168bSJohan Hovold goto out; 2376*2c2ee545SJohan Hovold } 2377a3f8168bSJohan Hovold 237866e47e60SJohan Hovold ret = (buf[0] & FTDI_SIO_DSR_MASK ? TIOCM_DSR : 0) | 23791da177e4SLinus Torvalds (buf[0] & FTDI_SIO_CTS_MASK ? TIOCM_CTS : 0) | 23801da177e4SLinus Torvalds (buf[0] & FTDI_SIO_RI_MASK ? TIOCM_RI : 0) | 23811da177e4SLinus Torvalds (buf[0] & FTDI_SIO_RLSD_MASK ? TIOCM_CD : 0) | 23821da177e4SLinus Torvalds priv->last_dtr_rts; 238366e47e60SJohan Hovold out: 238466e47e60SJohan Hovold kfree(buf); 238566e47e60SJohan Hovold return ret; 23861da177e4SLinus Torvalds } 23871da177e4SLinus Torvalds 238820b9d177SAlan Cox static int ftdi_tiocmset(struct tty_struct *tty, 238995da310eSAlan Cox unsigned int set, unsigned int clear) 23901da177e4SLinus Torvalds { 239195da310eSAlan Cox struct usb_serial_port *port = tty->driver_data; 2392a09aa7ddSGreg Kroah-Hartman 239374ede0ffSIan Abbott return update_mctrl(port, set, clear); 23941da177e4SLinus Torvalds } 23951da177e4SLinus Torvalds 2396c75ccd48SUwe Bonnes static int ftdi_get_icount(struct tty_struct *tty, 2397c75ccd48SUwe Bonnes struct serial_icounter_struct *icount) 2398c75ccd48SUwe Bonnes { 2399c75ccd48SUwe Bonnes struct usb_serial_port *port = tty->driver_data; 2400c75ccd48SUwe Bonnes struct ftdi_private *priv = usb_get_serial_port_data(port); 2401c75ccd48SUwe Bonnes struct async_icount *ic = &priv->icount; 2402c75ccd48SUwe Bonnes 2403c75ccd48SUwe Bonnes icount->cts = ic->cts; 2404c75ccd48SUwe Bonnes icount->dsr = ic->dsr; 2405c75ccd48SUwe Bonnes icount->rng = ic->rng; 2406c75ccd48SUwe Bonnes icount->dcd = ic->dcd; 2407c75ccd48SUwe Bonnes icount->tx = ic->tx; 2408c75ccd48SUwe Bonnes icount->rx = ic->rx; 2409c75ccd48SUwe Bonnes icount->frame = ic->frame; 2410c75ccd48SUwe Bonnes icount->parity = ic->parity; 2411c75ccd48SUwe Bonnes icount->overrun = ic->overrun; 2412c75ccd48SUwe Bonnes icount->brk = ic->brk; 2413c75ccd48SUwe Bonnes icount->buf_overrun = ic->buf_overrun; 2414c75ccd48SUwe Bonnes return 0; 2415c75ccd48SUwe Bonnes } 2416c75ccd48SUwe Bonnes 241700a0d0d6SAlan Cox static int ftdi_ioctl(struct tty_struct *tty, 2418464cbb24SAlan Cox unsigned int cmd, unsigned long arg) 24191da177e4SLinus Torvalds { 242095da310eSAlan Cox struct usb_serial_port *port = tty->driver_data; 24211da177e4SLinus Torvalds struct ftdi_private *priv = usb_get_serial_port_data(port); 24221d749f9aSUwe Bonnes struct async_icount cnow; 24231d749f9aSUwe Bonnes struct async_icount cprev; 24241da177e4SLinus Torvalds 2425bfc51614SGreg Kroah-Hartman dev_dbg(&port->dev, "%s cmd 0x%04x\n", __func__, cmd); 24261da177e4SLinus Torvalds 24271da177e4SLinus Torvalds /* Based on code from acm.c and others */ 24281da177e4SLinus Torvalds switch (cmd) { 24291da177e4SLinus Torvalds 24301da177e4SLinus Torvalds case TIOCGSERIAL: /* gets serial port data */ 2431464cbb24SAlan Cox return get_serial_info(port, 2432464cbb24SAlan Cox (struct serial_struct __user *) arg); 24331da177e4SLinus Torvalds 24341da177e4SLinus Torvalds case TIOCSSERIAL: /* sets serial port data */ 2435464cbb24SAlan Cox return set_serial_info(tty, port, 2436464cbb24SAlan Cox (struct serial_struct __user *) arg); 24371da177e4SLinus Torvalds 24381da177e4SLinus Torvalds /* 24391da177e4SLinus Torvalds * Wait for any of the 4 modem inputs (DCD,RI,DSR,CTS) to change 24401da177e4SLinus Torvalds * - mask passed in arg for lines of interest 24411da177e4SLinus Torvalds * (use |'ed TIOCM_RNG/DSR/CD/CTS for masking) 24421da177e4SLinus Torvalds * Caller should use TIOCGICOUNT to see which one it was. 24431da177e4SLinus Torvalds * 24441da177e4SLinus Torvalds * This code is borrowed from linux/drivers/char/serial.c 24451da177e4SLinus Torvalds */ 24461da177e4SLinus Torvalds case TIOCMIWAIT: 24471d749f9aSUwe Bonnes cprev = priv->icount; 2448876ae50dSSimon Arlott while (!priv->dev_gone) { 24491da177e4SLinus Torvalds interruptible_sleep_on(&priv->delta_msr_wait); 24501da177e4SLinus Torvalds /* see if a signal did it */ 24511da177e4SLinus Torvalds if (signal_pending(current)) 24521da177e4SLinus Torvalds return -ERESTARTSYS; 24531d749f9aSUwe Bonnes cnow = priv->icount; 24541d749f9aSUwe Bonnes if (((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) || 24551d749f9aSUwe Bonnes ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) || 24561d749f9aSUwe Bonnes ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) || 24571d749f9aSUwe Bonnes ((arg & TIOCM_CTS) && (cnow.cts != cprev.cts))) { 24581da177e4SLinus Torvalds return 0; 24591da177e4SLinus Torvalds } 24601d749f9aSUwe Bonnes cprev = cnow; 24611da177e4SLinus Torvalds } 2462876ae50dSSimon Arlott return -EIO; 24631d749f9aSUwe Bonnes break; 2464c466cd2bSGreg Kroah-Hartman case TIOCSERGETLSR: 2465c466cd2bSGreg Kroah-Hartman return get_lsr_info(port, (struct serial_struct __user *)arg); 2466c466cd2bSGreg Kroah-Hartman break; 24671da177e4SLinus Torvalds default: 24681da177e4SLinus Torvalds break; 24691da177e4SLinus Torvalds } 2470464cbb24SAlan Cox /* This is not necessarily an error - turns out the higher layers 2471464cbb24SAlan Cox * will do some ioctls themselves (see comment above) 24721da177e4SLinus Torvalds */ 2473bfc51614SGreg Kroah-Hartman dev_dbg(&port->dev, "%s arg not supported - it was 0x%04x - check /usr/include/asm/ioctls.h\n", 2474bfc51614SGreg Kroah-Hartman __func__, cmd); 247595da310eSAlan Cox return -ENOIOCTLCMD; 247695da310eSAlan Cox } 24771da177e4SLinus Torvalds 24781da177e4SLinus Torvalds static int __init ftdi_init(void) 24791da177e4SLinus Torvalds { 2480fdcb0a0fSIan Abbott if (vendor > 0 && product > 0) { 2481fdcb0a0fSIan Abbott /* Add user specified VID/PID to reserved element of table. */ 2482fdcb0a0fSIan Abbott int i; 2483fdcb0a0fSIan Abbott for (i = 0; id_table_combined[i].idVendor; i++) 2484fdcb0a0fSIan Abbott ; 2485fdcb0a0fSIan Abbott id_table_combined[i].match_flags = USB_DEVICE_ID_MATCH_DEVICE; 2486fdcb0a0fSIan Abbott id_table_combined[i].idVendor = vendor; 2487fdcb0a0fSIan Abbott id_table_combined[i].idProduct = product; 2488fdcb0a0fSIan Abbott } 24891a71bd2eSGreg Kroah-Hartman return usb_serial_register_drivers(serial_drivers, KBUILD_MODNAME, id_table_combined); 24901da177e4SLinus Torvalds } 24911da177e4SLinus Torvalds 24921da177e4SLinus Torvalds static void __exit ftdi_exit(void) 24931da177e4SLinus Torvalds { 249468e24113SGreg Kroah-Hartman usb_serial_deregister_drivers(serial_drivers); 24951da177e4SLinus Torvalds } 24961da177e4SLinus Torvalds 24971da177e4SLinus Torvalds 24981da177e4SLinus Torvalds module_init(ftdi_init); 24991da177e4SLinus Torvalds module_exit(ftdi_exit); 25001da177e4SLinus Torvalds 25011da177e4SLinus Torvalds MODULE_AUTHOR(DRIVER_AUTHOR); 25021da177e4SLinus Torvalds MODULE_DESCRIPTION(DRIVER_DESC); 25031da177e4SLinus Torvalds MODULE_LICENSE("GPL"); 25041da177e4SLinus Torvalds 2505fdcb0a0fSIan Abbott module_param(vendor, ushort, 0); 2506fdcb0a0fSIan Abbott MODULE_PARM_DESC(vendor, "User specified vendor ID (default=" 2507fdcb0a0fSIan Abbott __MODULE_STRING(FTDI_VID)")"); 2508fdcb0a0fSIan Abbott module_param(product, ushort, 0); 250968265043SPaulius Zaleckas MODULE_PARM_DESC(product, "User specified product ID"); 25101da177e4SLinus Torvalds 2511b760dac2SMartin Geleynse module_param(ndi_latency_timer, int, S_IRUGO | S_IWUSR); 2512b760dac2SMartin Geleynse MODULE_PARM_DESC(ndi_latency_timer, "NDI device latency timer override"); 2513