USB: ftdi_sio: add support for FT-X series devices

Add PID 0x6015, corresponding to the new series of FT-X chips
(FT220XD, FT201X, FT220X, FT221X, FT230X, FT231X, FT240X).  They all
appear as serial devices, and seem indistinguishable except for the
default product string stored in their EEPROM.  The baudrate
generation matches FT232RL devices.

Tested with a FT201X and FT230X at various baudrates (100 - 3000000).

Sample dmesg:
    ftdi_sio: v1.6.0:USB FTDI Serial Converters Driver
    usb 2-1: new full-speed USB device number 6 using ohci_hcd
    usb 2-1: New USB device found, idVendor=0403, idProduct=6015
    usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    usb 2-1: Product: FT230X USB Half UART
    usb 2-1: Manufacturer: FTDI
    usb 2-1: SerialNumber: DC001WI6
    ftdi_sio 2-1:1.0: FTDI USB Serial Device converter detected
    drivers/usb/serial/ftdi_sio.c: ftdi_sio_port_probe
    drivers/usb/serial/ftdi_sio.c: ftdi_determine_type: bcdDevice = 0x1000, bNumInterfaces = 1
    usb 2-1: Detected FT-X
    usb 2-1: Number of endpoints 2
    usb 2-1: Endpoint 1 MaxPacketSize 64
    usb 2-1: Endpoint 2 MaxPacketSize 64
    usb 2-1: Setting MaxPacketSize 64
    drivers/usb/serial/ftdi_sio.c: read_latency_timer
    drivers/usb/serial/ftdi_sio.c: write_latency_timer: setting latency timer = 1
    drivers/usb/serial/ftdi_sio.c: create_sysfs_attrs
    drivers/usb/serial/ftdi_sio.c: sysfs attributes for FT-X
    usb 2-1: FTDI USB Serial Device converter now attached to ttyUSB0

Signed-off-by: Jim Paris <jim@jtan.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Jim Paris 2012-03-14 17:54:25 -04:00 коммит произвёл Greg Kroah-Hartman
Родитель 093ea2d3a7
Коммит dc0827c128
3 изменённых файлов: 18 добавлений и 6 удалений

Просмотреть файл

