Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753499AbcDJNY5 (ORCPT ); Sun, 10 Apr 2016 09:24:57 -0400 Received: from smtprelay01.ispgateway.de ([80.67.31.24]:38235 "EHLO smtprelay01.ispgateway.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751404AbcDJNY4 (ORCPT ); Sun, 10 Apr 2016 09:24:56 -0400 Subject: Re: [PATCH v2 06/14] USB: ch341: reinitialize chip on reconfiguration To: Grigori Goronzy References: <1459616843-23829-1-git-send-email-greg@chown.ath.cx> <1459616843-23829-7-git-send-email-greg@chown.ath.cx> Cc: Johan Hovold , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org From: Clemens Ladisch Message-ID: <570A540C.5090706@ladisch.de> Date: Sun, 10 Apr 2016 15:24:28 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 MIME-Version: 1.0 In-Reply-To: <1459616843-23829-7-git-send-email-greg@chown.ath.cx> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Df-Sender: bGludXgtdXNiQGNsLmRvbWFpbmZhY3Rvcnkta3VuZGUuZGU= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 826 Lines: 23 Grigori Goronzy wrote: > Changing the LCR register after initialization does not seem to be > reliable on all chips (particularly not on CH341A). Restructure > initialization and configuration to always reinit the chip on > configuration changes instead and pass the LCR register value directly > to the initialization command. > +++ b/drivers/usb/serial/ch341.c > @@ -155,9 +157,7 @@ static int ch341_set_baudrate(struct usb_device *dev, > a = (factor & 0xff00) | divisor; > b = factor & 0xff; > > - r = ch341_control_out(dev, 0x9a, 0x1312, a); > - if (!r) > - r = ch341_control_out(dev, 0x9a, 0x0f2c, b); > + r = ch341_control_out(dev, CH341_SERIAL_INIT, 0x9c | (ctrl << 8) , a | 0x80); The variable b is no longer used, so it is no longer necessary to compute the lower eight bits of the factor. Regards, Clemens