Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4446620imw; Tue, 19 Jul 2022 06:49:19 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uef5rBQOLhbAFGY9imq8rTev1Alf4hYpIGqezgLjUBoMwQOqULaDSsyEoloW22ISpwkcjw X-Received: by 2002:a17:906:8a71:b0:72b:11d6:29fc with SMTP id hy17-20020a1709068a7100b0072b11d629fcmr29923716ejc.494.1658238558798; Tue, 19 Jul 2022 06:49:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658238558; cv=none; d=google.com; s=arc-20160816; b=bKa/Ydwy/+JgEWzKyiydS2A1TVleCtVa15ZQyc6ezalVhIE3qLjJ7Z0emDJMEqejyJ ldm0HS5pBoRmhhdzW65xX7+cH1i7AQSWZnZfynfYqJjyPU/zhRK/cAVfx/P4LwMcSmv3 Oh14MNOv8cDxssSL/3x9TR8P2Uvevy4eqNTQ+E98ByClSCWfHgFbANsdZONo+rvDqmpS cvnlXhg/GPih89B2t1BHBQE8PS2eVyIeJHSGnFy0gNblkuoZ6XRYu0sX/A8lgLLBRKN+ OmEu/WH6Jlf1FXklSQXE4JD3iowxo9NK3D7AGPnfcKi6meTPCq8DuRM+DbjPp6fND9OA sqoA== 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=iq2aWTxi3s3apoW927M3+fNNZjhvn+JEuM1NZjk5vPQ=; b=r8isAQsQ//Vs54DnXSrhFxazN6q3ZklvECKhfuwLUnNq0ukoA2CmEyWcqLwEoXthXk Qxxj4zMHvzLkcSzP0gafvHTDkxgCVlpTalNx1n4Ar+mme1zyjwFBkwaq1P0X2oP9BxBI Fin07bd5m/nW+9X5oDYlyubwi7IQxWCoz0Slr4hY+S0dmDFggHkujWu4qrJpXqceJ1GF SlOzZLcLSVBy9ifvoSAEty+0PDKBwvijHZAaDQBpP4X1pbI019LilnFT7meEa3z5NKG2 26aNqlDdkX0mIcM+7cv2xe0CtEKcPyMiSAF59NMQsCwXYaGHKN52paHjOL3+wRpy+sPk bJeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lO98hW9h; 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 b20-20020a170906709400b0072af54e038fsi17526078ejk.286.2022.07.19.06.48.54; Tue, 19 Jul 2022 06:49:18 -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=lO98hW9h; 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 S241556AbiGSMrZ (ORCPT + 99 others); Tue, 19 Jul 2022 08:47:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241604AbiGSMp3 (ORCPT ); Tue, 19 Jul 2022 08:45:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8FDA89EAD; Tue, 19 Jul 2022 05:18:13 -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 F0DCAB81B10; Tue, 19 Jul 2022 12:17:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5EEA4C341C6; Tue, 19 Jul 2022 12:17:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233073; bh=9KEe7eaXtbhE+qjwrjNHYCHBExGftwM90ceOhxQI7wc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lO98hW9h8gag0+VblyDSJY0Doj5b/80sh1QBoAzNmea7uTmiC6y9cOkVKmlBNmKjL oBhpza/5PgIy/SBd34/G1Z7vgn7aieGK1eTmvXXXtrSxNIJitoY1YCtXKGsl/sVp7x YGH19LhyVVfTd9+0agAKVnR3Wvdk3atag6KD9Gaw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 5.15 164/167] serial: stm32: Clear prev values before setting RTS delays Date: Tue, 19 Jul 2022 13:54:56 +0200 Message-Id: <20220719114712.324153913@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.8 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 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: Ilpo Järvinen commit 5c5f44e36217de5ead789ff25da71c31c2331c96 upstream. The code lacks clearing of previous DEAT/DEDT values. Thus, changing values on the fly results in garbage delays tending towards the maximum value as more and more bits are ORed together. (Leaving RS485 mode would have cleared the old values though). Fixes: 1bcda09d2910 ("serial: stm32: add support for RS485 hardware control mode") Cc: stable Signed-off-by: Ilpo Järvinen Link: https://lore.kernel.org/r/20220627150753.34510-1-ilpo.jarvinen@linux.intel.com Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/stm32-usart.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/tty/serial/stm32-usart.c +++ b/drivers/tty/serial/stm32-usart.c @@ -71,6 +71,8 @@ static void stm32_usart_config_reg_rs485 *cr3 |= USART_CR3_DEM; over8 = *cr1 & USART_CR1_OVER8; + *cr1 &= ~(USART_CR1_DEDT_MASK | USART_CR1_DEAT_MASK); + if (over8) rs485_deat_dedt = delay_ADE * baud * 8; else