Re: [PATCH v2] usb: serial: ti_usb_3410_5052: add MOXA UPORT 11x0 support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
> ---

> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux