Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp6842715rwn; Tue, 13 Sep 2022 09:42:59 -0700 (PDT) X-Google-Smtp-Source: AA6agR5Fdqe4XXI7BEhHMWwkTqZq9nwuySO3Tb2kvYpufvnmjYBKVO4f9B/RExQug+CDLbcfHgF7 X-Received: by 2002:a17:902:c792:b0:178:2bd6:c429 with SMTP id w18-20020a170902c79200b001782bd6c429mr12235744pla.52.1663087379490; Tue, 13 Sep 2022 09:42:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663087379; cv=none; d=google.com; s=arc-20160816; b=PUiRpGgz0EWfUwcKb3/AJ2bpwevn995AayDOOot4pRB9vONRWTUZWrMuoLCSoQTTZY Wkt3+LDMtgmiAsULD03wX+GySGVFpAvVN0Toc6aGJqSdw53ZGwyMGIfsqhq5FplKHcT5 mm/sEvXGdyz5x7XNAaG+cp3cE8AhhW5upYtST9GnoZE2AaPChsLDO0Uz1dDXUSZ0hh+5 u2hkcZGi4Qigi33nYqJm3BrXY4q4UQDbgEFMPmbTh/dQCJwT7qlCPkUrygmCt/JXHTfh //5MkIzJYclRf0X4gb/4p50H96BtwQVtnLwVSeZednG7u95O1TDoOufuNG+TAYlhOVfN BA+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JzKAgvBYazClG/9DeVYnsnaQRH0UvtMJWzR519iJUsE=; b=a/8tjdpg4T7aC7Qni9cUEpN9O20kIIKZpCfr+f546rpIObm6YdF4MM/2S36xChvKHc XQp0zj9dNVangEBRMgGRYEX76MtYdv7VtFq3Ip+/RbskZbySQ2ru1cLpYnWVd505weF9 LKGNZaGK6BubGp5DHvQTQ3KFtVFcX4fN9GyWvpflSxC2AakT7pr4e1FN7QfhFD0d8r3p mRxNQhg2Q9/mfCa3gSlx+hFOY+Etjs35taGqJqf0TnAoyDEHV0Yt7HghicOW8ygT8kqJ wZG6NR9/WKoXEV5Nxa5F2zZJgCxYCLqdNsReeh5PDo5DYmoRhnJiJmsHnX3WFxy4lCKX u8fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cYyQRtrM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id je15-20020a170903264f00b00174af354ba5si11896413plb.69.2022.09.13.09.42.47; Tue, 13 Sep 2022 09:42:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cYyQRtrM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236388AbiIMP17 (ORCPT + 99 others); Tue, 13 Sep 2022 11:27:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236344AbiIMP0O (ORCPT ); Tue, 13 Sep 2022 11:26:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5041A7D7B2; Tue, 13 Sep 2022 07:38:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5AC71B80FBD; Tue, 13 Sep 2022 14:36:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97B2AC433D6; Tue, 13 Sep 2022 14:36:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1663079770; bh=/TwwsSZbhnBs+zIYOt3WyFteOAs2G6YYtTmToocFnig=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cYyQRtrMruymrG5kohaKjlXtsCnMdFVhwjare7Q57JUf4wA0Sn+ADqNb2zwM7JzUI iq0unDdlQ8VytS9xvajx2Dl2IlbeTOrl11WRppXXiRqgDkxbOczJxH9LNQXA1YS+Bb yN4QqRrxOZ64cNJS2yNSB57Ogok9b6UdinyXoTDo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Woithe , Johan Hovold Subject: [PATCH 4.14 59/61] USB: serial: ch341: fix disabled rx timer on older devices Date: Tue, 13 Sep 2022 16:08:01 +0200 Message-Id: <20220913140349.407381238@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220913140346.422813036@linuxfoundation.org> References: <20220913140346.422813036@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Johan Hovold commit 41ca302a697b64a3dab4676e01d0d11bb184737d upstream. At least one older CH341 appears to have the RX timer enable bit inverted so that setting it disables the RX timer and prevents the FIFO from emptying until it is full. Only set the RX timer enable bit for devices with version newer than 0x27 (even though this probably affects all pre-0x30 devices). Reported-by: Jonathan Woithe Tested-by: Jonathan Woithe Link: https://lore.kernel.org/r/Ys1iPTfiZRWj2gXs@marvin.atrad.com.au Fixes: 4e46c410e050 ("USB: serial: ch341: reinitialize chip on reconfiguration") Cc: stable@vger.kernel.org # 4.10 Signed-off-by: Johan Hovold [ johan: backport to 5.4 ] Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/ch341.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c @@ -179,8 +179,12 @@ static int ch341_set_baudrate_lcr(struct /* * CH341A buffers data until a full endpoint-size packet (32 bytes) * has been received unless bit 7 is set. + * + * At least one device with version 0x27 appears to have this bit + * inverted. */ - a |= BIT(7); + if (priv->version > 0x27) + a |= BIT(7); r = ch341_control_out(dev, CH341_REQ_WRITE_REG, 0x1312, a); if (r)