lkml.org 
[lkml]   [2016]   [May]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] usb: serial: ti_usb_3410_5052: add MOXA UPORT 11x0 support
On Tue, May 10, 2016 at 09:08:48AM +0200, Mathieu OTHACEHE wrote:
> Add support for :
>
> - UPort 1110 : 1 port RS-232 USB to Serial Hub.
> - UPort 1130 : 1 port RS-422/485 USB to Serial Hub.
> - UPort 1130I : 1 port RS-422/485 USB to Serial Hub with Isolation.
> - UPort 1150 : 1 port RS-232/422/485 USB to Serial Hub.
> - UPort 1150I : 1 port RS-232/422/485 USB to Serial Hub with Isolation.
>
> These devices are based on TI 3410 chip.
>
> Signed-off-by: Mathieu OTHACEHE <m.othacehe@gmail.com>
> ---

> Changelog:
> v2:
> * Add a rs485_only flag to device structure.
> * Try to load moxa firmware without fallback.

> @@ -292,6 +308,9 @@ static int ti_startup(struct usb_serial *serial)
> {
> struct ti_device *tdev;
> struct usb_device *dev = serial->dev;
> + struct usb_host_interface *cur_altsetting;
> + int num_endpoints;
> + u16 model;
> int status;
>
> dev_dbg(&dev->dev,
> @@ -315,8 +334,21 @@ static int ti_startup(struct usb_serial *serial)
> dev_dbg(&dev->dev, "%s - device type is %s\n", __func__,
> tdev->td_is_3410 ? "3410" : "5052");
>
> - /* if we have only 1 configuration, download firmware */
> - if (dev->descriptor.bNumConfigurations == 1) {
> + model = le16_to_cpu(dev->descriptor.idProduct);
> + switch (model) {
> + case MXU1_1130_PRODUCT_ID:
> + case MXU1_1131_PRODUCT_ID:
> + tdev->td_rs485_only = true;
> + break;
> + default:
> + tdev->td_rs485_only = false;
> + }

This should only be done for Moxa devices so we need to check the VID as
well. Preferably, this should be done based on a flag set in the
driver_info field of the usb_device_id entry for these two device types.

I added the VID check before applying, but perhaps you can consider
reworking this as a device-id quirk later.

Thanks,
Johan

\
 
 \ /
  Last update: 2016-05-11 12:01    [W:0.034 / U:4.244 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site