All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Mathieu OTHACEHE <m.othacehe@gmail.com>
Cc: johan@kernel.org, gregkh@linuxfoundation.org,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] usb: serial: ti_usb_3410_5052: add MOXA UPORT 11x0 support
Date: Wed, 11 May 2016 11:49:04 +0200	[thread overview]
Message-ID: <20160511094904.GC8910@localhost> (raw)
In-Reply-To: <1462864128-22869-1-git-send-email-m.othacehe@gmail.com>

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

      reply	other threads:[~2016-05-11  9:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-10  7:08 [PATCH v2] usb: serial: ti_usb_3410_5052: add MOXA UPORT 11x0 support Mathieu OTHACEHE
2016-05-11  9:49 ` Johan Hovold [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160511094904.GC8910@localhost \
    --to=johan@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=m.othacehe@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.