From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932272AbcEKJtM (ORCPT ); Wed, 11 May 2016 05:49:12 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:35442 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932090AbcEKJtK (ORCPT ); Wed, 11 May 2016 05:49:10 -0400 Date: Wed, 11 May 2016 11:49:04 +0200 From: Johan Hovold To: Mathieu OTHACEHE 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 Message-ID: <20160511094904.GC8910@localhost> References: <1462864128-22869-1-git-send-email-m.othacehe@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1462864128-22869-1-git-send-email-m.othacehe@gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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