@ -188,6 +188,7 @@ static struct usb_device_id id_table_combined [] = {
.driver_info = (kernel_ulong_t)&ftdi_8u2232c_quirk }, .driver_info = (kernel_ulong_t)&ftdi_8u2232c_quirk },
{ USB_DEVICE(FTDI_VID, FTDI_4232H_PID) }, { USB_DEVICE(FTDI_VID, FTDI_4232H_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_232H_PID) }, { USB_DEVICE(FTDI_VID, FTDI_232H_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_FTX_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_MICRO_CHAMELEON_PID) }, { USB_DEVICE(FTDI_VID, FTDI_MICRO_CHAMELEON_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_RELAIS_PID) }, { USB_DEVICE(FTDI_VID, FTDI_RELAIS_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_OPENDCC_PID) }, { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_PID) },
@ -873,7 +874,8 @@ static const char *ftdi_chip_name[] = {
[FT232RL] = "FT232RL", [FT232RL] = "FT232RL",
[FT2232H] = "FT2232H", [FT2232H] = "FT2232H",
[FT4232H] = "FT4232H", [FT4232H] = "FT4232H",
[FT232H] = "FT232H" [FT232H] = "FT232H",
[FTX] = "FT-X"
}; };
@ -1177,7 +1179,8 @@ static __u32 get_ftdi_divisor(struct tty_struct *tty,
break; break;
case FT232BM: /* FT232BM chip */ case FT232BM: /* FT232BM chip */
case FT2232C: /* FT2232C chip */ case FT2232C: /* FT2232C chip */
case FT232RL: case FT232RL: /* FT232RL chip */
case FTX: /* FT-X series */
if (baud <= 3000000) { if (baud <= 3000000) {
__u16 product_id = le16_to_cpu( __u16 product_id = le16_to_cpu(
port->serial->dev->descriptor.idProduct); port->serial->dev->descriptor.idProduct);
@ -1466,10 +1469,14 @@ static void ftdi_determine_type(struct usb_serial_port *port)
} else if (version < 0x900) { } else if (version < 0x900) {
/* Assume it's an FT232RL */ /* Assume it's an FT232RL */
priv->chip_type = FT232RL; priv->chip_type = FT232RL;
} else { } else if (version < 0x1000) {
/* Assume it's an FT232H */ /* Assume it's an FT232H */
priv->chip_type = FT232H; priv->chip_type = FT232H;
} else {
/* Assume it's an FT-X series device */
priv->chip_type = FTX;
} }
dev_info(&udev->dev, "Detected %s\n", ftdi_chip_name[priv->chip_type]); dev_info(&udev->dev, "Detected %s\n", ftdi_chip_name[priv->chip_type]);
} }
@ -1597,7 +1604,8 @@ static int create_sysfs_attrs(struct usb_serial_port *port)
priv->chip_type == FT232RL || priv->chip_type == FT232RL ||
priv->chip_type == FT2232H || priv->chip_type == FT2232H ||
priv->chip_type == FT4232H || priv->chip_type == FT4232H ||
priv->chip_type == FT232H)) { priv->chip_type == FT232H ||
priv->chip_type == FTX)) {
retval = device_create_file(&port->dev, retval = device_create_file(&port->dev,
&dev_attr_latency_timer); &dev_attr_latency_timer);
} }
@ -1619,7 +1627,8 @@ static void remove_sysfs_attrs(struct usb_serial_port *port)
priv->chip_type == FT232RL || priv->chip_type == FT232RL ||
priv->chip_type == FT2232H || priv->chip_type == FT2232H ||
priv->chip_type == FT4232H || priv->chip_type == FT4232H ||
priv->chip_type == FT232H) { priv->chip_type == FT232H ||
priv->chip_type == FTX) {
device_remove_file(&port->dev, &dev_attr_latency_timer); device_remove_file(&port->dev, &dev_attr_latency_timer);
} }
} }
@ -2297,6 +2306,7 @@ static int ftdi_tiocmget(struct tty_struct *tty)
case FT2232H: case FT2232H:
case FT4232H: case FT4232H:
case FT232H: case FT232H:
case FTX:
len = 2; len = 2;
break; break;
default: default:

Просмотреть файл

@ -157,7 +157,8 @@ enum ftdi_chip_type {
FT232RL = 5, FT232RL = 5,
FT2232H = 6, FT2232H = 6,
FT4232H = 7, FT4232H = 7,
FT232H = 8 FT232H = 8,
FTX = 9,
}; };
enum ftdi_sio_baudrate { enum ftdi_sio_baudrate {

Просмотреть файл

@ -23,6 +23,7 @@
#define FTDI_8U2232C_PID 0x6010 /* Dual channel device */ #define FTDI_8U2232C_PID 0x6010 /* Dual channel device */
#define FTDI_4232H_PID 0x6011 /* Quad channel hi-speed device */ #define FTDI_4232H_PID 0x6011 /* Quad channel hi-speed device */
#define FTDI_232H_PID 0x6014 /* Single channel hi-speed device */ #define FTDI_232H_PID 0x6014 /* Single channel hi-speed device */
#define FTDI_FTX_PID 0x6015 /* FT-X series (FT201X, FT230X, FT231X, etc) */
#define FTDI_SIO_PID 0x8372 /* Product Id SIO application of 8U100AX */ #define FTDI_SIO_PID 0x8372 /* Product Id SIO application of 8U100AX */
#define FTDI_232RL_PID 0xFBFA /* Product ID for FT232RL */ #define FTDI_232RL_PID 0xFBFA /* Product ID for FT232RL */